diff options
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 4 | ||||
-rw-r--r-- | src/nvim/po/af.po | 11 | ||||
-rw-r--r-- | src/nvim/po/de.po | 7 | ||||
-rw-r--r-- | src/nvim/po/eo.po | 7 | ||||
-rw-r--r-- | src/nvim/po/es.po | 7 | ||||
-rw-r--r-- | src/nvim/po/fi.po | 8 | ||||
-rw-r--r-- | src/nvim/po/fr.po | 6 | ||||
-rw-r--r-- | src/nvim/po/ga.po | 15 | ||||
-rw-r--r-- | src/nvim/po/it.po | 1 | ||||
-rw-r--r-- | src/nvim/po/ja.euc-jp.po | 5 | ||||
-rw-r--r-- | src/nvim/po/ja.po | 5 | ||||
-rw-r--r-- | src/nvim/po/ru.po | 9 | ||||
-rw-r--r-- | src/nvim/po/sr.po | 3 | ||||
-rw-r--r-- | src/nvim/po/uk.po | 8 | ||||
-rw-r--r-- | src/nvim/po/zh_CN.UTF-8.po | 6 | ||||
-rw-r--r-- | src/nvim/po/zh_TW.UTF-8.po | 5 | ||||
-rw-r--r-- | src/nvim/screen.c | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_autocmd.vim | 21 | ||||
-rw-r--r-- | src/nvim/testdir/test_statusline.vim | 14 | ||||
-rw-r--r-- | src/nvim/testdir/test_tabline.vim | 48 | ||||
-rw-r--r-- | src/nvim/window.c | 22 | ||||
-rw-r--r-- | test/functional/ui/float_spec.lua | 337 |
22 files changed, 461 insertions, 90 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 73476c0795..6f2b95514a 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -1367,8 +1367,8 @@ local function close_preview_window(winnr, bufnrs) end local augroup = 'preview_window_' .. winnr - api.nvim_del_augroup_by_name(augroup) - pcall(vim.api.nvim_win_close, winnr, true) + pcall(api.nvim_del_augroup_by_name, augroup) + pcall(api.nvim_win_close, winnr, true) end) end diff --git a/src/nvim/po/af.po b/src/nvim/po/af.po index a76dd8eeea..82345f8a46 100644 --- a/src/nvim/po/af.po +++ b/src/nvim/po/af.po @@ -34,6 +34,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO_8859-1\n" "Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=n!=1;\n" #~ msgid "[Location List]" #~ msgstr "" @@ -645,11 +646,11 @@ msgstr "&Ok" #~ msgid "filter() argument" #~ msgstr "" -#, fuzzy, c-format -#~ msgid "+-%s%3ld line: " -#~ msgid_plural "+-%s%3ld lines: " -#~ msgstr[0] "+-%s%3ld reëls: " -#~ msgstr[1] "+-%s%3ld reëls: " +#, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld reëls: " +msgstr[1] "+-%s%3ld reëls: " #, fuzzy, c-format #~ msgid "E700: Unknown function: %s" diff --git a/src/nvim/po/de.po b/src/nvim/po/de.po index 740e9e5f6a..2dde77e9f7 100644 --- a/src/nvim/po/de.po +++ b/src/nvim/po/de.po @@ -18,6 +18,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO_8859-1\n" "Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../api/private/helpers.c:197 msgid "Unable to get option value" @@ -6233,8 +6234,10 @@ msgstr "filter()-Argument" #: ../eval.c:8717 #, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld Zeilen: " +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld Zeile: " +msgstr[1] "+-%s%3ld Zeilen: " #: ../eval.c:8779 #, c-format diff --git a/src/nvim/po/eo.po b/src/nvim/po/eo.po index 9b374e91ae..1c503d0a84 100644 --- a/src/nvim/po/eo.po +++ b/src/nvim/po/eo.po @@ -25,6 +25,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "E831: bf_key_init() called with empty password" msgstr "E831: bf_key_init() alvokita kun malplena pasvorto" @@ -1932,6 +1933,12 @@ msgstr "E350: Ne eblas krei faldon per la aktuala 'foldmethod'" msgid "E351: Cannot delete fold with current 'foldmethod'" msgstr "E351: Ne eblas forviÅi faldon per la aktuala 'foldmethod'" +#, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld linio: " +msgstr[1] "+-%s%3ld linioj: " + msgid "E222: Add to read buffer" msgstr "E222: Aldoni al lega bufro" diff --git a/src/nvim/po/es.po b/src/nvim/po/es.po index 064484d1a4..adea651b7c 100644 --- a/src/nvim/po/es.po +++ b/src/nvim/po/es.po @@ -19,6 +19,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: octect-stream\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../api/private/helpers.c:201 #, fuzzy @@ -786,8 +787,10 @@ msgstr "-c [argumentos]" #: ../eval.c:9229 #, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld lÃneas: " +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld lÃnea: " +msgstr[1] "+-%s%3ld lÃneas: " #: ../eval.c:9291 #, c-format diff --git a/src/nvim/po/fi.po b/src/nvim/po/fi.po index 77d5f7f826..f10d4ce977 100644 --- a/src/nvim/po/fi.po +++ b/src/nvim/po/fi.po @@ -841,9 +841,11 @@ msgstr "map()-argumentti" msgid "filter() argument" msgstr "filter()-argumentti" -#, fuzzy, c-format -#~ msgid "+-%s%3ld lines: " -#~ msgstr "+-%s%3ld rivi: " +#, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+--%s%3ld rivi: " +msgstr[1] "+--%s%3ld riviä: " #, c-format msgid "E700: Unknown function: %s" diff --git a/src/nvim/po/fr.po b/src/nvim/po/fr.po index 6df7741f1a..614ba013e6 100644 --- a/src/nvim/po/fr.po +++ b/src/nvim/po/fr.po @@ -1574,6 +1574,12 @@ msgid_plural "+--%3ld lines folded " msgstr[0] "+--%3ld ligne déplacée " msgstr[1] "+--%3ld lignes déplacées " +#, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld ligne : " +msgstr[1] "+-%s%3ld lignes : " + msgid "E222: Add to read buffer" msgstr "E222: Ajout au tampon de lecture" diff --git a/src/nvim/po/ga.po b/src/nvim/po/ga.po index ff16a87dbc..1c25ee481c 100644 --- a/src/nvim/po/ga.po +++ b/src/nvim/po/ga.po @@ -7103,13 +7103,14 @@ msgstr "" "Níorbh fhéidir an chonair a shocrú: ní liosta é sys.path\n" "Ba chóir duit vim.VIM_SPECIAL_PATH a cheangal le deireadh sys.path" -#~ msgid "+-%s%3ld line: " -#~ msgid_plural "+-%s%3ld lines: " -#~ msgstr[0] "+-%s%3ld líne: " -#~ msgstr[1] "+-%s%3ld líne: " -#~ msgstr[2] "+-%s%3ld líne: " -#~ msgstr[3] "+-%s%3ld líne: " -#~ msgstr[4] "+-%s%3ld líne: " +#, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld líne: " +msgstr[1] "+-%s%3ld líne: " +msgstr[2] "+-%s%3ld líne: " +msgstr[3] "+-%s%3ld líne: " +msgstr[4] "+-%s%3ld líne: " #~ msgid "+--%3ld line folded " #~ msgid_plural "+--%3ld lines folded " diff --git a/src/nvim/po/it.po b/src/nvim/po/it.po index dfabc4bee0..313280c807 100644 --- a/src/nvim/po/it.po +++ b/src/nvim/po/it.po @@ -25,6 +25,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO_8859-1\n" "Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../api/private/helpers.c:201 msgid "Unable to get option value" diff --git a/src/nvim/po/ja.euc-jp.po b/src/nvim/po/ja.euc-jp.po index 9633bec9f2..d7d0faca80 100644 --- a/src/nvim/po/ja.euc-jp.po +++ b/src/nvim/po/ja.euc-jp.po @@ -1837,6 +1837,11 @@ msgid "+--%3ld line folded " msgid_plural "+--%3ld lines folded " msgstr[0] "+--%3ld ¹Ô¤¬ÀÞ¾ö¤Þ¤ì¤Þ¤·¤¿" +#, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld ¹Ô: " + msgid "E222: Add to read buffer" msgstr "E222: ÆÉ¹þ¥Ð¥Ã¥Õ¥¡¤ØÄɲÃ" diff --git a/src/nvim/po/ja.po b/src/nvim/po/ja.po index c363c00fa6..b56345e066 100644 --- a/src/nvim/po/ja.po +++ b/src/nvim/po/ja.po @@ -1837,6 +1837,11 @@ msgid "+--%3ld line folded " msgid_plural "+--%3ld lines folded " msgstr[0] "+--%3ld è¡ŒãŒæŠ˜ç•³ã¾ã‚Œã¾ã—ãŸ" +#, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld 行: " + msgid "E222: Add to read buffer" msgstr "E222: èªè¾¼ãƒãƒƒãƒ•ã‚¡ã¸è¿½åŠ " diff --git a/src/nvim/po/ru.po b/src/nvim/po/ru.po index 5d3e51b7e2..7566036d3e 100644 --- a/src/nvim/po/ru.po +++ b/src/nvim/po/ru.po @@ -17,6 +17,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: ../api/private/helpers.c:201 #, fuzzy @@ -767,8 +769,11 @@ msgstr "параметра filter()" #: ../eval.c:9229 #, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld Ñтрок: " +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld Ñтрока: " +msgstr[1] "+-%s%3ld Ñтроки: " +msgstr[2] "+-%s%3ld Ñтрок: " #: ../eval.c:9291 #, c-format diff --git a/src/nvim/po/sr.po b/src/nvim/po/sr.po index d34c1c3100..3c45e1bf80 100644 --- a/src/nvim/po/sr.po +++ b/src/nvim/po/sr.po @@ -931,7 +931,8 @@ msgstr "&Ок" msgid "+-%s%3ld line: " msgid_plural "+-%s%3ld lines: " msgstr[0] "+-%s%3ld линија: " -msgstr[1] "+-%s%3ld линија: " +msgstr[1] "+-%s%3ld линијe: " +msgstr[2] "+-%s%3ld линија: " #, c-format msgid "E700: Unknown function: %s" diff --git a/src/nvim/po/uk.po b/src/nvim/po/uk.po index 7f0fe6a197..da87d50683 100644 --- a/src/nvim/po/uk.po +++ b/src/nvim/po/uk.po @@ -22,6 +22,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n" +"%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" msgid "--Deleted--" msgstr "--Знищено--" @@ -852,6 +854,12 @@ msgstr "" "%.*s" #, c-format +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld Ñ€Ñдок: " +msgstr[1] "+-%s%3ld Ñ€Ñдків: " + +#, c-format msgid "E474: Expected string end: %.*s" msgstr "E474: ОчікувавÑÑ ÐºÑ–Ð½ÐµÑ†ÑŒ Ñ€Ñдка: %.*s" diff --git a/src/nvim/po/zh_CN.UTF-8.po b/src/nvim/po/zh_CN.UTF-8.po index 1e329443ce..9a8cd38f5e 100644 --- a/src/nvim/po/zh_CN.UTF-8.po +++ b/src/nvim/po/zh_CN.UTF-8.po @@ -23,6 +23,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8-bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" #: ../api/private/helpers.c:201 #, fuzzy @@ -781,8 +782,9 @@ msgstr "-c 傿•°" #: ../eval.c:9229 #, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld 行: " +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld 行: " #: ../eval.c:9291 #, c-format diff --git a/src/nvim/po/zh_TW.UTF-8.po b/src/nvim/po/zh_TW.UTF-8.po index c97f31ddcf..e2fb2d39d4 100644 --- a/src/nvim/po/zh_TW.UTF-8.po +++ b/src/nvim/po/zh_TW.UTF-8.po @@ -827,8 +827,9 @@ msgstr "" #: ../eval.c:9229 #, c-format -msgid "+-%s%3ld lines: " -msgstr "+-%s%3ld 行: " +msgid "+-%s%3ld line: " +msgid_plural "+-%s%3ld lines: " +msgstr[0] "+-%s%3ld 行: " #: ../eval.c:9291 #, fuzzy, c-format diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 03d7cb1783..3d69d317fd 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -5493,7 +5493,7 @@ static void win_redr_border(win_T *wp) int *attrs = wp->w_float_config.border_attr; int *adj = wp->w_border_adj; - int irow = wp->w_height_inner, icol = wp->w_width_inner; + int irow = wp->w_height_inner + wp->w_winbar_height, icol = wp->w_width_inner; if (adj[0]) { grid_puts_line_start(grid, 0); diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 4b575bdfc3..1936832400 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -2669,6 +2669,27 @@ func Test_autocmd_window() %bw! endfunc +" Test for trying to close the temporary window used for executing an autocmd +func Test_close_autocmd_window() + %bw! + edit one.txt + tabnew two.txt + augroup aucmd_win_test2 + au! + " Nvim makes aucmd_win the last window + " au BufEnter * if expand('<afile>') == 'one.txt' | 1close | endif + au BufEnter * if expand('<afile>') == 'one.txt' | close | endif + augroup END + + call assert_fails('doautoall BufEnter', 'E813:') + + augroup aucmd_win_test2 + au! + augroup END + augroup! aucmd_win_test2 + %bw! +endfunc + " Test for trying to close the tab that has the temporary window for exeucing " an autocmd. func Test_close_autocmd_tab() diff --git a/src/nvim/testdir/test_statusline.vim b/src/nvim/testdir/test_statusline.vim index f36ff83fdf..ec35fac964 100644 --- a/src/nvim/testdir/test_statusline.vim +++ b/src/nvim/testdir/test_statusline.vim @@ -2,8 +2,6 @@ " " Not tested yet: " %N -" %T -" %X source view_util.vim source check.vim @@ -108,6 +106,18 @@ func Test_statusline() set statusline=%F call assert_match('/testdir/Xstatusline\s*$', s:get_statusline()) + " Test for min and max width with %(. For some reason, if this test is moved + " after the below test for the help buffer flag, then the code to truncate + " the string is not executed. + set statusline=%015(%f%) + call assert_match('^ Xstatusline\s*$', s:get_statusline()) + set statusline=%.6(%f%) + call assert_match('^<sline\s*$', s:get_statusline()) + set statusline=%14f + call assert_match('^ Xstatusline\s*$', s:get_statusline()) + set statusline=%.4L + call assert_match('^10>3\s*$', s:get_statusline()) + " %h: Help buffer flag, text is "[help]". " %H: Help buffer flag, text is ",HLP". set statusline=%h,%H diff --git a/src/nvim/testdir/test_tabline.vim b/src/nvim/testdir/test_tabline.vim index 3a18206078..e58a412c5a 100644 --- a/src/nvim/testdir/test_tabline.vim +++ b/src/nvim/testdir/test_tabline.vim @@ -1,3 +1,4 @@ +" Test for tabline source shared.vim @@ -17,6 +18,9 @@ func TablineWithError() endfunc func Test_caught_error_in_tabline() + if has('gui') + set guioptions-=e + endif let showtabline_save = &showtabline set showtabline=2 let s:func_in_tabline_called = 0 @@ -30,6 +34,9 @@ func Test_caught_error_in_tabline() endfunc func Test_tabline_will_be_disabled_with_error() + if has('gui') + set guioptions-=e + endif let showtabline_save = &showtabline set showtabline=2 let s:func_in_tabline_called = 0 @@ -65,6 +72,47 @@ func Test_redrawtabline() au! Bufadd endfunc +" Test for the "%T" and "%X" flags in the 'tabline' option +func MyTabLine() + let s = '' + for i in range(tabpagenr('$')) + " set the tab page number (for mouse clicks) + let s .= '%' . (i + 1) . 'T' + + " the label is made by MyTabLabel() + let s .= ' %{MyTabLabel(' . (i + 1) . ')} ' + endfor + + " after the last tab fill with TabLineFill and reset tab page nr + let s .= '%T' + + " right-align the label to close the current tab page + if tabpagenr('$') > 1 + let s .= '%=%Xclose' + endif + + return s +endfunc + +func MyTabLabel(n) + let buflist = tabpagebuflist(a:n) + let winnr = tabpagewinnr(a:n) + return bufname(buflist[winnr - 1]) +endfunc + +func Test_tabline_flags() + if has('gui') + set guioptions-=e + endif + set tabline=%!MyTabLine() + edit Xtabline1 + tabnew Xtabline2 + redrawtabline + call assert_match('^ Xtabline1 Xtabline2\s\+close$', Screenline(1)) + set tabline= + %bw! +endfunc + function EmptyTabname() return "" endfunction diff --git a/src/nvim/window.c b/src/nvim/window.c index 771a85479d..7895391697 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -783,8 +783,8 @@ void win_config_float(win_T *wp, FloatConfig fconfig) } if (!ui_has(kUIMultigrid)) { - wp->w_height = MIN(wp->w_height, Rows - 1 - win_extra_height(wp)); - wp->w_width = MIN(wp->w_width, Columns - win_extra_width(wp)); + wp->w_height = MIN(wp->w_height, Rows - 1 - win_border_height(wp)); + wp->w_width = MIN(wp->w_width, Columns - win_border_width(wp)); } win_set_inner_size(wp); @@ -1266,8 +1266,9 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir) } else if (wp->w_floating) { new_frame(wp); wp->w_floating = false; - // non-floating window doesn't store float config. + // non-floating window doesn't store float config or have a border. wp->w_float_config = FLOAT_CONFIG_INIT; + memset(wp->w_border_adj, 0, sizeof(wp->w_border_adj)); } /* @@ -1940,7 +1941,7 @@ static void win_totop(int size, int flags) } else { // No longer a float, a non-multigrid UI shouldn't draw it as such ui_call_win_hide(curwin->w_grid_alloc.handle); - win_free_grid(curwin, false); + win_free_grid(curwin, true); } } else { // Remove the window and frame from the tree of frames. @@ -5178,8 +5179,7 @@ void win_free_grid(win_T *wp, bool reinit) } grid_free(&wp->w_grid_alloc); if (reinit) { - // if a float is turned into a split and back into a float, the grid - // data structure will be reused + // if a float is turned into a split, the grid data structure will be reused memset(&wp->w_grid_alloc, 0, sizeof(wp->w_grid_alloc)); } } @@ -6330,18 +6330,18 @@ void win_set_inner_size(win_T *wp) terminal_check_size(wp->w_buffer->terminal); } - wp->w_height_outer = (wp->w_height_inner + win_extra_height(wp)); - wp->w_width_outer = (wp->w_width_inner + win_extra_width(wp)); + wp->w_height_outer = (wp->w_height_inner + win_border_height(wp) + wp->w_winbar_height); + wp->w_width_outer = (wp->w_width_inner + win_border_width(wp)); wp->w_winrow_off = wp->w_border_adj[0] + wp->w_winbar_height; wp->w_wincol_off = wp->w_border_adj[3]; } -static int win_extra_height(win_T *wp) +static int win_border_height(win_T *wp) { - return wp->w_border_adj[0] + wp->w_border_adj[2] + wp->w_winbar_height; + return wp->w_border_adj[0] + wp->w_border_adj[2]; } -static int win_extra_width(win_T *wp) +static int win_border_width(win_T *wp) { return wp->w_border_adj[1] + wp->w_border_adj[3]; } diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index fdd1504b13..50247ed214 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -4449,7 +4449,7 @@ describe('float window', function() ## grid 4 {1:y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^x | @@ -4487,7 +4487,7 @@ describe('float window', function() ## grid 4 {1:^y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ x | @@ -4523,7 +4523,7 @@ describe('float window', function() ## grid 4 {1:y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^x | @@ -4563,7 +4563,7 @@ describe('float window', function() ## grid 4 {1:y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^x | @@ -4599,7 +4599,7 @@ describe('float window', function() ## grid 4 {1:y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^x | @@ -4637,7 +4637,7 @@ describe('float window', function() ## grid 4 {1:^y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ x | @@ -4673,7 +4673,7 @@ describe('float window', function() ## grid 4 {1:y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^x | @@ -4711,7 +4711,7 @@ describe('float window', function() ## grid 4 {1:^y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else meths.input_mouse('left', 'press', '', 0, 2, 5) screen:expect([[ @@ -4748,7 +4748,7 @@ describe('float window', function() ## grid 4 {1:y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else meths.input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ @@ -4790,7 +4790,7 @@ describe('float window', function() ## grid 4 {1:y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else meths.input_mouse('left', 'press', '', 0, 2, 5) screen:expect([[ @@ -4827,7 +4827,7 @@ describe('float window', function() ## grid 4 {1:y }| {2:~ }| - ]], float_pos=expected_pos, unchanged=true} + ]], float_pos=expected_pos, unchanged=true} else meths.input_mouse('left', 'press', '', 0, 0, 0) screen:expect([[ @@ -4842,7 +4842,6 @@ describe('float window', function() end end) - it("j", function() feed("<c-w>ji") -- INSERT to trigger screen change if multigrid then @@ -4867,7 +4866,7 @@ describe('float window', function() ## grid 4 {1:y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^x | @@ -4903,7 +4902,7 @@ describe('float window', function() ## grid 4 {1:^y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ x | @@ -4939,7 +4938,7 @@ describe('float window', function() ## grid 4 {1:y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^x | @@ -4978,7 +4977,7 @@ describe('float window', function() ## grid 4 {1:^y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ x | @@ -5166,7 +5165,7 @@ describe('float window', function() ## grid 4 {1:^y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ x | @@ -5347,7 +5346,7 @@ describe('float window', function() ## grid 5 ^x | {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^x | @@ -5382,7 +5381,7 @@ describe('float window', function() ## grid 5 x | {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ x | @@ -5417,7 +5416,7 @@ describe('float window', function() ## grid 5 x | {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ x | @@ -5453,7 +5452,7 @@ describe('float window', function() ## grid 5 ^x | {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^x | @@ -5490,7 +5489,7 @@ describe('float window', function() ## grid 5 ^y | {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^y | @@ -5525,7 +5524,7 @@ describe('float window', function() ## grid 5 y | {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ y | @@ -5560,7 +5559,7 @@ describe('float window', function() ## grid 5 y | {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ y | @@ -5597,7 +5596,7 @@ describe('float window', function() ## grid 5 ^ | {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^ | @@ -5634,7 +5633,7 @@ describe('float window', function() ## grid 5 ^ | {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^ | @@ -5677,7 +5676,7 @@ describe('float window', function() {0:~ }| {0:~ }| {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^x {5:│}x | @@ -5720,17 +5719,17 @@ describe('float window', function() {0:~ }| {0:~ }| {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else - screen:expect([[ - ^ {5:│}x | - {0:~ }{5:│}{0:~ }| - {0:~ }{1:y }{0: }| - {0:~ }{2:~ }{0: }| - {0:~ }{5:│}{0:~ }| - {4:[No Name] }{5:[No Name] [+] }| - :vnew | - ]]) + screen:expect([[ + ^ {5:│}x | + {0:~ }{5:│}{0:~ }| + {0:~ }{1:y }{0: }| + {0:~ }{2:~ }{0: }| + {0:~ }{5:│}{0:~ }| + {4:[No Name] }{5:[No Name] [+] }| + :vnew | + ]]) end end) @@ -5763,7 +5762,7 @@ describe('float window', function() {0:~ }| {0:~ }| {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ ^ {5:│}x | @@ -5833,7 +5832,7 @@ describe('float window', function() [4] = {{id = 1001}, "NW", 1, 2, 5, true}, [5] = {{id = 1002}, "NW", 1, 4, 8, true} }} - else + else screen:expect([[ x | {0:~ }| @@ -5871,7 +5870,7 @@ describe('float window', function() ]], float_pos={ [4] = {{id = 1001}, "NW", 1, 2, 5, true}, }} - else + else screen:expect([[ x | {0:~ }| @@ -5940,7 +5939,7 @@ describe('float window', function() {0:~ }| ## grid 3 | - ]]} + ]]} else screen:expect([[ ^x | @@ -5980,7 +5979,7 @@ describe('float window', function() ## grid 4 {1:y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ x | @@ -6017,7 +6016,7 @@ describe('float window', function() ## grid 4 {1:^y }| {2:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ x | @@ -6087,7 +6086,7 @@ describe('float window', function() {0:~ }| {0:~ }| {0:~ }| - ]]} + ]]} else screen:expect([[ ^x | @@ -6124,7 +6123,7 @@ describe('float window', function() ## grid 5 x | {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ x | @@ -6161,7 +6160,7 @@ describe('float window', function() ## grid 5 x | {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else screen:expect([[ x | @@ -6195,7 +6194,7 @@ describe('float window', function() ## grid 4 ^y | {0:~ }| - ]]} + ]]} else screen:expect([[ x | @@ -6231,7 +6230,7 @@ describe('float window', function() ## grid 4 ^y | {0:~ }| - ]], float_pos=expected_pos} + ]], float_pos=expected_pos} else eq("UI doesn't support external windows", pcall_err(meths.win_set_config, 0, {external=true, width=30, height=2})) @@ -6261,6 +6260,78 @@ describe('float window', function() end end) + it('J (float with border)', function() + meths.win_set_config(win, {relative='editor', width=20, height=2, row=2, col=5, border='single'}) + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [3:----------------------------------------]| + ## grid 2 + ^x | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + | + ## grid 4 + {5:┌────────────────────â”}| + {5:│}{1:y }{5:│}| + {5:│}{2:~ }{5:│}| + {5:└────────────────────┘}| + ]], float_pos=expected_pos} + else + screen:expect([[ + ^x | + {0:~ }| + {0:~ }{5:┌────────────────────â”}{0: }| + {0:~ }{5:│}{1:y }{5:│}{0: }| + {0:~ }{5:│}{2:~ }{5:│}{0: }| + {0:~ }{5:└────────────────────┘}{0: }| + | + ]]) + end + + feed("<c-w>w<c-w>J") + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:----------------------------------------]| + [2:----------------------------------------]| + {5:[No Name] [+] }| + [4:----------------------------------------]| + [4:----------------------------------------]| + {4:[No Name] [+] }| + [3:----------------------------------------]| + ## grid 2 + x | + {0:~ }| + ## grid 3 + | + ## grid 4 + ^y | + {0:~ }| + ]]} + else + screen:expect([[ + x | + {0:~ }| + {5:[No Name] [+] }| + ^y | + {0:~ }| + {4:[No Name] [+] }| + | + ]]) + end + end) + it('movements with nested split layout', function() command("set hidden") feed("<c-w>s<c-w>v<c-w>b<c-w>v") @@ -6654,6 +6725,7 @@ describe('float window', function() [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3}; }} + meths.input_mouse('left', 'press', '', 5, 0, 0) screen:expect{grid=[[ ## grid 1 @@ -6683,6 +6755,7 @@ describe('float window', function() [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3}; }} + meths.input_mouse('left', 'drag', '', 5, 1, 2) screen:expect{grid=[[ ## grid 1 @@ -6782,6 +6855,7 @@ describe('float window', function() [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3}; }} + meths.input_mouse('left', 'press', '', 5, 1, 1) screen:expect{grid=[[ ## grid 1 @@ -6813,6 +6887,7 @@ describe('float window', function() [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3}; }} + meths.input_mouse('left', 'drag', '', 5, 2, 3) screen:expect{grid=[[ ## grid 1 @@ -6914,6 +6989,7 @@ describe('float window', function() [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3}; }} + meths.input_mouse('left', 'press', '', 5, 1, 0) screen:expect{grid=[[ ## grid 1 @@ -6944,6 +7020,7 @@ describe('float window', function() [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; [5] = {win = {id = 1002}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3}; }} + meths.input_mouse('left', 'drag', '', 5, 2, 2) screen:expect{grid=[[ ## grid 1 @@ -7009,6 +7086,123 @@ describe('float window', function() end end) + it('left drag changes visual selection if float window is turned into a split', function() + local buf = meths.create_buf(false,false) + meths.buf_set_lines(buf, 0, -1, true, {'foo', 'bar', 'baz'}) + meths.open_win(buf, true, {relative='editor', width=20, height=3, row=2, col=5}) + command('wincmd L') + if multigrid then + screen:expect([[ + ## grid 1 + [2:-------------------]{5:│}[5:--------------------]| + [2:-------------------]{5:│}[5:--------------------]| + [2:-------------------]{5:│}[5:--------------------]| + [2:-------------------]{5:│}[5:--------------------]| + [2:-------------------]{5:│}[5:--------------------]| + {5:[No Name] }{4:[No Name] [+] }| + [3:----------------------------------------]| + ## grid 2 + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + | + ## grid 5 + ^foo | + bar | + baz | + {0:~ }| + {0:~ }| + ]]) + + meths.input_mouse('left', 'press', '', 5, 2, 2) + screen:expect([[ + ## grid 1 + [2:-------------------]{5:│}[5:--------------------]| + [2:-------------------]{5:│}[5:--------------------]| + [2:-------------------]{5:│}[5:--------------------]| + [2:-------------------]{5:│}[5:--------------------]| + [2:-------------------]{5:│}[5:--------------------]| + {5:[No Name] }{4:[No Name] [+] }| + [3:----------------------------------------]| + ## grid 2 + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + | + ## grid 5 + foo | + bar | + ba^z | + {0:~ }| + {0:~ }| + ]]) + + meths.input_mouse('left', 'drag', '', 5, 1, 1) + screen:expect([[ + ## grid 1 + [2:-------------------]{5:│}[5:--------------------]| + [2:-------------------]{5:│}[5:--------------------]| + [2:-------------------]{5:│}[5:--------------------]| + [2:-------------------]{5:│}[5:--------------------]| + [2:-------------------]{5:│}[5:--------------------]| + {5:[No Name] }{4:[No Name] [+] }| + [3:----------------------------------------]| + ## grid 2 + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + {3:-- VISUAL --} | + ## grid 5 + foo | + b^a{27:r} | + {27:baz} | + {0:~ }| + {0:~ }| + ]]) + else + screen:expect([[ + {5:│}^foo | + {0:~ }{5:│}bar | + {0:~ }{5:│}baz | + {0:~ }{5:│}{0:~ }| + {0:~ }{5:│}{0:~ }| + {5:[No Name] }{4:[No Name] [+] }| + | + ]]) + + meths.input_mouse('left', 'press', '', 0, 2, 22) + screen:expect([[ + {5:│}foo | + {0:~ }{5:│}bar | + {0:~ }{5:│}ba^z | + {0:~ }{5:│}{0:~ }| + {0:~ }{5:│}{0:~ }| + {5:[No Name] }{4:[No Name] [+] }| + | + ]]) + + meths.input_mouse('left', 'drag', '', 0, 1, 21) + screen:expect([[ + {5:│}foo | + {0:~ }{5:│}b^a{27:r} | + {0:~ }{5:│}{27:baz} | + {0:~ }{5:│}{0:~ }| + {0:~ }{5:│}{0:~ }| + {5:[No Name] }{4:[No Name] [+] }| + {3:-- VISUAL --} | + ]]) + end + end) + it("'winblend' option", function() screen:try_resize(50,9) screen:set_default_attr_ids({ @@ -7895,6 +8089,53 @@ describe('float window', function() | ]]} end + + -- resize and add a border + meths.win_set_config(win1, {relative='editor', width=15, height=4, row=0, col=4, border = 'single'}) + + if multigrid then + screen:expect{grid=[[ + ## grid 1 + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [2:----------------------------------------]| + [3:----------------------------------------]| + ## grid 2 + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + ## grid 3 + | + ## grid 4 + {5:┌───────────────â”}| + {5:│}{3:floaty bar }{5:│}| + {5:│}{1: }{5:│}| + {5:│}{2:~ }{5:│}| + {5:│}{2:~ }{5:│}| + {5:└───────────────┘}| + ]], float_pos={ + [4] = {{id = 1001}, "NW", 1, 0, 4, true, 50}; + }, win_viewport={ + [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; + [4] = {win = {id = 1001}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1}; + }} + else + screen:expect{grid=[[ + ^ {5:┌───────────────â”} | + {0:~ }{5:│}{3:floaty bar }{5:│}{0: }| + {0:~ }{5:│}{1: }{5:│}{0: }| + {0:~ }{5:│}{2:~ }{5:│}{0: }| + {0:~ }{5:│}{2:~ }{5:│}{0: }| + {0:~ }{5:└───────────────┘}{0: }| + | + ]]} + end end) end |