diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-11-25 19:15:05 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-11-25 19:27:38 +0000 |
commit | c5d770d311841ea5230426cc4c868e8db27300a8 (patch) | |
tree | dd21f70127b4b8b5f109baefc8ecc5016f507c91 /test/functional/ui/spell_spec.lua | |
parent | 9be89f131f87608f224f0ee06d199fcd09d32176 (diff) | |
parent | 081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff) | |
download | rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2 rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip |
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/ui/spell_spec.lua')
-rw-r--r-- | test/functional/ui/spell_spec.lua | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/test/functional/ui/spell_spec.lua b/test/functional/ui/spell_spec.lua index da112148cd..86d5a362e5 100644 --- a/test/functional/ui/spell_spec.lua +++ b/test/functional/ui/spell_spec.lua @@ -17,7 +17,6 @@ describe("'spell'", function() before_each(function() clear() screen = Screen.new(80, 8) - screen:attach() screen:set_default_attr_ids({ [0] = { bold = true, foreground = Screen.colors.Blue }, [1] = { special = Screen.colors.Red, undercurl = true }, @@ -377,4 +376,83 @@ describe("'spell'", function() | ]]) end) + + it('overrides syntax when Visual selection is active', function() + screen:try_resize(43, 3) + screen:set_default_attr_ids({ + [0] = { bold = true, foreground = Screen.colors.Blue }, + [1] = { foreground = Screen.colors.Blue }, + [2] = { foreground = Screen.colors.Red }, + [3] = { foreground = Screen.colors.Blue, underline = true }, + [4] = { foreground = Screen.colors.Red, underline = true }, + [5] = { bold = true }, + }) + exec([[ + hi! Comment guibg=NONE guifg=Blue gui=NONE guisp=NONE + hi! SpellBad guibg=NONE guifg=Red gui=NONE guisp=NONE + hi! Visual guibg=NONE guifg=NONE gui=underline guisp=NONE + syn match Comment "//.*" + call setline(1, '// Here is a misspeld word.') + set spell + ]]) + screen:expect([[ + {1:^// Here is a }{2:misspeld}{1: word.} | + {0:~ }| + | + ]]) + feed('V') + screen:expect([[ + {1:^/}{3:/ Here is a }{4:misspeld}{3: word.} | + {0:~ }| + {5:-- VISUAL LINE --} | + ]]) + end) + + it("global value works properly for 'spelloptions'", function() + screen:try_resize(43, 3) + exec('set spell') + -- :setglobal applies to future buffers but not current buffer + exec('setglobal spelloptions=camel') + insert('Here is TheCamelWord being spellchecked') + screen:expect([[ + Here is {1:TheCamelWord} being spellchecke^d | + {0:~ }| + | + ]]) + exec('enew') + insert('There is TheCamelWord being spellchecked') + screen:expect([[ + There is TheCamelWord being spellchecke^d | + {0:~ }| + | + ]]) + -- :setlocal applies to current buffer but not future buffers + exec('setlocal spelloptions=') + screen:expect([[ + There is {1:TheCamelWord} being spellchecke^d | + {0:~ }| + | + ]]) + exec('enew') + insert('What is TheCamelWord being spellchecked') + screen:expect([[ + What is TheCamelWord being spellchecke^d | + {0:~ }| + | + ]]) + -- :set applies to both current buffer and future buffers + exec('set spelloptions=') + screen:expect([[ + What is {1:TheCamelWord} being spellchecke^d | + {0:~ }| + | + ]]) + exec('enew') + insert('Where is TheCamelWord being spellchecked') + screen:expect([[ + Where is {1:TheCamelWord} being spellchecke^d | + {0:~ }| + | + ]]) + end) end) |