diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-10-09 18:57:22 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-10-09 19:09:32 +0800 |
commit | 7cdaa74b3684d40a6e72bbf3eb4deedb0c5df7bc (patch) | |
tree | 231f218ee561e64030dd383e23f9926600c9cd17 /test/functional/legacy | |
parent | c93fd83df206c2438a735d6d99e640db1976f2f0 (diff) | |
download | rneovim-7cdaa74b3684d40a6e72bbf3eb4deedb0c5df7bc.tar.gz rneovim-7cdaa74b3684d40a6e72bbf3eb4deedb0c5df7bc.tar.bz2 rneovim-7cdaa74b3684d40a6e72bbf3eb4deedb0c5df7bc.zip |
vim-patch:9.0.0702: incomplete testing cursor position with 'linebreak' set
Problem: Incomplete testing cursor position after change with 'linebreak'
set.
Solution: Add a test and move test cases together. (closes vim/vim#11313)
https://github.com/vim/vim/commit/30c0c467d6cc2a7af960ccb9002b50115b0e55cf
Diffstat (limited to 'test/functional/legacy')
-rw-r--r-- | test/functional/legacy/listlbr_spec.lua | 96 |
1 files changed, 95 insertions, 1 deletions
diff --git a/test/functional/legacy/listlbr_spec.lua b/test/functional/legacy/listlbr_spec.lua index f70d55f4a3..d4f11a61c2 100644 --- a/test/functional/legacy/listlbr_spec.lua +++ b/test/functional/legacy/listlbr_spec.lua @@ -1,11 +1,12 @@ -- Test for linebreak and list option (non-utf8) local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') local feed, insert, source = helpers.feed, helpers.insert, helpers.source local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect describe('listlbr', function() - setup(clear) + before_each(clear) -- luacheck: ignore 621 (Indentation) -- luacheck: ignore 611 (Line contains only whitespaces) @@ -195,4 +196,97 @@ describe('listlbr', function() aa>-----a-$ ~ ]]) end) + + -- oldtest: Test_linebreak_reset_restore() + it('cursor position is drawn correctly after operator', function() + local screen = Screen.new(60, 6) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [1] = {background = Screen.colors.LightGrey}, -- Visual + [2] = {background = Screen.colors.Red, foreground = Screen.colors.White}, -- ErrorMsg + }) + screen:attach() + + -- f_wincol() calls validate_cursor() + source([[ + set linebreak showcmd noshowmode formatexpr=wincol()-wincol() + call setline(1, repeat('a', &columns - 10) .. ' bbbbbbbbbb c') + ]]) + + feed('$v$') + screen:expect([[ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | + bbbbbbbbbb {1:c}^ | + {0:~ }| + {0:~ }| + {0:~ }| + 2 | + ]]) + feed('zo') + screen:expect([[ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | + bbbbbbbbbb ^c | + {0:~ }| + {0:~ }| + {0:~ }| + {2:E490: No fold found} | + ]]) + + feed('$v$') + screen:expect([[ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | + bbbbbbbbbb {1:c}^ | + {0:~ }| + {0:~ }| + {0:~ }| + {2:E490: No fold found} 2 | + ]]) + feed('gq') + screen:expect([[ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | + bbbbbbbbbb ^c | + {0:~ }| + {0:~ }| + {0:~ }| + {2:E490: No fold found} | + ]]) + + feed('$<C-V>$') + screen:expect([[ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | + bbbbbbbbbb {1:c}^ | + {0:~ }| + {0:~ }| + {0:~ }| + {2:E490: No fold found} 1x2 | + ]]) + feed('I') + screen:expect([[ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | + bbbbbbbbbb ^c | + {0:~ }| + {0:~ }| + {0:~ }| + {2:E490: No fold found} | + ]]) + + feed('<Esc>$v$') + screen:expect([[ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | + bbbbbbbbbb {1:c}^ | + {0:~ }| + {0:~ }| + {0:~ }| + {2:E490: No fold found} 2 | + ]]) + feed('s') + screen:expect([[ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | + bbbbbbbbbb ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {2:E490: No fold found} | + ]]) + end) end) |