changeset 24171:1680d425bb38

also place marker in editor margin for lines matching selected word * file-editor-tab.h, file-editor-tab.cc (file_editor_tab::_marker_highlight_all): New data member. (file_editor_tab::file_editor_tab): Define marker. (file_editor_tab::update_lexer_settings): Set marker colors. (file_editor_tab::handle_double_click): Also set and clear margin marker. * octave-qscintilla.h, octave-qscintilla.cc (octave_qscintilla::clear_indicator): New argument, marker_style. Also delete all marker_style markers.
author John W. Eaton <jwe@octave.org>
date Mon, 23 Oct 2017 20:35:17 -0400
parents 3dbd6409eeb9
children 90903d915625
files libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h libgui/src/m-editor/octave-qscintilla.cc libgui/src/m-editor/octave-qscintilla.h
diffstat 4 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Tue Oct 24 15:56:22 2017 +0200
+++ b/libgui/src/m-editor/file-editor-tab.cc	Mon Oct 23 20:35:17 2017 -0400
@@ -243,6 +243,10 @@
     _indicator_highlight_all = 1;
 
   _edit_area->setIndicatorDrawUnder (true, _indicator_highlight_all);
+
+  _marker_highlight_all = _edit_area->markerDefine (QsciScintilla::Minus);
+  if (_marker_highlight_all == -1)
+    _marker_highlight_all = 1;
 }
 
 file_editor_tab::~file_editor_tab (void)
@@ -803,6 +807,9 @@
   _edit_area->setIndicatorForegroundColor (hg, _indicator_highlight_all);
   _edit_area->setIndicatorOutlineColor (hg, _indicator_highlight_all);
 
+  _edit_area->setMarkerBackgroundColor (hg, _marker_highlight_all);
+  _edit_area->setMarkerForegroundColor (hg, _marker_highlight_all);
+
   // fix line number width with respect to the font size of the lexer and
   // set the line numbers font depending on the lexers font
   if (settings->value ("editor/showLineNumbers", true).toBool ())
@@ -2849,7 +2856,8 @@
     {
       // double clicks without modifier
       // clear any existing indicators of this type
-      _edit_area->clear_indicator (_indicator_highlight_all);
+      _edit_area->clear_indicator (_indicator_highlight_all,
+                                   _marker_highlight_all);
 
       if (_highlight_all_occurrences)
         {
@@ -2898,6 +2906,9 @@
                   _edit_area->fillIndicatorRange (oline, ocol - wlen,
                                                   oline, ocol,
                                                   _indicator_highlight_all);
+
+                  _edit_area->markerAdd (oline, _marker_highlight_all);
+
                   // find next occurrence
                   find_result_available = _edit_area->findNext ();
                 }
--- a/libgui/src/m-editor/file-editor-tab.h	Tue Oct 24 15:56:22 2017 +0200
+++ b/libgui/src/m-editor/file-editor-tab.h	Mon Oct 23 20:35:17 2017 -0400
@@ -307,6 +307,7 @@
   bool _lines_changed;
   bool _highlight_all_occurrences;
   int _indicator_highlight_all;
+  int _marker_highlight_all;
   int m_bp_restore_count;
 
 };
--- a/libgui/src/m-editor/octave-qscintilla.cc	Tue Oct 24 15:56:22 2017 +0200
+++ b/libgui/src/m-editor/octave-qscintilla.cc	Mon Oct 23 20:35:17 2017 -0400
@@ -322,12 +322,14 @@
 
 // helper function for clearing all indicators of a specific style
 void
-octave_qscintilla::clear_indicator (int indicator_style)
+octave_qscintilla::clear_indicator (int indicator_style, int marker_style)
 {
   int end_pos = text ().length ();
   int end_line, end_col;
   lineIndexFromPosition (end_pos, &end_line, &end_col);
   clearIndicatorRange (0, 0, end_line, end_col, indicator_style);
+
+  markerDeleteAll (marker_style);
 }
 
 // Function returning the true cursor position where the tab length
--- a/libgui/src/m-editor/octave-qscintilla.h	Tue Oct 24 15:56:22 2017 +0200
+++ b/libgui/src/m-editor/octave-qscintilla.h	Mon Oct 23 20:35:17 2017 -0400
@@ -53,7 +53,7 @@
   void context_run (void);
   void get_global_textcursor_pos (QPoint *global_pos, QPoint *local_pos);
   bool get_actual_word (void);
-  void clear_indicator (int indicator_style);
+  void clear_indicator (int indicator_style, int marker_style);
   void get_current_position (int *pos, int *line, int *col);
   QString comment_string (void);
   int get_style (int pos = -1);