mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 9.0.0757: line number not visisble with 'smoothscroll', 'nu' and 'rnu'
Problem: Line number not visisble with 'smoothscroll', 'nu' and 'rnu'. Solution: Put the ">>>" after the line number instead of on top.
This commit is contained in:
@@ -370,7 +370,8 @@ handle_lnum_col(
|
|||||||
#ifdef FEAT_PROP_POPUP
|
#ifdef FEAT_PROP_POPUP
|
||||||
+ wlv->text_prop_above_count
|
+ wlv->text_prop_above_count
|
||||||
#endif
|
#endif
|
||||||
&& (wp->w_skipcol == 0 || wlv->row > wp->w_winrow))
|
&& (wp->w_skipcol == 0 || wlv->row > wp->w_winrow
|
||||||
|
|| (wp->w_p_nu && wp->w_p_rnu)))
|
||||||
{
|
{
|
||||||
long num;
|
long num;
|
||||||
char *fmt = "%*ld ";
|
char *fmt = "%*ld ";
|
||||||
@@ -770,8 +771,18 @@ wlv_screen_line(win_T *wp, winlinevars_T *wlv, int negative_width)
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
int off = (int)(current_ScreenLine - ScreenLines);
|
int off = (int)(current_ScreenLine - ScreenLines);
|
||||||
|
int skip = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i)
|
if (wp->w_p_nu && wp->w_p_rnu)
|
||||||
|
// Do not overwrite the line number, change "123 text" to
|
||||||
|
// "123>>>xt".
|
||||||
|
while (skip < wp->w_width && VIM_ISDIGIT(ScreenLines[off]))
|
||||||
|
{
|
||||||
|
++off;
|
||||||
|
++skip;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 3 && i + skip < wp->w_width; ++i)
|
||||||
{
|
{
|
||||||
ScreenLines[off] = '<';
|
ScreenLines[off] = '<';
|
||||||
if (enc_utf8)
|
if (enc_utf8)
|
||||||
|
12
src/testdir/dumps/Test_smooth_number_7.dump
Normal file
12
src/testdir/dumps/Test_smooth_number_7.dump
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|2+0#af5f00255#ffffff0|<+0#4040ff13&@2|o+0#0000000&|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n>g| |t|e
|
||||||
|
| +0#af5f00255&@3|x+0#0000000&|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r
|
||||||
|
| +0#af5f00255&@3|y+0#0000000&| |l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g
|
||||||
|
| +0#af5f00255&@3| +0#0000000&|t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t|
|
||||||
|
| +0#af5f00255&@1|1| |t+0#0000000&|h|r|e@1| @30
|
||||||
|
|~+0#4040ff13&| @38
|
||||||
|
|~| @38
|
||||||
|
|~| @38
|
||||||
|
|~| @38
|
||||||
|
|~| @38
|
||||||
|
|~| @38
|
||||||
|
|-+0#0000000&@1|N|o|.@2|e|r|-@1| @10|2|,|7|3| @9|B|o|t|
|
@@ -121,6 +121,17 @@ func Test_smoothscroll_number()
|
|||||||
set smoothscroll
|
set smoothscroll
|
||||||
set number cpo+=n
|
set number cpo+=n
|
||||||
:3
|
:3
|
||||||
|
|
||||||
|
def g:DoRel()
|
||||||
|
set number relativenumber scrolloff=0
|
||||||
|
:%del
|
||||||
|
setline(1, [
|
||||||
|
'one',
|
||||||
|
'very long text '->repeat(12),
|
||||||
|
'three',
|
||||||
|
])
|
||||||
|
exe "normal 2Gzt\<C-E>"
|
||||||
|
enddef
|
||||||
END
|
END
|
||||||
call writefile(lines, 'XSmoothNumber', 'D')
|
call writefile(lines, 'XSmoothNumber', 'D')
|
||||||
let buf = RunVimInTerminal('-S XSmoothNumber', #{rows: 12, cols: 40})
|
let buf = RunVimInTerminal('-S XSmoothNumber', #{rows: 12, cols: 40})
|
||||||
@@ -138,6 +149,9 @@ 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 VerifyScreenDump(buf, 'Test_smooth_number_7', {})
|
||||||
|
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
757,
|
||||||
/**/
|
/**/
|
||||||
756,
|
756,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user