mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
Prevent :topleft, etc modifying the inccommand preview window
This commit is contained in:
@@ -5535,6 +5535,9 @@ static buf_T *show_sub(exarg_T *eap, pos_T old_cusr,
|
|||||||
|
|
||||||
// We keep a special-purpose buffer around, but don't assume it exists.
|
// We keep a special-purpose buffer around, but don't assume it exists.
|
||||||
buf_T *preview_buf = bufnr ? buflist_findnr(bufnr) : 0;
|
buf_T *preview_buf = bufnr ? buflist_findnr(bufnr) : 0;
|
||||||
|
// disable :leftabove/botright modifiers
|
||||||
|
// (especially ones that conflict with our win_split() call below)
|
||||||
|
cmdmod.split = 0;
|
||||||
cmdmod.tab = 0; // disable :tab modifier
|
cmdmod.tab = 0; // disable :tab modifier
|
||||||
cmdmod.noswapfile = true; // disable swap for preview buffer
|
cmdmod.noswapfile = true; // disable swap for preview buffer
|
||||||
// disable file info message
|
// disable file info message
|
||||||
|
@@ -95,7 +95,7 @@ local function common_setup(screen, inccommand, text)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe(":substitute, inccommand=split", function()
|
describe(":substitute, inccommand=split interactivity", function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
common_setup(nil, "split", default_text)
|
common_setup(nil, "split", default_text)
|
||||||
@@ -788,6 +788,52 @@ describe(":substitute, inccommand=split", function()
|
|||||||
screen:expect{any=[[two lines]]}
|
screen:expect{any=[[two lines]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("ignores new-window modifiers when splitting the preview window", function()
|
||||||
|
-- one modifier
|
||||||
|
feed(':topleft %s/tw/to')
|
||||||
|
screen:expect([[
|
||||||
|
Inc substitution on |
|
||||||
|
{12:to}o lines |
|
||||||
|
Inc substitution on |
|
||||||
|
{12:to}o lines |
|
||||||
|
|
|
||||||
|
{11:[No Name] [+] }|
|
||||||
|
|2| {12:to}o lines |
|
||||||
|
|4| {12:to}o lines |
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{10:[Preview] }|
|
||||||
|
:topleft %s/tw/to^ |
|
||||||
|
]])
|
||||||
|
feed('<Esc>')
|
||||||
|
screen:expect{any=[[two lines]]}
|
||||||
|
|
||||||
|
-- multiple modifiers
|
||||||
|
feed(':topleft vert %s/tw/to')
|
||||||
|
screen:expect([[
|
||||||
|
Inc substitution on |
|
||||||
|
{12:to}o lines |
|
||||||
|
Inc substitution on |
|
||||||
|
{12:to}o lines |
|
||||||
|
|
|
||||||
|
{11:[No Name] [+] }|
|
||||||
|
|2| {12:to}o lines |
|
||||||
|
|4| {12:to}o lines |
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{15:~ }|
|
||||||
|
{10:[Preview] }|
|
||||||
|
:topleft vert %s/tw/to^ |
|
||||||
|
]])
|
||||||
|
feed('<Esc>')
|
||||||
|
screen:expect{any=[[two lines]]}
|
||||||
|
end)
|
||||||
|
|
||||||
it('shows split window when typing the pattern', function()
|
it('shows split window when typing the pattern', function()
|
||||||
feed(":%s/tw")
|
feed(":%s/tw")
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
|
Reference in New Issue
Block a user