elementary / code

Code editor designed for elementary OS
https://elementary.io
GNU General Public License v3.0
480 stars 112 forks source link

Increase maximum selection length for highlighting #1470

Open jeremypw opened 1 month ago

jeremypw commented 1 month ago

Fixes #1469

The previous limit on selection highlighting length was based on selecting only a single word but the plugin actually works on multi-word selections so the limit of less than one line (potentially) does not make a lot of sense. I have increased it to 255 for now.

zeebok commented 1 month ago

Hmmm maybe I misunderstood the issue. The later example in #1443 involves highlighting just a word and causing the crash. I am not sure if I have run into an issue with multi-line deletion issue, or at least don't run into either issue on OS8 stable :frowning_face:

jeremypw commented 1 month ago

I hadn't seen that last example in #1443. I've never seem a crash with just one word selected so I am not sure whether this PR fixes that. #1443 is specifically about multi-line selections anyway. I can reproduce that issue every time.

An alternative approach to this would be to limit selection highlighting to just one word (which the original length limit implies was the original intention) - that would automatically exclude multiple lines.

zeebok commented 3 weeks ago

I hadn't seen that last example in #1443. I've never seem a crash with just one word selected so I am not sure whether this PR fixes that. #1443 is specifically about multi-line selections anyway. I can reproduce that issue every time.

At the moment I have the opposite luck with repro lol. I can always get the single word crash (with the highlight plugin on) but not a multiline.... is it pretty consistent with a certain doc that I can peek at?

jeremypw commented 3 weeks ago

@zeebok Thanks for looking into this - its strange that you get different symptoms! If you take a look at the comments to https://github.com/elementary/code/pull/1447, there is a text file there that I posted on July 27 for Danielle to use to reproduce. I may have to reduce the scope of this to fixing #1469 if it does not fix the other issue for everyone.

jeremypw commented 3 weeks ago

I don't think it relies on a particular document - I never get a crash with single word deletion of a selected, highlighted word (with BackSpace) whereas as you and others do. It must be some obscure race that depends on details of the particular machine being used.

jeremypw commented 3 weeks ago

@zeebok I've just noticed that after trying to reproduce the single word crash, the document no longer responds to keyboard input, although Code overall responds as normal - is this the issue you have?

Forget it - I had turned the Vim emulation on!!