mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
parent
a396874da0
commit
f50e03f2e3
@ -2877,8 +2877,11 @@ void ex_z(exarg_T *eap)
|
||||
if (end > curbuf->b_ml.ml_line_count)
|
||||
end = curbuf->b_ml.ml_line_count;
|
||||
|
||||
if (curs > curbuf->b_ml.ml_line_count)
|
||||
if (curs > curbuf->b_ml.ml_line_count) {
|
||||
curs = curbuf->b_ml.ml_line_count;
|
||||
} else if (curs < 1) {
|
||||
curs = 1;
|
||||
}
|
||||
|
||||
for (i = start; i <= end; i++) {
|
||||
if (minus && i == lnum) {
|
||||
@ -2898,8 +2901,11 @@ void ex_z(exarg_T *eap)
|
||||
}
|
||||
}
|
||||
|
||||
curwin->w_cursor.lnum = curs;
|
||||
ex_no_reprint = TRUE;
|
||||
if (curwin->w_cursor.lnum != curs) {
|
||||
curwin->w_cursor.lnum = curs;
|
||||
curwin->w_cursor.col = 0;
|
||||
}
|
||||
ex_no_reprint = true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
12
test/functional/ex_cmds/print_commands_spec.lua
Normal file
12
test/functional/ex_cmds/print_commands_spec.lua
Normal file
@ -0,0 +1,12 @@
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local clear, eq, command, funcs =
|
||||
helpers.clear, helpers.eq, helpers.command, helpers.funcs
|
||||
|
||||
describe(':z^', function()
|
||||
before_each(clear)
|
||||
|
||||
it('correctly sets the cursor after :z^', function()
|
||||
command('z^')
|
||||
eq(1, funcs.line('.'))
|
||||
end)
|
||||
end)
|
Loading…
Reference in New Issue
Block a user