@@ -3766,6 +3766,19 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
37663766 if (text != null ) findDialog .setSearchPattern (text );
37673767 findDialog .show (false );
37683768 });
3769+ jmi = new JMenuItem ("Search Script for Selected Text" );
3770+ popup .add (jmi );
3771+ jmi .addActionListener (e -> {
3772+ final String text = textArea .getSelectedText ();
3773+ if (text == null ) {
3774+ UIManager .getLookAndFeel ().provideErrorFeedback (textArea );
3775+ } else {
3776+ findDialog .setLocationRelativeTo (this );
3777+ findDialog .setRestrictToConsole (false );
3778+ if (text != null ) findDialog .setSearchPattern (text );
3779+ findDialog .show (false );
3780+ }
3781+ });
37693782 popup .addSeparator ();
37703783
37713784 jmi = new JMenuItem ("Clear Selected Text..." );
@@ -3776,6 +3789,8 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
37763789 else
37773790 textArea .replaceSelection ("" );
37783791 });
3792+ final DefaultHighlighter highlighter = (DefaultHighlighter )textArea .getHighlighter ();
3793+ highlighter .setDrawsLayeredHighlights (false );
37793794 jmi = new JMenuItem ("Highlight Selected Text..." );
37803795 popup .add (jmi );
37813796 jmi .addActionListener (e -> {
@@ -3784,7 +3799,8 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
37843799 final DefaultHighlightPainter painter = new DefaultHighlighter .DefaultHighlightPainter (color );
37853800 textArea .getHighlighter ().addHighlight (textArea .getSelectionStart (), textArea .getSelectionEnd (), painter );
37863801 textArea .setCaretPosition (textArea .getSelectionEnd ());
3787- } catch (BadLocationException ignored ) {
3802+ textArea .getHighlighter ();
3803+ } catch (final BadLocationException ignored ) {
37883804 UIManager .getLookAndFeel ().provideErrorFeedback (textArea );
37893805 }
37903806 });
0 commit comments