@robby I have a definitions text mixin that sets the comment style to a proportional font. When typing within a comment it appears to briefly insert new characters with a non-comment style which makes the line height and cursor jump for a moment until the comment style is applied. This occurs regardless of whether (send this set-styles-sticky #true)
and (send this set-styles-fixed #false)
. Do you have any thoughts on how to approach a fix?
When text is inserted, it is put in with a well-known style
what you’re seeing is that well-known style being changed to the one you set for the comment font
that is, the editor, when getting a keystoke, has to pick a style for the new chars
so it picks one
(black monospaced and it has a name I can look up later)
and then the colorer (eventually) comes along and figures out that this is a comment, and so chnages it
right, there’s a lot of setting to the basic style in text%
, which is what the other styles are deltas of, correct?
yes
probably
:slightly_smiling_face:
the code for insertion is rather elaborate, but there appear to be places where it checks stickyness, and also the style of an inserted snip
overriding insert
to convert a character insert to a string-snip%
insert with the desired style doesn’t seem to work though
this is where it does the changing you are asking for I believe
I think you probably want to generalize styles-fixed?
so that it lets you pick a style based on the position or something
or maybe that’s not so great, actually, since the styles being fixed to monospaced is kind of assumed everywhere
maybe the best thing is to pick a monospaced font and comment font that are matched to agree on things like line height.
I don’t think that after-insert
is the problem, although I’ll check to make sure : there’s a lot happening in text%
before that.
Oh, overriding insert
and unsetting styles-fixed?
there did the trick! So I’ll backtrack to where it was being (re)set. Also, I hadn’t looked at text-basic%
either. Thanks!
I don’t think you should override insert
If you want to disable styles fixed, you can, but that may break other thins
things
understood, proceeding at my own risk (and maybe that of my captive student audience this fall :slightly_smiling_face:)