Skip to content

Smaller bug fixes in the editor libraries#8324

Merged
eirikbakke merged 4 commits intoapache:masterfrom
eirikbakke:pr-editorimp
Mar 15, 2025
Merged

Smaller bug fixes in the editor libraries#8324
eirikbakke merged 4 commits intoapache:masterfrom
eirikbakke:pr-editorimp

Conversation

@eirikbakke
Copy link
Copy Markdown
Contributor

@eirikbakke eirikbakke commented Mar 12, 2025

Here are a few smaller bug fixes in the ide/editor.lib2 module, each in a separate commit (since they are independent of each other).

  • For platform apps that use the THIN_LINE_CARET option, on HiDPI monitors, fix a paint bug where a pixel-thick line from the caret may remain outside the repaint area, leaving "cursor droppings" behind as the user types.

  • Avoid a NullPointerException that could occur if an editor is closed while MacOS trackpad scrolling events are still coming in.

  • Fix an editor repaint bug which could leave lines appearing duplicated. Easy to reproduce on plain text files; see the commit for reproduction steps.

    image

    The cause was clear: An existing comment in o.n.modules.editor.lib2.view.ViewBuilder explains that "For valid firstReplace the current impl repaints whole line", but that repaint was in a block of code that was being skipped as an optimization (the "accurate span" calculation). The fix is to check for the "firstReplace" case and ensure that repaint() will be called regardless (via the checkLayoutUpdate method).

  • When line wrapping is enabled, adjust the wrap line length so that the text caret can't end up completely outside the scroll viewport (making it invisible).

The bug was easy to reproduce in the IDE:
1) Create an empty text file
2) Enter one line of text
3) Move the cursor to the start
4) Press Enter a few times. Frequently, when the necessary repaint isn't coincidentally triggered by the cursor blinking, the line will appear painted multiple times (because the previous position of the shifted line isn't repainted).
…ing off the paintable edge at the end of a long line.
@eirikbakke eirikbakke added Editor Platform [ci] enable platform tests (platform/*) labels Mar 12, 2025
@apache apache locked and limited conversation to collaborators Mar 12, 2025
@apache apache unlocked this conversation Mar 12, 2025
Copy link
Copy Markdown
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick test on a "normal" screen. Caret still seems to work correctly, I reproduced the redrawing problem and found it fixed with this change. Eyeballed the rest and looks sane to me.

@eirikbakke
Copy link
Copy Markdown
Contributor Author

Thanks for testing and reviewing!

@eirikbakke
Copy link
Copy Markdown
Contributor Author

When I press "Merge pull request" I get a new prompt now that I haven't seen before:

image

Is this the right way to merge? (In this particular PR's case I do want to keep the commits separate.)

@matthiasblaesing
Copy link
Copy Markdown
Contributor

Just looked into another project and there all options (plain merge, squash and merge and rebase and merge) are available and for merge it looks identical. The GUI makes sense when you come from git CLI client as for a non-ff merge a commit message is required there too. As the email is selectable, I assume that it will be correctly recorded.

@eirikbakke eirikbakke merged commit 882d1a7 into apache:master Mar 15, 2025
33 of 60 checks passed
@eirikbakke
Copy link
Copy Markdown
Contributor Author

Thanks! Yeah, I merged and it looks the same as other merged PRs.

@neilcsmith-net neilcsmith-net added this to the NB26 milestone Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Editor Platform [ci] enable platform tests (platform/*)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants