Mostly comes from detecting the case of runs of ASCII printable
characters and using a special fast path for them. Improves benchmarks
as per benchmark.py by 15-30% for text heavy workloads
Adds remap_modifier config option to present one modifier key to kitty
as another, as discussed in issue #1077. Resolves merge conflicts by
adopting master's formatting style (multi-line macros, pointer spacing)
while preserving all new PR functionality.
Co-Authored-By: Bjoern <bjohas@users.noreply.github.com>
screen_scroll() looped `count` times with no upper bound, so CSI 2147483647 S
spun for ~2.1 billion iterations at 100% CPU and never returned, hanging the
whole terminal.
Scrolling up by more than the number of lines on screen blanks the entire
region, so clamp count to self->lines. Scroll Down (_reverse_scroll) already
caps its count the same way.
Fixes#10333
Covers the empty default, a single remap, that both directions of a swap are
recorded, that the last declaration for a source wins wherever it appears,
multi-modifier destinations, and that every rejection is reported rather than
silently ignored: wrong arity, unknown or non-remappable modifier names, a
source naming more than one modifier, and a no-op mapping.
Whether the permutation is applied simultaneously rather than sequentially is
a property of the C code and is not observable from the parsed dict, which is
identical either way; the comment says so rather than implying more coverage
than exists.
save_as_session recorded only the state of the tab's active layout, so the state
of any layout the tab had been toggled away from was lost. Toggling a splits tab
to the stack layout and saving discarded the splits tree entirely, because Stack
has no layout_state() of its own, and switching back to splits after restoring
rebuilt the tree from scratch along the default axis.
The session file also carried no last_used_layout, so _last_used_layout was None
after a restore and toggle_layout <current layout> silently did nothing, since it
delegates to last_used_layout() which returns early when unset. The key that
produced the stack layout no longer undid it.
Tab now keeps the layouts it has used, by name, and writes their state plus
last_used_layout into the existing set_layout_state JSON rather than adding new
session commands. Older versions of kitty ignore unknown keys in that dict but
abort on unknown commands, so nesting keeps session files readable by them.
Restoring the state of a layout that is not being made current must not reorder
the window list, since only the current layout determines window order, hence
apply_to_window_list. Splits.set_layout_state also has to accept state for a
layout whose tree is still empty, which is the case for a layout that has not
laid out any windows yet.
Fixes#10320
NUL is anyway not legal in paths and it causes session files saved with
such paths to fail
We dont remove other control codes since they are actually legal in
paths.
Fixes#10321