commit 61d7d983d6b7a6701c03dd2b52def2698c565d03
parent 8964ad45dab9aaa79d1fe8c83d2ae657d525028f
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu, 18 Sep 2025 08:09:36 +0800
vim-patch:9.1.1761: 'ruler' is set in defaults.vim
Problem: 'ruler' is set in defaults.vim, but not enabled by default in
non-compatible mode.
Solution: set the ruler option in non-compatible mode, remove it from
defaults.vim, update tests
closes: vim/vim#18260
https://github.com/vim/vim/commit/ba36510920654a52d8b5908f5a61c6969bb31942
Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat:
6 files changed, 175 insertions(+), 11 deletions(-)
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
@@ -74,7 +74,6 @@ Defaults *defaults* *nvim-defaults*
- 'mousemodel' defaults to "popup_setpos"
- 'nrformats' defaults to "bin,hex"
- 'path' defaults to ".,,". The C ftplugin adds "/usr/include" if it exists.
-- 'ruler' is enabled
- 'sessionoptions' includes "unix,slash", excludes "options"
- 'shortmess' includes "CF", excludes "S"
- 'sidescroll' defaults to 1
diff --git a/test/old/testdir/setup.vim b/test/old/testdir/setup.vim
@@ -19,7 +19,7 @@ if exists('s:did_load')
set listchars=eol:$
set maxsearchcount=99
set mousemodel=extend
- set nohidden nosmarttab noautoindent noautoread noruler
+ set nohidden nosmarttab noautoindent noautoread
set nohlsearch noincsearch
set nrformats=bin,octal,hex
set sessionoptions+=options
diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim
@@ -2386,7 +2386,10 @@ func Test_BufReadCmd()
call writefile(['one', 'two', 'three'], 'Xcmd.test', 'D')
edit Xcmd.test
+ set noruler
call assert_match('Xcmd.test" line 1 of 3', execute('file'))
+ set ruler
+ call assert_match('Xcmd.test" 3 lines --33%--', execute('file'))
normal! Gofour
write
call assert_equal(['one', 'two', 'three', 'four'], readfile('Xcmd.test'))
diff --git a/test/old/testdir/test_display.vim b/test/old/testdir/test_display.vim
@@ -187,7 +187,7 @@ func Test_edit_long_file_name()
let longName = 'x'->repeat(min([&columns, 255]))
call writefile([], longName, 'D')
- let buf = RunVimInTerminal('-N -u NONE --cmd ":set noshowcmd" ' .. longName, #{rows: 8})
+ let buf = RunVimInTerminal('-N -u NONE --cmd ":set noshowcmd noruler" ' .. longName, #{rows: 8})
call VerifyScreenDump(buf, 'Test_long_file_name_1', {})
@@ -196,6 +196,23 @@ func Test_edit_long_file_name()
" clean up
call StopVimInTerminal(buf)
+ set ruler&vim
+endfunc
+
+func Test_edit_long_file_name_with_ruler()
+ CheckScreendump
+
+ let longName = 'x'->repeat(min([&columns, 255]))
+ call writefile([], longName, 'D')
+ let buf = RunVimInTerminal('-N -u NONE --cmd ":set noshowcmd" ' .. longName, #{rows: 8})
+
+ call VerifyScreenDump(buf, 'Test_long_file_name_3', {})
+
+ call term_sendkeys(buf, ":set showcmd\<cr>:e!\<cr>")
+ call VerifyScreenDump(buf, 'Test_long_file_name_4', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
endfunc
func Test_unprintable_fileformats()
diff --git a/test/old/testdir/test_registers.vim b/test/old/testdir/test_registers.vim
@@ -170,6 +170,7 @@ func Test_register_one()
endfunc
func Test_recording_status_in_ex_line()
+ set noruler
norm qx
redraw!
call assert_equal('recording @x', Screenline(&lines))
@@ -180,6 +181,17 @@ func Test_recording_status_in_ex_line()
norm q
redraw!
call assert_equal('', Screenline(&lines))
+ set ruler
+ norm qx
+ redraw!
+ call assert_match('recording @x\s*0,0-1\s*All', Screenline(&lines))
+ set shortmess=q
+ redraw!
+ call assert_match('\s*0,0-1\s*All', Screenline(&lines)) " Nvim: shm+=q fully hides
+ set shortmess&
+ norm q
+ redraw!
+ call assert_match('\s*0,0-1\s*All', Screenline(&lines))
endfunc
" Check that replaying a typed sequence does not use an Esc and following
diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim
@@ -954,10 +954,11 @@ func Test_smoothscroll_multi_skipcol()
endfunc
" this was dividing by zero bug in scroll_cursor_bot
-func Test_smoothscroll_zero_width_scroll_cursor_bot()
+func Test_smoothscroll_zero_width_scroll_cursor_bot_noruler()
CheckScreendump
let lines =<< trim END
+ set noruler
silent normal yy
silent normal 19p
set cpoptions+=n
@@ -975,12 +976,34 @@ func Test_smoothscroll_zero_width_scroll_cursor_bot()
call StopVimInTerminal(buf)
endfunc
+func Test_smoothscroll_zero_width_scroll_cursor_bot_ruler()
+ CheckScreendump
+
+ let lines =<< trim END
+ set ruler
+ silent normal yy
+ silent normal 19p
+ set cpoptions+=n
+ vsplit
+ vertical resize 0
+ set foldcolumn=1
+ set number
+ set smoothscroll
+ silent normal 20G
+ END
+ call writefile(lines, 'XSmoothScrollZeroBot', 'D')
+ let buf = RunVimInTerminal('-u NONE -S XSmoothScrollZeroBot', #{rows: 19})
+ call VerifyScreenDump(buf, 'Test_smoothscroll_zero_bot_ruler', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" scroll_cursor_top() should reset skipcol when it changes topline
-func Test_smoothscroll_cursor_top()
+func Test_smoothscroll_cursor_top_noruler()
CheckScreendump
let lines =<< trim END
- set smoothscroll scrolloff=2
+ set smoothscroll scrolloff=2 noruler
new | 11resize | wincmd j
call setline(1, ['line1', 'line2', 'line3'->repeat(20), 'line4'])
exe "norm G3\<C-E>k"
@@ -992,6 +1015,22 @@ func Test_smoothscroll_cursor_top()
call StopVimInTerminal(buf)
endfunc
+func Test_smoothscroll_cursor_top_ruler()
+ CheckScreendump
+
+ let lines =<< trim END
+ set smoothscroll scrolloff=2 ruler
+ new | 11resize | wincmd j
+ call setline(1, ['line1', 'line2', 'line3'->repeat(20), 'line4'])
+ exe "norm G3\<C-E>k"
+ END
+ call writefile(lines, 'XSmoothScrollCursorTop', 'D')
+ let buf = RunVimInTerminal('-u NONE -S XSmoothScrollCursorTop', #{rows: 12, cols: 40})
+ call VerifyScreenDump(buf, 'Test_smoothscroll_cursor_ru_top', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" Division by zero, shouldn't crash
func Test_smoothscroll_crash()
CheckScreendump
@@ -1011,12 +1050,12 @@ func Test_smoothscroll_crash()
call StopVimInTerminal(buf)
endfunc
-func Test_smoothscroll_insert_bottom()
+func Test_smoothscroll_insert_bottom_noruler()
CheckScreendump
let lines =<< trim END
call setline(1, repeat([repeat('A very long line ...', 10)], 5))
- set wrap smoothscroll scrolloff=0
+ set wrap smoothscroll scrolloff=0 noruler
END
call writefile(lines, 'XSmoothScrollInsertBottom', 'D')
let buf = RunVimInTerminal('-u NONE -S XSmoothScrollInsertBottom', #{rows: 9, cols: 40})
@@ -1026,12 +1065,27 @@ func Test_smoothscroll_insert_bottom()
call StopVimInTerminal(buf)
endfunc
-func Test_smoothscroll_in_qf_window()
+func Test_smoothscroll_insert_bottom_ruler()
+ CheckScreendump
+
+ let lines =<< trim END
+ call setline(1, repeat([repeat('A very long line ...', 10)], 5))
+ set wrap smoothscroll scrolloff=0 ruler
+ END
+ call writefile(lines, 'XSmoothScrollInsertBottom', 'D')
+ let buf = RunVimInTerminal('-u NONE -S XSmoothScrollInsertBottom', #{rows: 9, cols: 40})
+ call term_sendkeys(buf, "Go123456789\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_insert_bottom_ruler', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
+func Test_smoothscroll_in_qf_window_noruler()
CheckFeature quickfix
CheckScreendump
let lines =<< trim END
- set nocompatible display=lastline
+ set nocompatible display=lastline noruler
copen 5
setlocal number smoothscroll
let g:l = [{'text': 'foo'}] + repeat([{'text': join(range(30))}], 10)
@@ -1071,6 +1125,51 @@ func Test_smoothscroll_in_qf_window()
call StopVimInTerminal(buf)
endfunc
+func Test_smoothscroll_in_qf_window_ruler()
+ CheckFeature quickfix
+ CheckScreendump
+
+ let lines =<< trim END
+ set nocompatible display=lastline ruler
+ copen 5
+ setlocal number smoothscroll
+ let g:l = [{'text': 'foo'}] + repeat([{'text': join(range(30))}], 10)
+ call setqflist(g:l, 'r')
+ normal! G
+ wincmd t
+ let g:l1 = [{'text': join(range(1000))}]
+ END
+ call writefile(lines, 'XSmoothScrollInQfWindow', 'D')
+ let buf = RunVimInTerminal('-u NONE -S XSmoothScrollInQfWindow', #{rows: 20, cols: 60})
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_ru_1', {})
+
+ call term_sendkeys(buf, ":call setqflist([], 'r')\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_ru_2', {})
+
+ call term_sendkeys(buf, ":call setqflist(g:l, 'r')\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_ru_3', {})
+
+ call term_sendkeys(buf, ":call setqflist(g:l1, 'r')\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_ru_4', {})
+
+ call term_sendkeys(buf, "\<C-W>b$\<C-W>t")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_ru_5', {})
+
+ call term_sendkeys(buf, ":call setqflist([], 'r')\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_ru_2', {})
+
+ call term_sendkeys(buf, ":call setqflist(g:l1, 'r')\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_ru_4', {})
+
+ call term_sendkeys(buf, "\<C-W>b$\<C-W>t")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_ru_5', {})
+
+ call term_sendkeys(buf, ":call setqflist(g:l, 'r')\<CR>")
+ call VerifyScreenDump(buf, 'Test_smoothscroll_in_qf_window_ru_3', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
func Test_smoothscroll_in_zero_width_window()
set cpo+=n number smoothscroll
set winwidth=99999 winminwidth=0
@@ -1218,11 +1317,12 @@ func Test_smoothscroll_long_line_zb()
bwipe!
endfunc
-func Test_smooth_long_scrolloff()
+func Test_smooth_long_scrolloff_noruler()
CheckScreendump
let lines =<< trim END
set smoothscroll scrolloff=3
+ set noruler
call setline(1, ['one', 'two long '->repeat(100), 'three', 'four', 'five', 'six'])
END
call writefile(lines, 'XSmoothLongScrolloff', 'D')
@@ -1251,6 +1351,39 @@ func Test_smooth_long_scrolloff()
call StopVimInTerminal(buf)
endfunc
+func Test_smooth_long_scrolloff_ruler()
+ CheckScreendump
+
+ let lines =<< trim END
+ set smoothscroll scrolloff=3 ruler
+ call setline(1, ['one', 'two long '->repeat(100), 'three', 'four', 'five', 'six'])
+ END
+ call writefile(lines, 'XSmoothLongScrolloff', 'D')
+ let buf = RunVimInTerminal('-u NONE -S XSmoothLongScrolloff', #{rows: 8, cols: 40})
+ call term_sendkeys(buf, ":norm j721|\<CR>")
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_ru_1', {})
+
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_ru_2', {})
+
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_ru_3', {})
+
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_ru_4', {})
+
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_ru_5', {})
+
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_ru_6', {})
+
+ call term_sendkeys(buf, "gk")
+ call VerifyScreenDump(buf, 'Test_smooth_long_scrolloff_ru_7', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
func Test_smoothscroll_listchars_eol()
call NewWindow(10, 40)
setlocal list listchars=eol:$ scrolloff=0 smoothscroll