diff options
-rw-r--r-- | runtime/autoload/haskellcomplete.vim | 5 | ||||
-rw-r--r-- | runtime/doc/editing.txt | 4 | ||||
-rw-r--r-- | runtime/doc/insert.txt | 6 | ||||
-rw-r--r-- | runtime/doc/options.txt | 6 | ||||
-rw-r--r-- | runtime/doc/starting.txt | 2 | ||||
-rw-r--r-- | runtime/doc/syntax.txt | 2 | ||||
-rw-r--r-- | runtime/indent/tcl.vim | 4 | ||||
-rw-r--r-- | runtime/lua/vim/lsp.lua | 7 | ||||
-rw-r--r-- | runtime/menu.vim | 4 | ||||
-rw-r--r-- | runtime/syntax/cabal.vim | 30 | ||||
-rw-r--r-- | runtime/syntax/cabalconfig.vim | 30 | ||||
-rw-r--r-- | runtime/syntax/cabalproject.vim | 28 | ||||
-rw-r--r-- | runtime/syntax/haskell.vim | 89 | ||||
-rw-r--r-- | src/nvim/ex_cmds2.c | 3 | ||||
-rw-r--r-- | src/nvim/globals.h | 16 | ||||
-rw-r--r-- | src/nvim/mouse.c | 71 | ||||
-rw-r--r-- | src/nvim/normal.c | 4 | ||||
-rw-r--r-- | src/nvim/screen.c | 10 | ||||
-rw-r--r-- | src/nvim/testdir/test_alot.vim | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_options.vim | 42 | ||||
-rw-r--r-- | src/nvim/testdir/test_statusline.vim | 16 | ||||
-rw-r--r-- | src/nvim/undo.c | 114 | ||||
-rw-r--r-- | src/nvim/window.c | 12 | ||||
-rw-r--r-- | test/functional/legacy/options_spec.lua | 47 | ||||
-rw-r--r-- | test/functional/lua/buffer_updates_spec.lua | 54 | ||||
-rw-r--r-- | test/functional/ui/fold_spec.lua | 367 |
26 files changed, 860 insertions, 114 deletions
diff --git a/runtime/autoload/haskellcomplete.vim b/runtime/autoload/haskellcomplete.vim index 520ab93700..48fbac7f9f 100644 --- a/runtime/autoload/haskellcomplete.vim +++ b/runtime/autoload/haskellcomplete.vim @@ -2,7 +2,7 @@ " Language: Haskell " Maintainer: Daniel Campoverde <alx@sillybytes.net> " URL: https://github.com/alx741/haskellcomplete.vim -" Last Change: 2018 Aug 26 +" Last Change: 2019 May 14 " Usage: setlocal omnifunc=haskellcomplete#Complete @@ -63,6 +63,7 @@ function! haskellcomplete#Complete(findstart, base) call add(l:matches, extension) endif endfor + let b:completingLangExtension = 0 return l:matches endif @@ -78,6 +79,7 @@ function! haskellcomplete#Complete(findstart, base) call add(l:matches, flag) endif endfor + let b:completingOptionsGHC = 0 return l:matches endif @@ -93,6 +95,7 @@ function! haskellcomplete#Complete(findstart, base) call add(l:matches, module) endif endfor + let b:completingModule = 0 return l:matches endif diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index ac398ec494..aa964a521f 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -90,7 +90,7 @@ g CTRL-G Prints the current position of the cursor in five :buffers :files :ls List all the currently known file names. See - 'windows.txt' |:files| |:buffers| |:ls|. + |windows.txt| |:files| |:buffers| |:ls|. Vim will remember the full path name of a file name that you enter. In most cases when the file name is displayed only the name you typed is shown, but @@ -1190,7 +1190,7 @@ The syntax is best shown via some examples: > < Open the browser in the C:/bar directory, with the current buffer filename as default, and save the buffer under the filename chosen. -Also see the |'browsedir'| option. +Also see the 'browsedir' option. For versions of Vim where browsing is not supported, the command is executed unmodified. diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index c4b93a2a27..6902ed5fd4 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -287,8 +287,7 @@ character is written at the end of each line. Thus if you want to insert a *i_CTRL-X* *insert_expand* CTRL-X enters a sub-mode where several commands can be used. Most of these -commands do keyword completion; see |ins-completion|. These are not available -when Vim was compiled without the |+insert_expand| feature. +commands do keyword completion; see |ins-completion|. Two commands can be used to scroll the window up or down, without exiting insert mode: @@ -592,9 +591,6 @@ In Insert and Replace mode, there are several commands to complete part of a keyword or line that has been typed. This is useful if you are using complicated keywords (e.g., function names with capitals and underscores). -These commands are not available when the |+insert_expand| feature was -disabled at compile time. - Completion can be done for: 1. Whole lines |i_CTRL-X_CTRL-L| diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index ce3788e0fc..c4d5df84cf 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4090,8 +4090,6 @@ A jump table for the options with a short description can be found at |Q_op|. In the "popup" model the right mouse button produces a pop-up menu. You need to define this first, see |popup-menu|. - In a terminal the popup menu works if Vim is compiled with the - |+insert_expand| option. Note that you can further refine the meaning of buttons with mappings. See |mouse-overview|. But mappings are NOT used for modeless selection. @@ -4858,7 +4856,9 @@ A jump table for the options with a short description can be found at |Q_op|. local to window Number of lines to scroll with CTRL-U and CTRL-D commands. Will be set to half the number of lines in the window when the window size - changes. If you give a count to the CTRL-U or CTRL-D command it will + changes. This may happen when enabling the |status-line| or + 'tabline' option after setting the 'scroll' option. + If you give a count to the CTRL-U or CTRL-D command it will be used as the new value for 'scroll'. Reset to half the window height with ":set scroll=0". diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 4a99aa47bf..d3647246fa 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -106,8 +106,6 @@ argument. This can be used to find out where time is spent while loading your |config|, plugins and opening the first file. When {fname} already exists new messages are appended. - (Only available when compiled with the |+startuptime| - feature). *-+* +[num] The cursor will be positioned on line "num" for the first diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 7da886dabd..b45e9ed450 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1715,7 +1715,7 @@ There are several html preprocessor languages out there. html.vim has been written such that it should be trivial to include it. To do so add the following two lines to the syntax coloring file for that language (the example comes from the asp.vim file): - +> runtime! syntax/html.vim syn cluster htmlPreproc add=asp diff --git a/runtime/indent/tcl.vim b/runtime/indent/tcl.vim index d77081841d..eafb8dd568 100644 --- a/runtime/indent/tcl.vim +++ b/runtime/indent/tcl.vim @@ -1,8 +1,8 @@ " Vim indent file " Language: Tcl -" Previous Maintainer: Nikolai Weibull <now@bitwi.se> " Latest Update: Chris Heithoff <chrisheithoff@gmail.com> -" Latest Revision: 2018-12-05 +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2018-12-05 if exists("b:did_indent") finish diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 143909fe41..841c365cbe 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -542,6 +542,13 @@ function lsp.start_client(config) client_ids[client_id] = nil end + if code ~= 0 or (signal ~= 0 and signal ~= 15) then + local msg = string.format("Client %s quit with exit code %s and signal %s", client_id, code, signal) + vim.schedule(function() + vim.notify(msg, vim.log.levels.WARN) + end) + end + if config.on_exit then pcall(config.on_exit, code, signal, client_id) end diff --git a/runtime/menu.vim b/runtime/menu.vim index 3756787e7f..cd56eb5583 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -356,8 +356,8 @@ func! s:SetupColorSchemes() abort let s:did_setup_color_schemes = 1 let n = globpath(&runtimepath, "colors/*.vim", 1, 1) - let n += globpath(&runtimepath, "pack/*/start/*/colors/*.vim", 1, 1) - let n += globpath(&runtimepath, "pack/*/opt/*/colors/*.vim", 1, 1) + let n += globpath(&packpath, "pack/*/start/*/colors/*.vim", 1, 1) + let n += globpath(&packpath, "pack/*/opt/*/colors/*.vim", 1, 1) " Ignore case for VMS and windows, sort on name let names = sort(map(n, 'substitute(v:val, "\\c.*[/\\\\:\\]]\\([^/\\\\:]*\\)\\.vim", "\\1", "")'), 1) diff --git a/runtime/syntax/cabal.vim b/runtime/syntax/cabal.vim index 8af47d4042..92e6b8331e 100644 --- a/runtime/syntax/cabal.vim +++ b/runtime/syntax/cabal.vim @@ -4,7 +4,7 @@ " Maintainer: Marcin Szamotulski <profunctor@pm.me> " Previous Maintainer: Vincent Berthoux <twinside@gmail.com> " File Types: .cabal -" Last Change: 15 May 2018 +" Last Change: 21 Nov 2020 " v1.5: Incorporated changes from " https://github.com/sdiehl/haskell-vim-proto/blob/master/vim/syntax/cabal.vim " Use `syn keyword` instead of `syn match`. @@ -62,11 +62,12 @@ syn keyword cabalCategory contained \ source-repository \ flag \ custom-setup + \ common syn match cabalCategoryTitle contained /[^{]*\ze{\?/ syn match cabalCategoryRegion \ contains=cabalCategory,cabalCategoryTitle \ nextgroup=cabalCategory skipwhite - \ /^\c\s*\(contained\|executable\|library\|benchmark\|test-suite\|source-repository\|flag\|custom-setup\)\+\s*\%(.*$\|$\)/ + \ /^\c\s*\(contained\|executable\|library\|benchmark\|test-suite\|source-repository\|flag\|custom-setup\|common\)\+\s*\%(.*$\|$\)/ syn keyword cabalTruth true false " cabalStatementRegion which limits the scope of cabalStatement keywords, this @@ -76,10 +77,14 @@ syn keyword cabalStatement contained containedin=cabalStatementRegion \ default-language \ default-extensions \ author + \ autogen-modules + \ asm-sources + \ asm-options \ branch \ bug-reports \ build-depends \ build-tools + \ build-tools-depends \ build-type \ buildable \ c-sources @@ -87,32 +92,46 @@ syn keyword cabalStatement contained containedin=cabalStatementRegion \ category \ cc-options \ copyright + \ cmm-sources + \ cmm-options \ cpp-options + \ cxx-sources \ data-dir \ data-files \ default + \ default-extensions \ description \ executable \ exposed-modules \ exposed \ extensions - \ extra-tmp-files + \ extra-bundled-libraries \ extra-doc-files + \ extra-dynamic-library-flavours + \ extra-framework-dirs + \ extra-ghci-libraries \ extra-lib-dirs \ extra-libraries + \ extra-library-flavours \ extra-source-files - \ exta-tmp-files + \ extra-tmp-files \ for example \ frameworks \ ghc-options \ ghc-prof-options \ ghc-shared-options + \ ghcjs-options + \ ghcjs-prof-options + \ ghcjs-shared-options \ homepage + \ hs-source-dir \ hs-source-dirs \ hugs-options + \ import \ include-dirs \ includes \ install-includes + \ js-sources \ ld-options \ license \ license-file @@ -120,10 +139,13 @@ syn keyword cabalStatement contained containedin=cabalStatementRegion \ main-is \ maintainer \ manual + \ mixins \ module \ name \ nhc98-options \ other-extensions + \ other-language + \ other-languages \ other-modules \ package-url \ pkgconfig-depends diff --git a/runtime/syntax/cabalconfig.vim b/runtime/syntax/cabalconfig.vim new file mode 100644 index 0000000000..0165725c06 --- /dev/null +++ b/runtime/syntax/cabalconfig.vim @@ -0,0 +1,30 @@ +" Vim syntax file +" Language: Cabal Config +" Maintainer: profunctor@pm.me +" Last Change: Marcin Szamotulski +" Original Author: Marcin Szamotulski + +if exists("b:current_syntax") + finish +endif + +syn match CabalConfigSection /^\S[[:alpha:]]\+\%(-[[:alpha:]]\+\)*[^:]*$/ +syn region CabalConfigRegion matchgroup=CabalConfigKey start=/^\s*[[:alpha:]]\+\%(-[[:alpha:]]\+\)*:/ matchgroup=NONE end=/$/ contains=CabalConfigSeparator,CabalConfigKeyword,CabalConfigPath keepend +syn match CabalConfigComment /^\s*--.*$/ +syn match CabalConfigValue /.*$/ contained +syn match CabalConfigKey /[[:alpha:]]\+\%(-[[:alpha:]]\+\)*\ze:/ +syn keyword CabalConfigSeparator : contained +syn match CabalConfigVariable /\$[[:alpha:]]\+/ +syn keyword CabalConfigKeyword True False ghc +syn match CabalConfigPath /\%([[:alpha:]]\+:\)\?\%(\/[[:print:]]\+\)\+/ + +hi def link CabalConfigComment Comment +hi def link CabalConfigSection Title +hi def link CabalConfigKey Statement +hi def link CabalConfigSeparator NonText +hi def link CabalConfigValue Normal +hi def link CabalConfigVariable Identifier +hi def link CabalConfigKeyword Keyword +hi def link CabalConfigPath Directory + +let b:current_syntax = "cabal.config" diff --git a/runtime/syntax/cabalproject.vim b/runtime/syntax/cabalproject.vim new file mode 100644 index 0000000000..12143b9ee9 --- /dev/null +++ b/runtime/syntax/cabalproject.vim @@ -0,0 +1,28 @@ +" Vim syntax file +" Language: Cabal Project +" Maintainer: profunctor@pm.me +" Last Change: Marcin Szamotulski +" Original Author: Marcin Szamotulski + +if exists("b:current_syntax") + finish +endif + +syn match CabalProjectComment /^\s*--.*/ contains=@Spell +syn match CabalProjectField /^\w\%(\w\|-\)\+/ contains=@NoSpell + +syn keyword CabalProjectBoolean true false True False +syn keyword CabalProjectCompiler ghc ghcjs jhc lhc uhc haskell-suite +syn match CabalProjectNat /\<\d\+\>/ +syn keyword CabalProjectJobs $ncpus +syn keyword CabalProjectProfilingLevel default none exported-functions toplevel-functions all-functions + +hi def link CabalProjectComment Comment +hi def link CabalProjectField Statement +hi def link CabalProjectBoolean Boolean +hi def link CabalProjectCompiler Identifier +hi def link CabalProjectNat Number +hi def link CabalProjectJobs Number +hi def link CabalProjectProfilingLevel Statement + +let b:current_syntax = "cabal.project" diff --git a/runtime/syntax/haskell.vim b/runtime/syntax/haskell.vim index e5128a12ab..1b70b9344a 100644 --- a/runtime/syntax/haskell.vim +++ b/runtime/syntax/haskell.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Haskell " Maintainer: Haskell Cafe mailinglist <haskell-cafe@haskell.org> -" Last Change: 2018 Mar 29 by Marcin Szamotulski +" Last Change: 2020 Oct 4 by Marcin Szamotulski <profunctor@pm.me> " Original Author: John Williams <jrw@pobox.com> " " Thanks to Ryan Crumley for suggestions and John Meacham for @@ -38,8 +38,8 @@ if exists("b:current_syntax") endif " (Qualified) identifiers (no default highlighting) -syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[A-Z][a-zA-Z0-9_']*\>" contains=@NoSpell -syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_']*\>" contains=@NoSpell +syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)*\<[A-Z][a-zA-Z0-9_']*\>" contains=@NoSpell +syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)*\<[a-z][a-zA-Z0-9_']*\>" contains=@NoSpell " Infix operators--most punctuation characters and any (qualified) identifier " enclosed in `backquotes`. An operator starting with : is a constructor, @@ -49,8 +49,11 @@ syn match hsConSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./<=>\?@\\^|~:]*" syn match hsVarSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']*`" syn match hsConSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']*`" +" (Non-qualified) identifiers which start with # are labels +syn match hsLabel "#[a-z][a-zA-Z0-9_']*\>" + " Reserved symbols--cannot be overloaded. -syn match hsDelimiter "(\|)\|\[\|\]\|,\|;\|_\|{\|}" +syn match hsDelimiter "(\|)\|\[\|\]\|,\|;\|{\|}" " Strings and constants syn match hsSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)" @@ -62,37 +65,41 @@ syn match hsCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=hsSpecialChar,hs syn match hsNumber "\v<[0-9]%(_*[0-9])*>|<0[xX]_*[0-9a-fA-F]%(_*[0-9a-fA-F])*>|<0[oO]_*%(_*[0-7])*>|<0[bB]_*[01]%(_*[01])*>" syn match hsFloat "\v<[0-9]%(_*[0-9])*\.[0-9]%(_*[0-9])*%(_*[eE][-+]?[0-9]%(_*[0-9])*)?>|<[0-9]%(_*[0-9])*_*[eE][-+]?[0-9]%(_*[0-9])*>|<0[xX]_*[0-9a-fA-F]%(_*[0-9a-fA-F])*\.[0-9a-fA-F]%(_*[0-9a-fA-F])*%(_*[pP][-+]?[0-9]%(_*[0-9])*)?>|<0[xX]_*[0-9a-fA-F]%(_*[0-9a-fA-F])*_*[pP][-+]?[0-9]%(_*[0-9])*>" -" Keyword definitions. These must be patterns instead of keywords -" because otherwise they would match as keywords at the start of a -" "literate" comment (see lhs.vim). -syn match hsModule "\<module\>" -syn match hsImport "\<import\>.*"he=s+6 contains=hsImportMod,hsLineComment,hsBlockComment,@NoSpell -syn match hsImportMod contained "\<\(as\|qualified\|hiding\)\>" contains=@NoSpell -syn match hsInfix "\<\(infix\|infixl\|infixr\)\>" -syn match hsStructure "\<\(class\|data\|deriving\|instance\|default\|where\)\>" -syn match hsTypedef "\<\(type\|newtype\)\>" -syn match hsStatement "\<\(do\|case\|of\|let\|in\)\>" -syn match hsConditional "\<\(if\|then\|else\)\>" +" Keyword definitions. +syn keyword hsModule module +syn match hsImportGroup "\<import\>.*" contains=hsImport,hsImportModuleName,hsImportMod,hsLineComment,hsBlockComment,hsImportList,@NoSpell nextgroup=hsImport +syn keyword hsImport import contained nextgroup=hsImportModuleName +syn match hsImportModuleName '\<[A-Z][A-Za-z.]*' contained +syn region hsImportList start='(' skip='([^)]\{-})' end=')' keepend contained contains=ConId,VarId,hsDelimiter,hsBlockComment,hsTypedef,@NoSpell + +syn keyword hsImportMod contained as qualified hiding +syn keyword hsInfix infix infixl infixr +syn keyword hsStructure class data deriving instance default where +syn keyword hsTypedef type +syn keyword hsNewtypedef newtype +syn keyword hsTypeFam family +syn keyword hsStatement mdo do case of let in +syn keyword hsConditional if then else " Not real keywords, but close. if exists("hs_highlight_boolean") " Boolean constants from the standard prelude. - syn match hsBoolean "\<\(True\|False\)\>" + syn keyword hsBoolean True False endif if exists("hs_highlight_types") " Primitive types from the standard prelude and libraries. - syn match hsType "\<\(Int\|Integer\|Char\|Bool\|Float\|Double\|IO\|Void\|Addr\|Array\|String\)\>" + syn keyword hsType Int Integer Char Bool Float Double IO Void Addr Array String endif if exists("hs_highlight_more_types") " Types from the standard prelude libraries. - syn match hsType "\<\(Maybe\|Either\|Ratio\|Complex\|Ordering\|IOError\|IOResult\|ExitCode\)\>" - syn match hsMaybe "\<Nothing\>" - syn match hsExitCode "\<\(ExitSuccess\)\>" - syn match hsOrdering "\<\(GT\|LT\|EQ\)\>" + syn keyword hsType Maybe Either Ratio Complex Ordering IOError IOResult ExitCode + syn keyword hsMaybe Nothing + syn keyword hsExitCode ExitSuccess + syn keyword hsOrdering GT LT EQ endif if exists("hs_highlight_debug") " Debugging functions from the standard prelude. - syn match hsDebug "\<\(undefined\|error\|trace\)\>" + syn keyword hsDebug undefined error trace endif @@ -133,12 +140,14 @@ hi def link hsImportMod hsImport hi def link hsInfix PreProc hi def link hsStructure Structure hi def link hsStatement Statement -hi def link hsConditional Conditional -hi def link hsSpecialChar SpecialChar +hi def link hsConditional Conditional +hi def link hsSpecialChar SpecialChar hi def link hsTypedef Typedef +hi def link hsNewtypedef Typedef hi def link hsVarSym hsOperator hi def link hsConSym hsOperator hi def link hsOperator Operator +hi def link hsTypeFam Structure if exists("hs_highlight_delimiters") " Some people find this highlighting distracting. hi def link hsDelimiter Delimiter @@ -160,22 +169,22 @@ hi def link hsMaybe hsEnumConst hi def link hsOrdering hsEnumConst hi def link hsEnumConst Constant hi def link hsDebug Debug - -hi def link cCppString hsString -hi def link cCommentStart hsComment -hi def link cCommentError hsError -hi def link cCommentStartError hsError -hi def link cInclude Include -hi def link cPreProc PreProc -hi def link cDefine Macro -hi def link cIncluded hsString -hi def link cError Error -hi def link cPreCondit PreCondit -hi def link cComment Comment -hi def link cCppSkip cCppOut -hi def link cCppOut2 cCppOut -hi def link cCppOut Comment - +hi def link hsLabel Special + +hi def link cCppString hsString +hi def link cCommentStart hsComment +hi def link cCommentError hsError +hi def link cCommentStartError hsError +hi def link cInclude Include +hi def link cPreProc PreProc +hi def link cDefine Macro +hi def link cIncluded hsString +hi def link cError Error +hi def link cPreCondit PreCondit +hi def link cComment Comment +hi def link cCppSkip cCppOut +hi def link cCppOut2 cCppOut +hi def link cCppOut Comment let b:current_syntax = "haskell" diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index c24ecde096..c4c18c4324 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3024,6 +3024,7 @@ void scriptnames_slash_adjust(void) # endif /// Get a pointer to a script name. Used for ":verbose set". +/// Message appended to "Last set from " char_u *get_scriptname(LastSet last_set, bool *should_free) { *should_free = false; @@ -3039,6 +3040,8 @@ char_u *get_scriptname(LastSet last_set, bool *should_free) return (char_u *)_("environment variable"); case SID_ERROR: return (char_u *)_("error handler"); + case SID_WINLAYOUT: + return (char_u *)_("changed window size"); case SID_LUA: return (char_u *)_("Lua"); case SID_API_CLIENT: diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 22f06941aa..7b8e809de7 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -180,6 +180,11 @@ EXTERN int compl_cont_status INIT(= 0); # define CONT_LOCAL 32 // for ctrl_x_mode 0, ^X^P/^X^N do a local // expansion, (eg use complete=.) +EXTERN char_u *edit_submode INIT(= NULL); // msg for CTRL-X submode +EXTERN char_u *edit_submode_pre INIT(= NULL); // prepended to edit_submode +EXTERN char_u *edit_submode_extra INIT(= NULL); // appended to edit_submode +EXTERN hlf_T edit_submode_highl; // highl. method for extra info + // state for putting characters in the message area EXTERN int cmdmsg_rl INIT(= false); // cmdline is drawn right to left EXTERN int msg_col; @@ -328,9 +333,10 @@ EXTERN int garbage_collect_at_exit INIT(= false); #define SID_ENV -4 // for sourcing environment variable #define SID_ERROR -5 // option was reset because of an error #define SID_NONE -6 // don't set scriptID -#define SID_LUA -7 // for Lua scripts/chunks -#define SID_API_CLIENT -8 // for API clients -#define SID_STR -9 // for sourcing a string +#define SID_WINLAYOUT -7 // changing window size +#define SID_LUA -8 // for Lua scripts/chunks +#define SID_API_CLIENT -9 // for API clients +#define SID_STR -10 // for sourcing a string // Script CTX being sourced or was sourced to define the current function. EXTERN sctx_T current_sctx INIT(= { 0 COMMA 0 COMMA 0 }); @@ -639,10 +645,6 @@ EXTERN int arrow_used; // Normally false, set to true after // to call u_sync() EXTERN bool ins_at_eol INIT(= false); // put cursor after eol when // restarting edit after CTRL-O -EXTERN char_u *edit_submode INIT(= NULL); // msg for CTRL-X submode -EXTERN char_u *edit_submode_pre INIT(= NULL); // prepended to edit_submode -EXTERN char_u *edit_submode_extra INIT(= NULL); // appended to edit_submode -EXTERN hlf_T edit_submode_highl; // highl. method for extra info EXTERN int no_abbr INIT(= true); // true when no abbreviations loaded diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index ff471ea978..f28658aa29 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -72,9 +72,7 @@ int jump_to_mouse(int flags, int row = mouse_row; int col = mouse_col; int grid = mouse_grid; - int mouse_char; int fdc = 0; - ScreenGrid *gp = &default_grid; mouse_past_bottom = false; mouse_past_eol = false; @@ -303,25 +301,6 @@ retnomove: } } - // Remember the character under the mouse, might be one of foldclose or - // foldopen fillchars in the fold column. - if (ui_has(kUIMultigrid)) { - gp = &curwin->w_grid; - } - if (row >= 0 && row < Rows && col >= 0 && col <= Columns - && gp->chars != NULL) { - mouse_char = utf_ptr2char(gp->chars[gp->line_offset[row] - + (unsigned)col]); - } else { - mouse_char = ' '; - } - - // Check for position outside of the fold column. - if (curwin->w_p_rl ? col < curwin->w_width_inner - fdc : - col >= fdc + (cmdwin_type == 0 ? 0 : 1)) { - mouse_char = ' '; - } - // compute the position in the buffer line from the posn on the screen if (mouse_comp_pos(curwin, &row, &col, &curwin->w_cursor.lnum)) { mouse_past_bottom = true; @@ -362,11 +341,7 @@ retnomove: count |= CURSOR_MOVED; // Cursor has moved } - if (mouse_char == curwin->w_p_fcs_chars.foldclosed) { - count |= MOUSE_FOLD_OPEN; - } else if (mouse_char != ' ') { - count |= MOUSE_FOLD_CLOSE; - } + count |= mouse_check_fold(); return count; } @@ -738,3 +713,47 @@ static int mouse_adjust_click(win_T *wp, int row, int col) return col + nudge; } + +// Check clicked cell is foldcolumn +int mouse_check_fold(void) +{ + int grid = mouse_grid; + int row = mouse_row; + int col = mouse_col; + int mouse_char = ' '; + + win_T *wp; + + wp = mouse_find_win(&grid, &row, &col); + + if (wp && mouse_row >= 0 && mouse_row < Rows + && mouse_col >= 0 && mouse_col <= Columns) { + int multigrid = ui_has(kUIMultigrid); + ScreenGrid *gp = multigrid ? &wp->w_grid : &default_grid; + int fdc = win_fdccol_count(wp); + + row = multigrid && mouse_grid == 0 ? row : mouse_row; + col = multigrid && mouse_grid == 0 ? col : mouse_col; + + // Remember the character under the mouse, might be one of foldclose or + // foldopen fillchars in the fold column. + if (gp->chars != NULL) { + mouse_char = utf_ptr2char(gp->chars[gp->line_offset[row] + + (unsigned)col]); + } + + // Check for position outside of the fold column. + if (wp->w_p_rl ? col < wp->w_width_inner - fdc : + col >= fdc + (cmdwin_type == 0 ? 0 : 1)) { + mouse_char = ' '; + } + } + + if (mouse_char == wp->w_p_fcs_chars.foldclosed) { + return MOUSE_FOLD_OPEN; + } else if (mouse_char != ' ') { + return MOUSE_FOLD_CLOSE; + } + + return 0; +} diff --git a/src/nvim/normal.c b/src/nvim/normal.c index d5c92bc3e6..4d8b11f832 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2404,8 +2404,8 @@ do_mouse ( start_visual.lnum = 0; - /* Check for clicking in the tab page line. */ - if (mouse_row == 0 && firstwin->w_winrow > 0) { + // Check for clicking in the tab page line. + if (mouse_grid <= 1 && mouse_row == 0 && firstwin->w_winrow > 0) { if (is_drag) { if (in_tab_line) { move_tab_to_mouse(); diff --git a/src/nvim/screen.c b/src/nvim/screen.c index dd28c6fb35..20e3cc0a2e 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -7152,11 +7152,13 @@ static void win_redr_ruler(win_T *wp, int always) if (wp->w_cursor.lnum > wp->w_buffer->b_ml.ml_line_count) return; - /* Don't draw the ruler while doing insert-completion, it might overwrite - * the (long) mode message. */ - if (wp == lastwin && lastwin->w_status_height == 0) - if (edit_submode != NULL) + // Don't draw the ruler while doing insert-completion, it might overwrite + // the (long) mode message. + if (wp == lastwin && lastwin->w_status_height == 0) { + if (edit_submode != NULL) { return; + } + } if (*p_ruf) { int save_called_emsg = called_emsg; diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim index 4f056abdc0..daf3c9c110 100644 --- a/src/nvim/testdir/test_alot.vim +++ b/src/nvim/testdir/test_alot.vim @@ -37,7 +37,6 @@ source test_recover.vim source test_scroll_opt.vim source test_sort.vim source test_sha256.vim -source test_statusline.vim source test_suspend.vim source test_syn_attr.vim source test_tabline.vim diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index 5a10c9baa6..1202b842fd 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -1,5 +1,7 @@ " Test for options +source check.vim + func Test_whichwrap() set whichwrap=b,s call assert_equal('b,s', &whichwrap) @@ -604,6 +606,27 @@ func Test_opt_boolean() set number& endfunc +func Test_opt_winminheight_term() + " See test/functional/legacy/options_spec.lua + CheckRunVimInTerminal + + " The tabline should be taken into account. + let lines =<< trim END + set wmh=0 stal=2 + below sp | wincmd _ + below sp | wincmd _ + below sp | wincmd _ + below sp + END + call writefile(lines, 'Xwinminheight') + let buf = RunVimInTerminal('-S Xwinminheight', #{rows: 11}) + call term_sendkeys(buf, ":set wmh=1\n") + call WaitForAssert({-> assert_match('E36: Not enough room', term_getline(buf, 11))}) + + call StopVimInTerminal(buf) + call delete('Xwinminheight') +endfunc + " Test for setting option value containing spaces with isfname+=32 func Test_isfname_with_options() set isfname+=32 @@ -613,4 +636,23 @@ func Test_isfname_with_options() setlocal keywordprg& endfunc +" Test that resetting laststatus does change scroll option +func Test_opt_reset_scroll() + " See test/functional/legacy/options_spec.lua + CheckRunVimInTerminal + let vimrc =<< trim [CODE] + set scroll=2 + set laststatus=2 + [CODE] + call writefile(vimrc, 'Xscroll') + let buf = RunVimInTerminal('-S Xscroll', {'rows': 16, 'cols': 45}) + call term_sendkeys(buf, ":verbose set scroll?\n") + call WaitForAssert({-> assert_match('Last set.*window size', term_getline(buf, 15))}) + call assert_match('^\s*scroll=7$', term_getline(buf, 14)) + call StopVimInTerminal(buf) + + " clean up + call delete('Xscroll') +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_statusline.vim b/src/nvim/testdir/test_statusline.vim index 4e38f7ebd8..ce2ef4dcd8 100644 --- a/src/nvim/testdir/test_statusline.vim +++ b/src/nvim/testdir/test_statusline.vim @@ -1,12 +1,12 @@ " Test 'statusline' " " Not tested yet: -" %a " %N " %T " %X source view_util.vim +source check.vim source term_util.vim func s:get_statusline() @@ -61,7 +61,19 @@ func Test_statusline_will_be_disabled_with_error() endfunc func Test_statusline() - new Xstatusline + CheckFeature quickfix + + " %a: Argument list ({current} of {max}) + set statusline=%a + call assert_match('^\s*$', s:get_statusline()) + arglocal a1 a2 + rewind + call assert_match('^ (1 of 2)\s*$', s:get_statusline()) + next + call assert_match('^ (2 of 2)\s*$', s:get_statusline()) + e Xstatusline + call assert_match('^ ((2) of 2)\s*$', s:get_statusline()) + only set laststatus=2 set splitbelow diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 8c2ae3bc35..f52850f6f3 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -594,13 +594,20 @@ int u_savecommon(linenr_T top, linenr_T bot, linenr_T newbot, int reload) } -# define UF_START_MAGIC "Vim\237UnDo\345" /* magic at start of undofile */ +// magic at start of undofile +# define UF_START_MAGIC "Vim\237UnDo\345" # define UF_START_MAGIC_LEN 9 -# define UF_HEADER_MAGIC 0x5fd0 /* magic at start of header */ -# define UF_HEADER_END_MAGIC 0xe7aa /* magic after last header */ -# define UF_ENTRY_MAGIC 0xf518 /* magic at start of entry */ -# define UF_ENTRY_END_MAGIC 0x3581 /* magic after last entry */ -# define UF_VERSION 2 /* 2-byte undofile version number */ +// magic at start of header +# define UF_HEADER_MAGIC 0x5fd0 +// magic after last header +# define UF_HEADER_END_MAGIC 0xe7aa +// magic at start of entry +# define UF_ENTRY_MAGIC 0xf518 +// magic after last entry +# define UF_ENTRY_END_MAGIC 0x3581 + +// 2-byte undofile version number +# define UF_VERSION 3 /* extra fields for header */ # define UF_LAST_SAVE_NR 1 @@ -847,6 +854,15 @@ static bool serialize_uhp(bufinfo_T *bi, u_header_T *uhp) } } undo_write_bytes(bi, (uintmax_t)UF_ENTRY_END_MAGIC, 2); + + // Write all extmark undo objects + for (size_t i = 0; i < kv_size(uhp->uh_extmark); i++) { + if (!serialize_extmark(bi, kv_A(uhp->uh_extmark, i))) { + return false; + } + } + undo_write_bytes(bi, (uintmax_t)UF_ENTRY_END_MAGIC, 2); + return true; } @@ -928,9 +944,95 @@ static u_header_T *unserialize_uhp(bufinfo_T *bi, return NULL; } + // Unserialize all extmark undo information + ExtmarkUndoObject *extup; + kv_init(uhp->uh_extmark); + + while ((c = undo_read_2c(bi)) == UF_ENTRY_MAGIC) { + bool error = false; + extup = unserialize_extmark(bi, &error, file_name); + if (error) { + kv_destroy(uhp->uh_extmark); + xfree(extup); + return NULL; + } + kv_push(uhp->uh_extmark, *extup); + xfree(extup); + } + if (c != UF_ENTRY_END_MAGIC) { + corruption_error("entry end", file_name); + u_free_uhp(uhp); + return NULL; + } + return uhp; } +static bool serialize_extmark(bufinfo_T *bi, ExtmarkUndoObject extup) +{ + if (extup.type == kExtmarkSplice) { + undo_write_bytes(bi, (uintmax_t)UF_ENTRY_MAGIC, 2); + undo_write_bytes(bi, (uintmax_t)extup.type, 4); + if (!undo_write(bi, (uint8_t *)&(extup.data.splice), + sizeof(ExtmarkSplice))) { + return false; + } + } else if (extup.type == kExtmarkMove) { + undo_write_bytes(bi, (uintmax_t)UF_ENTRY_MAGIC, 2); + undo_write_bytes(bi, (uintmax_t)extup.type, 4); + if (!undo_write(bi, (uint8_t *)&(extup.data.move), sizeof(ExtmarkMove))) { + return false; + } + } + // Note: We do not serialize ExtmarkSavePos information, since + // buffer marktrees are not retained when closing/reopening a file + return true; +} + +static ExtmarkUndoObject *unserialize_extmark(bufinfo_T *bi, bool *error, + const char *filename) +{ + UndoObjectType type; + uint8_t *buf = NULL; + size_t n_elems; + + ExtmarkUndoObject *extup = xmalloc(sizeof(ExtmarkUndoObject)); + + type = (UndoObjectType)undo_read_4c(bi); + extup->type = type; + if (type == kExtmarkSplice) { + n_elems = (size_t)sizeof(ExtmarkSplice) / sizeof(uint8_t); + buf = xcalloc(sizeof(uint8_t), n_elems); + if (!undo_read(bi, buf, n_elems)) { + goto error; + } + extup->data.splice = *(ExtmarkSplice *)buf; + } else if (type == kExtmarkMove) { + n_elems = (size_t)sizeof(ExtmarkMove) / sizeof(uint8_t); + buf = xcalloc(sizeof(uint8_t), n_elems); + if (!undo_read(bi, buf, n_elems)) { + goto error; + } + extup->data.move = *(ExtmarkMove *)buf; + } else { + goto error; + } + + if (buf) { + xfree(buf); + } + + return extup; + +error: + xfree(extup); + if (buf) { + xfree(buf); + } + *error = true; + return NULL; +} + /// Serializes "uep". /// /// @param bi The buffer information diff --git a/src/nvim/window.c b/src/nvim/window.c index 00f49724b6..0f717a2f90 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -5501,7 +5501,7 @@ void win_setminheight(void) // loop until there is a 'winminheight' that is possible while (p_wmh > 0) { - const int room = Rows - p_ch; + const int room = Rows - p_ch - tabline_height(); const int needed = frame_minheight(topframe, NULL); if (room >= needed) { break; @@ -5960,9 +5960,17 @@ void win_new_width(win_T *wp, int width) void win_comp_scroll(win_T *wp) { + const long old_w_p_scr = wp->w_p_scr; + wp->w_p_scr = wp->w_height / 2; - if (wp->w_p_scr == 0) + if (wp->w_p_scr == 0) { wp->w_p_scr = 1; + } + if (wp->w_p_scr != old_w_p_scr) { + // Used by "verbose set scroll". + wp->w_p_script_ctx[WV_SCROLL].script_ctx.sc_sid = SID_WINLAYOUT; + wp->w_p_script_ctx[WV_SCROLL].script_ctx.sc_lnum = 0; + } } /* diff --git a/test/functional/legacy/options_spec.lua b/test/functional/legacy/options_spec.lua index 1db7afc7a7..d7f5df3a1e 100644 --- a/test/functional/legacy/options_spec.lua +++ b/test/functional/legacy/options_spec.lua @@ -1,6 +1,10 @@ +-- See also: src/nvim/testdir/test_options.vim local helpers = require('test.functional.helpers')(after_each) local command, clear = helpers.command, helpers.clear local source, expect = helpers.source, helpers.expect +local exc_exec = helpers.exc_exec; +local matches = helpers.matches; +local Screen = require('test.functional.ui.screen') describe('options', function() setup(clear) @@ -11,7 +15,7 @@ describe('options', function() end) describe('set', function() - setup(clear) + before_each(clear) it("should keep two comma when 'path' is changed", function() source([[ @@ -24,4 +28,45 @@ describe('set', function() foo,,bar]]) end) + + it('winminheight works', function() + local screen = Screen.new(20, 11) + screen:attach() + source([[ + set wmh=0 stal=2 + below sp | wincmd _ + below sp | wincmd _ + below sp | wincmd _ + below sp + ]]) + matches('E36: Not enough room', exc_exec('set wmh=1')) + end) + + it('scroll works', function() + local screen = Screen.new(42, 16) + screen:attach() + source([[ + set scroll=2 + set laststatus=2 + ]]) + command('verbose set scroll?') + screen:expect([[ + | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + | + scroll=7 | + Last set from changed window size | + Press ENTER or type command to continue^ | + ]]) + end) end) diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua index 8c5e936906..7a6b5be8bc 100644 --- a/test/functional/lua/buffer_updates_spec.lua +++ b/test/functional/lua/buffer_updates_spec.lua @@ -666,8 +666,62 @@ describe('lua: nvim_buf_attach on_bytes', function() } end) + it("sends events when undoing with undofile", function() + write_file("Xtest-undofile", dedent([[ + 12345 + hello world + ]])) + + command("e! Xtest-undofile") + command("set undodir=. | set undofile") + + local ns = helpers.request('nvim_create_namespace', "ns1") + meths.buf_set_extmark(0, ns, 0, 0, {}) + + eq({"12345", "hello world"}, meths.buf_get_lines(0, 0, -1, true)) + + -- splice + feed("gg0d2l") + + eq({"345", "hello world"}, meths.buf_get_lines(0, 0, -1, true)) + + -- move + command(".m+1") + + eq({"hello world", "345"}, meths.buf_get_lines(0, 0, -1, true)) + + -- reload undofile and undo changes + command("w") + command("set noundofile") + command("bw!") + command("e! Xtest-undofile") + + command("set undofile") + + local check_events = setup_eventcheck(verify, nil) + + feed("u") + eq({"345", "hello world"}, meths.buf_get_lines(0, 0, -1, true)) + + check_events { + { "test1", "bytes", 2, 6, 1, 0, 12, 1, 0, 4, 0, 0, 0 }, + { "test1", "bytes", 2, 6, 0, 0, 0, 0, 0, 0, 1, 0, 4 } + } + + feed("u") + eq({"12345", "hello world"}, meths.buf_get_lines(0, 0, -1, true)) + + check_events { + { "test1", "bytes", 2, 8, 0, 0, 0, 0, 0, 0, 0, 2, 2 } + } + command("bw!") + end) + + teardown(function() os.remove "Xtest-reload" + os.remove "Xtest-undofile" + os.remove ".Xtest-undofile.un~" end) end diff --git a/test/functional/ui/fold_spec.lua b/test/functional/ui/fold_spec.lua index 6ce8b33a63..d3b1d33956 100644 --- a/test/functional/ui/fold_spec.lua +++ b/test/functional/ui/fold_spec.lua @@ -38,7 +38,9 @@ describe("folded lines", function() [6] = {background = Screen.colors.Yellow}, [7] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray}, [8] = {foreground = Screen.colors.Brown }, - [9] = {bold = true, foreground = Screen.colors.Brown} + [9] = {bold = true, foreground = Screen.colors.Brown}, + [10] = {background = Screen.colors.LightGrey, underline = true}, + [11] = {bold=true}, }) end) @@ -290,6 +292,369 @@ describe("folded lines", function() end end) + it("works with split", function() + insert([[ + aa + bb + cc + dd + ee + ff]]) + feed_command('2') + command("set foldcolumn=1") + feed('zf3j') + feed_command('1') + feed('zf2j') + feed('zO') + feed_command("rightbelow new") + insert([[ + aa + bb + cc + dd + ee + ff]]) + feed_command('2') + command("set foldcolumn=1") + feed('zf3j') + feed_command('1') + feed('zf2j') + if multigrid then + meths.input_mouse('left', 'press', '', 4, 0, 0) + screen:expect([[ + ## grid 1 + [2:---------------------------------------------]| + [2:---------------------------------------------]| + {2:[No Name] [+] }| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + {3:[No Name] [+] }| + [3:---------------------------------------------]| + ## grid 2 + {7:-}aa | + {7:-}bb | + ## grid 3 + :1 | + ## grid 4 + {7:-}^aa | + {7:+}{5:+--- 4 lines: bb···························}| + {7:│}ff | + ]]) + else + meths.input_mouse('left', 'press', '', 0, 3, 0) + screen:expect([[ + {7:-}aa | + {7:-}bb | + {2:[No Name] [+] }| + {7:-}^aa | + {7:+}{5:+--- 4 lines: bb···························}| + {7:│}ff | + {3:[No Name] [+] }| + :1 | + ]]) + end + + if multigrid then + meths.input_mouse('left', 'press', '', 4, 1, 0) + screen:expect([[ + ## grid 1 + [2:---------------------------------------------]| + [2:---------------------------------------------]| + {2:[No Name] [+] }| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + {3:[No Name] [+] }| + [3:---------------------------------------------]| + ## grid 2 + {7:-}aa | + {7:-}bb | + ## grid 3 + :1 | + ## grid 4 + {7:-}^aa | + {7:-}bb | + {7:2}cc | + ]]) + else + meths.input_mouse('left', 'press', '', 0, 4, 0) + screen:expect([[ + {7:-}aa | + {7:-}bb | + {2:[No Name] [+] }| + {7:-}^aa | + {7:-}bb | + {7:2}cc | + {3:[No Name] [+] }| + :1 | + ]]) + end + + if multigrid then + meths.input_mouse('left', 'press', '', 2, 1, 0) + screen:expect([[ + ## grid 1 + [2:---------------------------------------------]| + [2:---------------------------------------------]| + {3:[No Name] [+] }| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + {2:[No Name] [+] }| + [3:---------------------------------------------]| + ## grid 2 + {7:-}aa | + {7:+}{5:^+--- 4 lines: bb···························}| + ## grid 3 + :1 | + ## grid 4 + {7:-}aa | + {7:-}bb | + {7:2}cc | + ]]) + else + meths.input_mouse('left', 'press', '', 0, 1, 0) + screen:expect([[ + {7:-}aa | + {7:+}{5:^+--- 4 lines: bb···························}| + {3:[No Name] [+] }| + {7:-}aa | + {7:-}bb | + {7:2}cc | + {2:[No Name] [+] }| + :1 | + ]]) + end + + if multigrid then + meths.input_mouse('left', 'press', '', 2, 0, 0) + screen:expect([[ + ## grid 1 + [2:---------------------------------------------]| + [2:---------------------------------------------]| + {3:[No Name] [+] }| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + {2:[No Name] [+] }| + [3:---------------------------------------------]| + ## grid 2 + {7:+}{5:^+-- 6 lines: aa····························}| + {1:~ }| + ## grid 3 + :1 | + ## grid 4 + {7:-}aa | + {7:-}bb | + {7:2}cc | + ]]) + else + meths.input_mouse('left', 'press', '', 0, 0, 0) + screen:expect([[ + {7:+}{5:^+-- 6 lines: aa····························}| + {1:~ }| + {3:[No Name] [+] }| + {7:-}aa | + {7:-}bb | + {7:2}cc | + {2:[No Name] [+] }| + :1 | + ]]) + end + end) + + it("works with tab", function() + insert([[ + aa + bb + cc + dd + ee + ff]]) + feed_command('2') + command("set foldcolumn=2") + feed('zf3j') + feed_command('1') + feed('zf2j') + feed('zO') + feed_command("tab split") + if multigrid then + meths.input_mouse('left', 'press', '', 4, 1, 1) + screen:expect([[ + ## grid 1 + {10: + [No Name] }{11: + [No Name] }{2: }{10:X}| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [3:---------------------------------------------]| + ## grid 2 (hidden) + {7:- }aa | + {7:│-}bb | + {7:││}cc | + {7:││}dd | + {7:││}ee | + {7:│ }ff | + {1:~ }| + ## grid 3 + :tab split | + ## grid 4 + {7:- }^aa | + {7:│+}{5:+--- 4 lines: bb··························}| + {7:│ }ff | + {1:~ }| + {1:~ }| + {1:~ }| + ]]) + else + meths.input_mouse('left', 'press', '', 0, 2, 1) + screen:expect([[ + {10: + [No Name] }{11: + [No Name] }{2: }{10:X}| + {7:- }^aa | + {7:│+}{5:+--- 4 lines: bb··························}| + {7:│ }ff | + {1:~ }| + {1:~ }| + {1:~ }| + :tab split | + ]]) + end + + if multigrid then + meths.input_mouse('left', 'press', '', 4, 0, 0) + screen:expect([[ + ## grid 1 + {10: + [No Name] }{11: + [No Name] }{2: }{10:X}| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [4:---------------------------------------------]| + [3:---------------------------------------------]| + ## grid 2 (hidden) + {7:- }aa | + {7:│-}bb | + {7:││}cc | + {7:││}dd | + {7:││}ee | + {7:│ }ff | + {1:~ }| + ## grid 3 + :tab split | + ## grid 4 + {7:+ }{5:^+-- 6 lines: aa···························}| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ]]) + else + meths.input_mouse('left', 'press', '', 0, 1, 0) + screen:expect([[ + {10: + [No Name] }{11: + [No Name] }{2: }{10:X}| + {7:+ }{5:^+-- 6 lines: aa···························}| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + :tab split | + ]]) + end + + feed_command("tabnext") + if multigrid then + meths.input_mouse('left', 'press', '', 2, 1, 1) + screen:expect([[ + ## grid 1 + {11: + [No Name] }{10: + [No Name] }{2: }{10:X}| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [3:---------------------------------------------]| + ## grid 2 + {7:- }^aa | + {7:│+}{5:+--- 4 lines: bb··························}| + {7:│ }ff | + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + :tabnext | + ## grid 4 (hidden) + {7:+ }{5:+-- 6 lines: aa···························}| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ]]) + else + meths.input_mouse('left', 'press', '', 0, 2, 1) + screen:expect([[ + {11: + [No Name] }{10: + [No Name] }{2: }{10:X}| + {7:- }^aa | + {7:│+}{5:+--- 4 lines: bb··························}| + {7:│ }ff | + {1:~ }| + {1:~ }| + {1:~ }| + :tabnext | + ]]) + end + + if multigrid then + meths.input_mouse('left', 'press', '', 2, 0, 0) + screen:expect([[ + ## grid 1 + {11: + [No Name] }{10: + [No Name] }{2: }{10:X}| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [2:---------------------------------------------]| + [3:---------------------------------------------]| + ## grid 2 + {7:+ }{5:^+-- 6 lines: aa···························}| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + :tabnext | + ## grid 4 (hidden) + {7:+ }{5:+-- 6 lines: aa···························}| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ]]) + else + meths.input_mouse('left', 'press', '', 0, 1, 0) + screen:expect([[ + {11: + [No Name] }{10: + [No Name] }{2: }{10:X}| + {7:+ }{5:^+-- 6 lines: aa···························}| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + :tabnext | + ]]) + end + end) + it("works with multibyte text", function() -- Currently the only allowed value of 'maxcombine' eq(6, meths.get_option('maxcombine')) |