mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 06:50:56 +03:00
Theme Editor: use markAll() (instead of find()) to avoid that selection jumps to next occurrence when showing find bar or when changing options
This commit is contained in:
@@ -77,7 +77,7 @@ class FlatFindReplaceBar
|
|||||||
super.addNotify();
|
super.addNotify();
|
||||||
|
|
||||||
// if showing bar, highlight matches in editor
|
// if showing bar, highlight matches in editor
|
||||||
find();
|
markAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,11 +99,21 @@ class FlatFindReplaceBar
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void find() {
|
private void find() {
|
||||||
|
findOrMarkAll( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void markAll() {
|
||||||
|
findOrMarkAll( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void findOrMarkAll( boolean find ) {
|
||||||
// update search context
|
// update search context
|
||||||
context.setSearchFor( findField.getText() );
|
context.setSearchFor( findField.getText() );
|
||||||
|
|
||||||
// find
|
// find
|
||||||
SearchResult result = SearchEngine.find( textArea, context );
|
SearchResult result = find
|
||||||
|
? SearchEngine.find( textArea, context )
|
||||||
|
: SearchEngine.markAll( textArea, context );
|
||||||
|
|
||||||
// update matches info label
|
// update matches info label
|
||||||
matchesLabel.setText( result.getMarkedCount() + " matches" );
|
matchesLabel.setText( result.getMarkedCount() + " matches" );
|
||||||
@@ -111,17 +121,17 @@ class FlatFindReplaceBar
|
|||||||
|
|
||||||
private void matchCaseChanged() {
|
private void matchCaseChanged() {
|
||||||
context.setMatchCase( matchCaseToggleButton.isSelected() );
|
context.setMatchCase( matchCaseToggleButton.isSelected() );
|
||||||
find();
|
markAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void matchWholeWordChanged() {
|
private void matchWholeWordChanged() {
|
||||||
context.setWholeWord( matchWholeWordToggleButton.isSelected() );
|
context.setWholeWord( matchWholeWordToggleButton.isSelected() );
|
||||||
find();
|
markAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void regexChanged() {
|
private void regexChanged() {
|
||||||
context.setRegularExpression( regexToggleButton.isSelected() );
|
context.setRegularExpression( regexToggleButton.isSelected() );
|
||||||
find();
|
markAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void close() {
|
private void close() {
|
||||||
|
|||||||
Reference in New Issue
Block a user