gfb
2019-8-20 17:53:52

@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?


robby
2019-8-20 17:54:40

When text is inserted, it is put in with a well-known style


robby
2019-8-20 17:54:52

what you’re seeing is that well-known style being changed to the one you set for the comment font


robby
2019-8-20 17:55:17

that is, the editor, when getting a keystoke, has to pick a style for the new chars


robby
2019-8-20 17:55:22

so it picks one


robby
2019-8-20 17:55:31

(black monospaced and it has a name I can look up later)


robby
2019-8-20 17:55:49

and then the colorer (eventually) comes along and figures out that this is a comment, and so chnages it


gfb
2019-8-20 17:57:47

right, there’s a lot of setting to the basic style in text%, which is what the other styles are deltas of, correct?


robby
2019-8-20 17:57:56

yes


robby
2019-8-20 17:57:58

probably


robby
2019-8-20 17:57:58

:slightly_smiling_face:


gfb
2019-8-20 17:58:44

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


gfb
2019-8-20 17:59:22

overriding insert to convert a character insert to a string-snip% insert with the desired style doesn’t seem to work though


robby
2019-8-20 17:59:54

this is where it does the changing you are asking for I believe



robby
2019-8-20 18:00:32

I think you probably want to generalize styles-fixed? so that it lets you pick a style based on the position or something


robby
2019-8-20 18:00:54

or maybe that’s not so great, actually, since the styles being fixed to monospaced is kind of assumed everywhere


robby
2019-8-20 18:01:20

maybe the best thing is to pick a monospaced font and comment font that are matched to agree on things like line height.


gfb
2019-8-20 18:02:51

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.


gfb
2019-8-20 18:09:30

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!


robby
2019-8-20 18:31:44

I don’t think you should override insert


robby
2019-8-20 18:31:56

If you want to disable styles fixed, you can, but that may break other thins


robby
2019-8-20 18:31:58

things


gfb
2019-8-20 20:05:12

understood, proceeding at my own risk (and maybe that of my captive student audience this fall :slightly_smiling_face:)