mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.1506: line number not displayed when using 'smoothscroll' (#23453)
Problem: Line number not displayed when using 'smoothscroll'.
Solution: Adjust condition for showing the line number. (closes vim/vim#12333)
88bb3e0a48
This commit is contained in:
parent
9909668111
commit
62ecb05957
@ -609,7 +609,7 @@ static void handle_lnum_col(win_T *wp, winlinevars_T *wlv, int num_signs, int si
|
|||||||
} else {
|
} else {
|
||||||
// Draw the line number (empty space after wrapping).
|
// Draw the line number (empty space after wrapping).
|
||||||
if (wlv->row == wlv->startrow + wlv->filler_lines
|
if (wlv->row == wlv->startrow + wlv->filler_lines
|
||||||
&& (wp->w_skipcol == 0 || wlv->row > wp->w_winrow || (wp->w_p_nu && wp->w_p_rnu))) {
|
&& (wp->w_skipcol == 0 || wlv->row > 0 || (wp->w_p_nu && wp->w_p_rnu))) {
|
||||||
get_line_number_str(wp, wlv->lnum, wlv->extra, sizeof(wlv->extra));
|
get_line_number_str(wp, wlv->lnum, wlv->extra, sizeof(wlv->extra));
|
||||||
if (wp->w_skipcol > 0 && wlv->startrow == 0) {
|
if (wp->w_skipcol > 0 && wlv->startrow == 0) {
|
||||||
for (wlv->p_extra = wlv->extra; *wlv->p_extra == ' '; wlv->p_extra++) {
|
for (wlv->p_extra = wlv->extra; *wlv->p_extra == ' '; wlv->p_extra++) {
|
||||||
|
@ -195,7 +195,7 @@ describe('display', function()
|
|||||||
run_test_display_lastline(true)
|
run_test_display_lastline(true)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- oldtest: Test_display_long_lastline
|
-- oldtest: Test_display_long_lastline()
|
||||||
it('display "lastline" shows correct text when end of wrapped line is deleted', function()
|
it('display "lastline" shows correct text when end of wrapped line is deleted', function()
|
||||||
local screen = Screen.new(35, 14)
|
local screen = Screen.new(35, 14)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
|
@ -179,6 +179,7 @@ describe('smoothscroll', function()
|
|||||||
exec([[
|
exec([[
|
||||||
call setline(1, [ 'one ' .. 'word '->repeat(20), 'two ' .. 'long word '->repeat(7), 'line', 'line', 'line', ])
|
call setline(1, [ 'one ' .. 'word '->repeat(20), 'two ' .. 'long word '->repeat(7), 'line', 'line', 'line', ])
|
||||||
set smoothscroll scrolloff=5
|
set smoothscroll scrolloff=5
|
||||||
|
set splitkeep=topline
|
||||||
set number cpo+=n
|
set number cpo+=n
|
||||||
:3
|
:3
|
||||||
func g:DoRel()
|
func g:DoRel()
|
||||||
@ -277,6 +278,53 @@ describe('smoothscroll', function()
|
|||||||
~ |
|
~ |
|
||||||
|
|
|
|
||||||
]])
|
]])
|
||||||
|
exec('botright split')
|
||||||
|
feed('gg')
|
||||||
|
screen:expect([[
|
||||||
|
1 one word word word word word word wo|
|
||||||
|
rd word word word word word word wor|
|
||||||
|
d word word word word word word |
|
||||||
|
2 two long word long word long word@@@|
|
||||||
|
[No Name] [+] |
|
||||||
|
1 ^one word word word word word word wo|
|
||||||
|
rd word word word word word word wor|
|
||||||
|
d word word word word word word |
|
||||||
|
2 two long word long word long word lo|
|
||||||
|
ng word long word long word long @@@|
|
||||||
|
[No Name] [+] |
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
feed('<C-E>')
|
||||||
|
screen:expect([[
|
||||||
|
1 one word word word word word word wo|
|
||||||
|
rd word word word word word word wor|
|
||||||
|
d word word word word word word |
|
||||||
|
2 two long word long word long word@@@|
|
||||||
|
[No Name] [+] |
|
||||||
|
<<< rd word word word word word word wor|
|
||||||
|
d word word word word word word^ |
|
||||||
|
2 two long word long word long word lo|
|
||||||
|
ng word long word long word long wor|
|
||||||
|
d |
|
||||||
|
[No Name] [+] |
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
feed('<C-E>')
|
||||||
|
screen:expect([[
|
||||||
|
1 one word word word word word word wo|
|
||||||
|
rd word word word word word word wor|
|
||||||
|
d word word word word word word |
|
||||||
|
2 two long word long word long word@@@|
|
||||||
|
[No Name] [+] |
|
||||||
|
<<< d word word word word word word^ |
|
||||||
|
2 two long word long word long word lo|
|
||||||
|
ng word long word long word long wor|
|
||||||
|
d |
|
||||||
|
3 line |
|
||||||
|
[No Name] [+] |
|
||||||
|
|
|
||||||
|
]])
|
||||||
|
exec('close')
|
||||||
exec('call DoRel()')
|
exec('call DoRel()')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
2<<<^ong text very long text very long te|
|
2<<<^ong text very long text very long te|
|
||||||
|
@ -1325,6 +1325,7 @@ it('win_update redraws lines properly', function()
|
|||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- oldtest: Test_diff_rnu()
|
||||||
it('diff updates line numbers below filler lines', function()
|
it('diff updates line numbers below filler lines', function()
|
||||||
clear()
|
clear()
|
||||||
local screen = Screen.new(40, 14)
|
local screen = Screen.new(40, 14)
|
||||||
@ -1401,6 +1402,7 @@ it('diff updates line numbers below filler lines', function()
|
|||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- oldtest: Test_diff_with_scroll_and_change()
|
||||||
it('Align the filler lines when changing text in diff mode', function()
|
it('Align the filler lines when changing text in diff mode', function()
|
||||||
clear()
|
clear()
|
||||||
local screen = Screen.new(40, 20)
|
local screen = Screen.new(40, 20)
|
||||||
|
@ -137,6 +137,7 @@ func Test_smoothscroll_number()
|
|||||||
'line',
|
'line',
|
||||||
])
|
])
|
||||||
set smoothscroll
|
set smoothscroll
|
||||||
|
set splitkeep=topline
|
||||||
set number cpo+=n
|
set number cpo+=n
|
||||||
:3
|
:3
|
||||||
|
|
||||||
@ -167,8 +168,16 @@ func Test_smoothscroll_number()
|
|||||||
call term_sendkeys(buf, "\<C-Y>")
|
call term_sendkeys(buf, "\<C-Y>")
|
||||||
call VerifyScreenDump(buf, 'Test_smooth_number_6', {})
|
call VerifyScreenDump(buf, 'Test_smooth_number_6', {})
|
||||||
|
|
||||||
call term_sendkeys(buf, ":call DoRel()\<CR>")
|
call term_sendkeys(buf, ":botright split\<CR>gg")
|
||||||
call VerifyScreenDump(buf, 'Test_smooth_number_7', {})
|
call VerifyScreenDump(buf, 'Test_smooth_number_7', {})
|
||||||
|
call term_sendkeys(buf, "\<C-E>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_smooth_number_8', {})
|
||||||
|
call term_sendkeys(buf, "\<C-E>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_smooth_number_9', {})
|
||||||
|
call term_sendkeys(buf, ":close\<CR>")
|
||||||
|
|
||||||
|
call term_sendkeys(buf, ":call DoRel()\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_smooth_number_10', {})
|
||||||
|
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
Loading…
Reference in New Issue
Block a user