Notepad2e icon indicating copy to clipboard operation
Notepad2e copied to clipboard

Split view

Open ProgerXP opened this issue 5 years ago • 8 comments
trafficstars

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.

ProgerXP avatar Sep 18 '20 11:09 ProgerXP

Demo for initial testing purposes: image

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?).

cshnik avatar Nov 24 '20 02:11 cshnik

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.

ProgerXP avatar Nov 26 '20 14:11 ProgerXP

A great example is Notepad++ - see how their View > Move/Clone Current Document > Clone To Other View command works.

ProgerXP avatar Nov 26 '20 18:11 ProgerXP

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

ProgerXP avatar Jan 13 '21 15:01 ProgerXP

  • 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.

cshnik avatar Mar 25 '21 01:03 cshnik

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 to back:X where X = default of back of Margin and Line Numbers
    • also handle size style to increment/decrement (size:1, size:-2) width/height of splitters using some hardcoded step (e.g. 2 pixels), and add size:0 to default rule styles so users see this change is possible
  • 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)?

ProgerXP avatar Jul 29 '21 09:07 ProgerXP

  • 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 to back:X where X = default of back of Margin and Line Numbers

    • also handle size style to increment/decrement (size:1, size:-2) width/height of splitters using some hardcoded step (e.g. 2 pixels), and add size:0 to default rule styles so users see this change is possible
  • 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

Done.

cshnik avatar Sep 14 '22 17:09 cshnik

  • 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.

cshnik avatar Sep 23 '22 18:09 cshnik