Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display quick search dialog result in SourceViewer with line numbers. Fixes #2010 #2644

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

RedeemerSK
Copy link

@RedeemerSK RedeemerSK commented Dec 21, 2024

What it does

Adds line numbers (vertical ruler) when presenting content that contains searched term in Quick Search dialog. For this, simple StyledText widget that was used to present content was replaced with SourceViewer widget. It's configured with same colors like generic text editor.

  • also adds standard current line highlighting based on caret position (*)
  • also always highlights (with 'current line highlight' background color) the line that contains selected match regardless of caret position - to help telling apart target match / line amongst multiple matches on other lines possibly present around target match (*)
  • also scrolls horizontally, if necessary, to reveal 1st match of the searched term in the target line
  • reacts to individual color preferences changes even if opened

(* current line highlighting must be enabled in preferences)

How to test

Open Quick Search dialog (default: CTRL + SHIFT + ALT + L) and confirm bottom area presenting parts of files where match was found behaves like it used to - displays match vertically centered, keeps it centered on resizing the dialog or area, displays match 'context' (lines before & after match within source file).

Known bugs

Changing theme (light <-> dark) while Quick Search dialog is open does not change all the colors used inside it (namely occurrences highlighting). Closing and reopening the dialog fixes the colors.

Author checklist

@RedeemerSK
Copy link
Author

RedeemerSK commented Dec 21, 2024

(following pictures were taken before #2541 (adding 'search in' combo box with history) was merged)

Before
before_light
before_dark
After
after_light
after_dark

After + caret located on line other than target line, caret line becomes highlighted as well
after_dark_line_highlight

@BeckerWdf
Copy link
Contributor

Thats a nice addition.

@@ -1030,47 +1168,6 @@ private StyledString highlightMatches(String visibleText) {
return styledText;
}

// Version using sourceviewer
Copy link
Contributor

Choose a reason for hiding this comment

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

do we know why this was discarded in the first place?

Copy link
Author

@RedeemerSK RedeemerSK Dec 23, 2024

Choose a reason for hiding this comment

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

It was already there (see 1st commit) when QuickSearchDialog code was contributed from Spring Tools suite.
From what I can tell it was always just a protoype code - when I tried it uncommented it looked just like that.

Copy link
Contributor

github-actions bot commented Jan 9, 2025

Test Results

0 files   -  1 821  0 suites   - 1 821   0s ⏱️ - 1h 39m 10s
0 tests  -  7 734  0 ✅  -  7 505  0 💤  - 228  0 ❌  - 1 
0 runs   - 24 363  0 ✅  - 23 613  0 💤  - 749  0 ❌  - 1 

Results for commit b72a51b. ± Comparison against base commit 6db4ad4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants