ProgerXP / Notepad2e

Word highlighting, simultaneous editing, split views, math evaluation, un/grep, comment reformatting, UAC elevation, complete regexps (PCRE), Lua lexers, DPI awareness and more (XP+)
Other
375 stars 52 forks source link

Split view #316

Closed ProgerXP closed 2 years ago

ProgerXP commented 4 years ago

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.

cshnik commented 3 years ago

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

ProgerXP commented 3 years ago

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 commented 3 years ago

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

ProgerXP commented 3 years ago

Some notes on the implementation (that is nearly finished):

cshnik commented 3 years ago
  • 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.

ProgerXP commented 3 years ago

Enhancements:

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

cshnik commented 2 years ago
  • 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 commented 2 years ago
  • 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.