A proposal was made 2 years ago to include a way to view just the lines that match a search string. This has progressed recently with much of the feature implemented on Win32 and GTK. There could still be some bugs and the functionality may need refinement. The current code has been uploaded so other people can experiment with it.
An image of the filter view on Windows, showing 2 lines of context around each match is at
There is a separate filter view accessed from Search | Filter. The last icon on the filter strip toggles context on/off. The replace strip can also filter: the third icon on the top row toggles filter view on/off and there is a context toggle to its right.
A screenshot on GTK, with the replace strip in filter mode:
The new ‘filter’ and ‘context’ buttons are surrounded with orange.
The number of lines of context is defined by the filter.context property. Hidden lines are indicated with a line drawn with the value of the hidden.line.colour property. Matches are shows with the indicator specified with the find.indicator.incremental property. When context is shown, the match lines are highlighted with yellow which is currently hard coded but should be a property.
The source code can be downloaded from
A Windows 64-bit executable is at
The feature request is at
Current issues:
Scintilla doesn’t support hiding the first line. Its possible that this could be improved. If not, it might be reasonable to make the first line blank by drawing the background colour over it.
As it may take some time to search the whole document when large, this is performed as a background idle task. This sometimes causes more flashing as lines are shown and hidden.
The original proposal added another toggle button for incremental search. This is currently a property. There are arguments both ways on how best to control incremental search.
The amount of context is set with a property. It may be better to include a way to change this interactively.
Any folds are unfolded for filter view and there are attempts to restore folds after filter view ends. This may not work in all cases such as when the fold structure is changed while the view is filtered - perhaps a ‘{‘ was added or removed.
Neil