Notepad2e
Notepad2e copied to clipboard
Split view
Research Scintilla features related to split view, i.e. splitting a Notepad2 window into multiple smaller areas that all display different portions of the opened file, with different scroll position and selection.
For example, a window can be split into 3 areas:
==================
| Large top area |
|----------------|
| Left | Right |
==================
User can resize these areas by dragging splitters (thin resizers) between them.
Demo for initial testing purposes:

At this point even basic operations are not supported in the additional views. Please provide required set of features which should be implemented for these (highlighting/find-search/cursor navigation/etc/all at once?).
Please provide required set of features which should be implemented for these (highlighting/find-search/cursor navigation/etc/all at once?).
All views should have the same features, they simply duplicate the "main" view except for scroll position and selection that is unique per view. Actions that affect a buffer (e.g. typing, menu commands, etc.) affect last focused view.
A great example is Notepad++ - see how their View > Move/Clone Current Document > Clone To Other View command works.
Some notes on the implementation (that is nearly finished):
- unlike Notepad++, our split view supports any layout, not only 2 vertical or 2 horizontal, just like vim's
sp/vsp - unlike Notepad++, resizing is done after drag ends (mouse button is released) to avoid unpretty blurred area (forcing frequent redraw would cause unnecessary overhead)
- the layout is managed using toolbar buttons only (split right, split bottom, delete split) - no hotkeys for now
- view can be resized by dragging the spliiter
- double click on a spliiter makes adjacent views 50% (
^W, =in vim) - mouse wheel scrolls the view under cursor or current active view depending on the Windows setting ("Scroll inactive windows when I hover over them", not present in XP)
- most commands (Find, selection, etc.) affect current active view, others affect all views (Font, Charset, etc.)
- it's technically possible to implement layout saving but this isn't useful for me (feedback welcome)
- same note goes for layout flipping (vertical -> horizontal and back)
- added new Style:
Current Line, Inactive View (Color)(and same style for 2nd Scheme); used when Highlight Current Line is on to paint line background in a view that has no focus
- added new Style:
Current Line, Inactive View (Color)(and same style for 2nd Scheme); used when Highlight Current Line is on to paint line background in a view that has no focus
Works when HighlightLineIfWindowInactive option is ON.
Enhancements:
- fix color of Long Line Marker in sectondary views (always gray)
- position caret in the new view on the line number where the caret was in the previous view (done in e20d94e)
- make splitter's background color (currently
COLOR_BTNFACE) dependent on new schema rule:Default Text > Splitter, that defaults toback:XwhereX= default ofbackofMargin and Line Numbers- also handle
sizestyle to increment/decrement (size:1,size:-2) width/height of splitters using some hardcoded step (e.g. 2 pixels), and addsize:0to default rule styles so users see this change is possible
- also handle
- if hotkeys Ctrl+PageUp/PageDown are currently the same as Ctrl+
[/]then change the former to work like this: Ctrl+PageUp goes to previous view, Ctrl+PageDown - to next, Shift+Ctrl+PageUp opens new vertical view, Shift+Ctrl+PageDown - new horizontal - add new setting to
Esc Key Function: "First Close Current &Split View, If Any" (under---in the end of Esc Key Function's submenu, as with View > Highlight Current Selection), enabled by default (if current view can't be closed and this is enabled then Escape does nothing)
For discussion: currently the first (initial) view is special in that it can't be closed. How hard is it to make it closeable as well (as long as there are at least 2 views)?
fix color of Long Line Marker in sectondary views (always gray)
position caret in the new view on the line number where the caret was in the previous view (done in e20d94e)
make splitter's background color (currently
COLOR_BTNFACE) dependent on new schema rule:Default Text > Splitter, that defaults toback:XwhereX= default ofbackofMargin and Line Numbers
- also handle
sizestyle to increment/decrement (size:1,size:-2) width/height of splitters using some hardcoded step (e.g. 2 pixels), and addsize:0to default rule styles so users see this change is possibleif hotkeys Ctrl+PageUp/PageDown are currently the same as Ctrl+
[/]then change the former to work like this: Ctrl+PageUp goes to previous view, Ctrl+PageDown - to next, Shift+Ctrl+PageUp opens new vertical view, Shift+Ctrl+PageDown - new horizontal
Done.
- add new setting to
Esc Key Function: "First Close Current &Split View, If Any" (under---in the end of Esc Key Function's submenu, as with View > Highlight Current Selection), enabled by default (if current view can't be closed and this is enabled then Escape does nothing)
Done.
For discussion: currently the first (initial) view is special in that it can't be closed. How hard is it to make it closeable as well (as long as there are at least 2 views)?
Done.
Additional improvement added: reduced flickering when creating/deleting split views. It is still seen with some GPUs but changing DisplayTechnology to 0 (GDI) removes it entirely.