view src/libvterm/t/63screen_resize.test @ 33521:1f9b1def80c8 v9.0.2009

patch 9.0.2009: cmdline-completion for comma-separated options wrong Commit: https://github.com/vim/vim/commit/54844857fd6933fa4f6678e47610c4b9c9f7a091 Author: Yee Cheng Chin <ychin.git@gmail.com> Date: Mon Oct 9 18:12:31 2023 +0200 patch 9.0.2009: cmdline-completion for comma-separated options wrong Problem: cmdline-completion for comma-separated options wrong Solution: Fix command-line expansions for options with filenames with commas Fix command-line expansions for options with filenames with commas Cmdline expansion for option values that take a comma-separated list of file names is currently not handling file names with commas as the commas are not escaped. For such options, the commas in file names need to be escaped (to differentiate from a comma that delimit the list items). The escaped comma is unescaped in `copy_option_part()` during option parsing. Fix as follows: - Cmdline completion for option values with comma-separated file/folder names will not start a new match when seeing `\\,` and will instead consider it as one value. - File/folder regex matching will strip the `\\` when seeing `\\,` to make sure it can match the correct files/folders. - The expanded value will escape `,` with `\\,`, similar to how spaces are escaped to make sure the option value is correct on the cmdline. This fix also takes into account the fact that Win32 Vim handles file name escaping differently. Typing '\,' for a file name results in it being handled literally but in other platforms '\,' is interpreted as a simple ',' and commas need to be escaped using '\\,' instead. Also, make sure this new logic only applies to comma-separated options like 'path'. Non-list options like 'set makeprg=<Tab>' and regular ex commands like `:edit <Tab>` do not require escaping and will continue to work. Also fix up documentation to be clearer. The original docs are slightly misleading in how it discusses triple slashes for 'tags'. closes: #13303 related: #13301 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author Christian Brabandt <cb@256bit.org>
date Mon, 09 Oct 2023 18:30:04 +0200
parents 2d2758ffd959
children
line wrap: on
line source

INIT
WANTSTATE
WANTSCREEN

!Resize wider preserves cells
RESET
RESIZE 25,80
PUSH "AB\r\nCD"
  ?screen_chars 0,0,1,80 = "AB"
  ?screen_chars 1,0,2,80 = "CD"
RESIZE 25,100
  ?screen_chars 0,0,1,100 = "AB"
  ?screen_chars 1,0,2,100 = "CD"

!Resize wider allows print in new area
RESET
RESIZE 25,80
PUSH "AB\e[79GCD"
  ?screen_chars 0,0,1,2 = "AB"
  ?screen_chars 0,78,1,80 = "CD"
RESIZE 25,100
  ?screen_chars 0,0,1,2 = "AB"
  ?screen_chars 0,78,1,80 = "CD"
PUSH "E"
  ?screen_chars 0,78,1,81 = "CDE"

!Resize shorter with blanks just truncates
RESET
RESIZE 25,80
PUSH "Top\e[10HLine 10"
  ?screen_row 0 = "Top"
  ?screen_row 9 = "Line 10"
  ?cursor = 9,7
RESIZE 20,80
  ?screen_row 0 = "Top"
  ?screen_row 9 = "Line 10"
  ?cursor = 9,7

!Resize shorter with content must scroll
RESET
RESIZE 25,80
PUSH "Top\e[25HLine 25\e[15H"
  ?screen_row 0 = "Top"
  ?screen_row 24 = "Line 25"
  ?cursor = 14,0
WANTSCREEN b
RESIZE 20,80
  sb_pushline 80 = 54 6F 70
  sb_pushline 80 =
  sb_pushline 80 =
  sb_pushline 80 =
  sb_pushline 80 =
  ?screen_row 0  = ""
  ?screen_row 19 = "Line 25"
  ?cursor = 9,0

!Resize shorter does not lose line with cursor
# See also https://github.com/neovim/libvterm/commit/1b745d29d45623aa8d22a7b9288c7b0e331c7088
RESET
WANTSCREEN -b
RESIZE 25,80
WANTSCREEN b
PUSH "\e[24HLine 24\r\nLine 25\r\n"
  sb_pushline 80 =
  ?screen_row 23 = "Line 25"
  ?cursor = 24,0
RESIZE 24,80
  sb_pushline 80 =
  ?screen_row 22 = "Line 25"
  ?cursor = 23,0

!Resize shorter does not send the cursor to a negative row
# See also https://github.com/vim/vim/pull/6141
RESET
WANTSCREEN -b
RESIZE 25,80
WANTSCREEN b
PUSH "\e[24HLine 24\r\nLine 25\e[H"
  ?cursor = 0,0
RESIZE 20,80
  sb_pushline 80 =
  sb_pushline 80 =
  sb_pushline 80 =
  sb_pushline 80 =
  sb_pushline 80 =
  ?cursor = 0,0

!Resize taller attempts to pop scrollback
RESET
WANTSCREEN -b
RESIZE 25,80
PUSH "Line 1\e[25HBottom\e[15H"
  ?screen_row 0  = "Line 1"
  ?screen_row 24 = "Bottom"
  ?cursor = 14,0
WANTSCREEN b
RESIZE 30,80
  sb_popline 80
  sb_popline 80
  sb_popline 80
  sb_popline 80
  sb_popline 80
  ?screen_row 0  = "ABCDE"
  ?screen_row 5  = "Line 1"
  ?screen_row 29 = "Bottom"
  ?cursor = 19,0
WANTSCREEN -b

!Resize can operate on altscreen
RESET
WANTSCREEN a
RESIZE 25,80
PUSH "Main screen\e[?1049h\e[HAlt screen"
RESIZE 30,80
  ?screen_row 0 = "Alt screen"
PUSH "\e[?1049l"
  ?screen_row 0 = "Main screen"