Fix double-click word selection not extending beyond viewport edges

Add continue_word_upwards_scrollback() and continue_word_downwards_offscreen()
to extend word selection beyond viewport boundaries, mirroring the line
selection fix. Add tests for word selection wrapping into scrollback and
below viewport.

Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/58191e45-d925-4996-b0d5-8b1bd4baa8d5

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-07 09:49:50 +00:00
committed by GitHub
parent 82bf8923cc
commit 18fb31b416
3 changed files with 69 additions and 1 deletions

View File

@@ -282,6 +282,25 @@ class TestMouse(BaseTest):
self.ae(sel(), '678\nABCDE12345')
s.scroll(100, False)
# word select for wrapped words in scrollback
s.reset()
s.draw('abcde12345')
s.linefeed(), s.carriage_return()
s.draw(('X' * s.columns) * (s.lines-1))
multi_click(x=1)
self.ae(sel(), 'abcde12345')
# word select for wrapped words below viewport
s.reset()
s.scroll(100, False)
s.draw(('X' * s.columns) * (s.lines - 1))
s.linefeed(), s.carriage_return()
s.draw('abcde12345')
s.scroll(1, True)
multi_click(x=1, y=s.lines - 1)
self.ae(sel(), 'abcde12345')
s.scroll(100, False)
# Rectangle select
init()
press(x=1, y=1, modifiers=GLFW_MOD_ALT | GLFW_MOD_CONTROL)