lucax88x / CodeAceJumper

Ace Jump extension for Visual Studio Code
MIT License
76 stars 14 forks source link

Fix multichar decorations at line end, closes #196 #201

Closed pe224 closed 4 years ago

pe224 commented 4 years ago

I tried fixing the line-end decorations issue here. It's kind of a hack... couldn't think of anything better.

Problem is, that if a two char decoration needs to be shown at end of line, the second decoration needs to have be at range (line.length + 1, line.length + 2) which is invalid.

My solution is to keep track of all decorations at the line endings (via this.lineEndDecorations). Then, if a 2nd char needs to be displayed at the invalid range above, we "merge" it with the decoration of the first character (which is already there at the end of line) and create a single 2-character decoration instead of two separate 1-character decorations.

This "merging" only affects the decorations (i.e. the display layer) - it does not touch the underlying placeholders array and thus should not really change functionality of jumping etc. itself.

pe224 commented 4 years ago

@lucax88x Hey man, hope you're alright. When you find time, I would appreciate you having a look at this PR. The bug is kinda annoying at the moment 😉

lucax88x commented 4 years ago

@pe224 Sorry, it has been busy weeks here.. Let me have a check and try to deploy.

lucax88x commented 4 years ago

@pe224 Deployed with 3.3.1

pe224 commented 4 years ago

Nice, thanks! Happy to hear that you're fine and not in the hospital... since you have an Italian-sounding name I was wondering 😨