Follow up to the merge of PR #10560 which skips input_delay when less
than 1 KiB of program output is pending.
Fix a data race: the I/O thread called
vt_parser_pending_input_is_interactive() which read read.pos under the
parser lock, but the main thread modifies read.pos without the lock
while parsing, so taking the lock on one side only did not protect it.
Instead, vt_parser_commit_write() now returns whether the pending input
is small, computed from read.sz and write.pending, which are only
modified with the lock held. This may overestimate while a parse is in
progress or when an incomplete escape code is retained, in which case
we simply fall back to the normal input_delay behavior. It also saves a
lock/unlock cycle per read in the I/O thread.
Bound the number of early main loop wakeups: since render() bypasses
repaint_delay whenever input was read, input_delay was the effective
cap on parse/render frequency for streaming output. Waking the main
loop on every small read removed that cap entirely for programs that
emit a continuous stream of small writes, costing CPU and increasing
the chance of drawing partial screen updates. Now an early wakeup is
only allowed if the previous wakeup was not itself early, so typed
character echo is still delivered immediately while streams of small
writes get at most two wakeups per input_delay.
Replace the magic 1024 with SMALL_PENDING_INPUT_THRESHOLD, rename
pending_input_is_interactive() to pending_input_is_small() since the
check has nothing to do with interactivity, clarify the input_delay
option documentation and add a changelog entry.
find_matches_in_lines was passing the exclusive end offset of a match to
find_pos, so a match ending at the end of the joined screen lines mapped
to no line and was dropped. It was not highlighted, not counted and n/N
skipped it. Since screen lines are not padded, this hit any match on the
last character of a line, for example searching for foo in "x := foo".
Look up the line holding the last matched byte instead.
regexp2 backtracks on the path pattern, retrying it at every position
of a long line that has no spaces, so the path and linenum types took
seconds on a screen full of such text (about 36s for a 380x100 window
of hex). The builtin patterns dont need lookarounds, so use the linear
time stdlib engine for them. User supplied --regex patterns stay on
regexp2 so lookarounds keep working (#6265).
- Dropping a tab on the tab bar always re-orders. Only windows are merged
into a tab when dropped on its middle. Single window tabs still switch
tabs on hover so they can be dropped into the content area.
- Draw the vertical insertion marker in the blank line between tabs so it
does not hide a tab title, using a single cell only when crowded.
- Make the dropped tab active after a drop from another OS Window, instead
of whichever tab ended up at the stale active index after re-ordering.
- Dropping the window of a single window tab at an insertion point moves
its tab, preserving title and layout, and is a no-op next to itself.
- Do not leave an empty tab behind if moving a dropped window fails.
- Highlight the new tab button only when appending.
- Unify the window and tab drag hover state and share the tab bar drop
hit testing code.
word_diff_center filled an (m+1)*(n+1) table of ints for the differing
middle of every changed line pair. For a 100 KB line of minified
JavaScript with a word inserted near each end that is 2.6 GB and over
two seconds, and compute_centers runs the line pairs in parallel.
Changed words are only highlighted when they pair up by position, which
needs the same number of words on both sides, so return changed_center
right away when the counts differ. The output is the same as before in
that case. Lines with equal word counts but more than 2048 words between
the first and last changed word now get the central highlight too
instead of a huge table, and the table uses int32.
score_item tried every combination of positions of the needle chars in the
item, which is exponential in the length of the query. Typing the full name
of a theme like "Solarized Dark Higher Contrast" in the themes kitten froze it
for about half a minute.
Instead find the best score for each position of each needle char from the
best scores for the previous char. The per char scores are added in the same
order as before, so the scores are bit for bit identical. When several sets
of positions have exactly the same score, the highlighted positions can be
different from before.
Problem: On X11/KDE, with two kitty windows on different virtual
desktops, switching desktops with the keyboard while the mouse pointer
sits still caused both windows to report as "focused". Keyboard input
still went to visible window, but paste and other actions went to the
other window. Fixed by ignoring FocusIn/FocusOut when ``detail ==
NotifyPointer``.
Logfile before::
0x2 focused: 0 0x2 focused: 1 0x1 focused: 1
Logfile after::
0x2 focused: 0 0x1 focused: 1
Video attached. This same approach is used by Qt and Wine,
148bc4bc05/src/plugins/platforms/xcb/qxcbwindow.cpp (L2292-L2312)9d17984f27/dlls/winex11.drv/event.c (L697)
active_window_padding only counted padding and cell-size compensation,
so the space a layout reserves for the window border (and margin) was
treated as outside the active window. With dim-inactive-windows this
left a thin dimmed strip around the active window and dimmed the active
border color.
Use render_data.geometry.spaces, which is exactly what the layout
reserved around the window. This respects layouts that do not reserve
border space in minimal border mode, so the active area never extends
into a neighboring window. Add a test that the reserved boxes of
visible windows never overlap and stay within the central area.
The builtin pipeline dimmed everything outside the cell area of the
active window, which produced a dark frame around the active window
(whose thickness varied with the size mismatch padding) and a dimmed tab
bar. Enable DIM_CENTRAL_AREA_ONLY and INCLUDE_WINDOW_PADDING.
Fixes#10524
draw_tab_with_powerline draws the separator right after the title and
blends it into the background of the next tab, which is correct for a
horizontal tab bar. In a vertical tab bar each tab has its own row,
pre-filled with the tab background, so the separator ended up in the
middle of the row, coloured as the tab on the row below, and tabs of the
same colour got a stray soft separator.
For vertical tab bars, pad the title with the tab background up to the
right edge and draw the separator there, blending into the tab bar
background, as is already done for the fade style.