diff options
| author | Björn Linse <bjorn.linse@gmail.com> | 2020-02-02 12:50:57 +0100 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-02 12:50:57 +0100 | 
| commit | 3051342f96fd49820490237013ce1ba21171f72b (patch) | |
| tree | 6e2603e2db48a42de7de6b33da089a53b834b013 /test/functional/ui/inccommand_spec.lua | |
| parent | 045e86474b75992834f54157b04ea2a941ab03a7 (diff) | |
| parent | 459a362cc140644d104de326258f9dfe75dbdcdf (diff) | |
| download | rneovim-3051342f96fd49820490237013ce1ba21171f72b.tar.gz rneovim-3051342f96fd49820490237013ce1ba21171f72b.tar.bz2 rneovim-3051342f96fd49820490237013ce1ba21171f72b.zip | |
Merge pull request #11801 from bfredl/incsubcrash
extmark: fix crash due to invalid column values in inccommand preview
Diffstat (limited to 'test/functional/ui/inccommand_spec.lua')
| -rw-r--r-- | test/functional/ui/inccommand_spec.lua | 72 | 
1 files changed, 72 insertions, 0 deletions
| diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index b841574643..afb0c9cfa6 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -18,6 +18,7 @@ local wait = helpers.wait  local nvim = helpers.nvim  local sleep = helpers.sleep  local nvim_dir = helpers.nvim_dir +local assert_alive = helpers.assert_alive  local default_text = [[    Inc substitution on @@ -84,6 +85,7 @@ local function common_setup(screen, inccommand, text)        [14] = {foreground = Screen.colors.White, background = Screen.colors.Red},        [15] = {bold=true, foreground=Screen.colors.Blue},        [16] = {background=Screen.colors.Grey90},  -- cursorline +      [17] = {foreground = Screen.colors.Blue1},        vis  = {background=Screen.colors.LightGrey}      })    end @@ -2291,6 +2293,76 @@ describe(":substitute", function()      ]])    end) +  it("inccommand=split, contraction of two subsequent NL chars", function() +    -- luacheck: push ignore 611 +    local text = [[ +      AAA AA +       +      BBB BB +       +      CCC CC +       +]] +    -- luacheck: pop + +    -- This used to crash, but more than 20 highlight entries are required +    -- to reproduce it (so that the marktree has multiple nodes) +    common_setup(screen, "split", string.rep(text,10)) +    feed(":%s/\\n\\n/<c-v><c-m>/g") +    screen:expect{grid=[[ +      CCC CC                        | +      AAA AA                        | +      BBB BB                        | +      CCC CC                        | +                                    | +      {11:[No Name] [+]                 }| +      | 1| AAA AA                   | +      | 2|{12: }BBB BB                   | +      | 3|{12: }CCC CC                   | +      | 4|{12: }AAA AA                   | +      | 5|{12: }BBB BB                   | +      | 6|{12: }CCC CC                   | +      | 7|{12: }AAA AA                   | +      {10:[Preview]                     }| +      :%s/\n\n/{17:^M}/g^                 | +    ]]} +    assert_alive() +  end) + +  it("inccommand=nosplit, contraction of two subsequent NL chars", function() +    -- luacheck: push ignore 611 +    local text = [[ +      AAA AA +       +      BBB BB +       +      CCC CC +       +]] +    -- luacheck: pop + +    common_setup(screen, "nosplit", string.rep(text,10)) +    feed(":%s/\\n\\n/<c-v><c-m>/g") +    screen:expect{grid=[[ +      CCC CC                        | +      AAA AA                        | +      BBB BB                        | +      CCC CC                        | +      AAA AA                        | +      BBB BB                        | +      CCC CC                        | +      AAA AA                        | +      BBB BB                        | +      CCC CC                        | +      AAA AA                        | +      BBB BB                        | +      CCC CC                        | +                                    | +      :%s/\n\n/{17:^M}/g^                 | +    ]]} +    assert_alive() +  end) +    it("inccommand=split, multibyte text", function()      common_setup(screen, "split", multibyte_text)      feed(":%s/£.*ѫ/X¥¥") | 
