Theme Editor: avoid changing editor text (and adding item to undo history) when simply pressing OK button in "Insert Color" dialog without changing anything

This commit is contained in:
Karl Tauber
2021-08-23 23:56:27 +02:00
parent 999fd0d4da
commit ecdb000818

View File

@@ -345,7 +345,13 @@ class FlatSyntaxTextAreaActions
restore.run();
// update editor
textArea.replaceRange( colorToString( chooser.getColor() ), start, start + length.get() );
String newStr = colorToString( chooser.getColor() );
try {
if( !newStr.equals( textArea.getText( start, length.get() ) ) )
textArea.replaceRange( newStr, start, start + length.get() );
} catch( BadLocationException ex ) {
ex.printStackTrace();
}
// remember selected tab
if( tabbedPane instanceof JTabbedPane )