diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-10-04 21:52:01 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-10-05 06:59:05 +0800 |
commit | ddc363dce9020bce7d5bd931929f0d11cc87ad6d (patch) | |
tree | 3874a940d7445f173e02164ddd5c1fb288dde29c /src | |
parent | 6abb48105135ce3ae7eda22334f8104c5ddf20ce (diff) | |
download | rneovim-ddc363dce9020bce7d5bd931929f0d11cc87ad6d.tar.gz rneovim-ddc363dce9020bce7d5bd931929f0d11cc87ad6d.tar.bz2 rneovim-ddc363dce9020bce7d5bd931929f0d11cc87ad6d.zip |
vim-patch:9.0.0656: cannot specify another character to use instead of '@'
Problem: Cannot specify another character to use instead of '@' at the end
of the window.
Solution: Add "lastline" to 'fillchars'. (Martin Tournoij, closes vim/vim#11264,
closes vim/vim#10963)
https://github.com/vim/vim/commit/4ba5f1dab656103e8f4a4505452d1816b9e83c1e
Use latest code in drawscreen.c instead.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/buffer_defs.h | 1 | ||||
-rw-r--r-- | src/nvim/drawscreen.c | 15 | ||||
-rw-r--r-- | src/nvim/screen.c | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_display.vim | 35 |
4 files changed, 36 insertions, 16 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index 1212dffcec..5850763bcb 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -1168,6 +1168,7 @@ struct window_S { int diff; int msgsep; int eob; + int lastline; } w_p_fcs_chars; // "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index e2bf3ed60d..8c18bf75e5 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -1921,24 +1921,27 @@ win_update_start: wp->w_filler_rows = wp->w_grid.rows - srow; } else if (dy_flags & DY_TRUNCATE) { // 'display' has "truncate" int scr_row = wp->w_grid.rows - 1; + int symbol = wp->w_p_fcs_chars.lastline; + char fillbuf[12]; // 2 characters of 6 bytes + int charlen = utf_char2bytes(symbol, &fillbuf[0]); + utf_char2bytes(symbol, &fillbuf[charlen]); // Last line isn't finished: Display "@@@" in the last screen line. - grid_puts_len(&wp->w_grid, "@@", MIN(wp->w_grid.cols, 2), scr_row, 0, at_attr); - - grid_fill(&wp->w_grid, scr_row, scr_row + 1, 2, wp->w_grid.cols, - '@', ' ', at_attr); + grid_puts_len(&wp->w_grid, fillbuf, MIN(wp->w_grid.cols, 2) * charlen, scr_row, 0, at_attr); + grid_fill(&wp->w_grid, scr_row, scr_row + 1, 2, wp->w_grid.cols, symbol, ' ', at_attr); set_empty_rows(wp, srow); wp->w_botline = lnum; } else if (dy_flags & DY_LASTLINE) { // 'display' has "lastline" int start_col = wp->w_grid.cols - 3; + int symbol = wp->w_p_fcs_chars.lastline; // Last line isn't finished: Display "@@@" at the end. grid_fill(&wp->w_grid, wp->w_grid.rows - 1, wp->w_grid.rows, - MAX(start_col, 0), wp->w_grid.cols, '@', '@', at_attr); + MAX(start_col, 0), wp->w_grid.cols, symbol, symbol, at_attr); set_empty_rows(wp, srow); wp->w_botline = lnum; } else { - win_draw_end(wp, '@', ' ', true, srow, wp->w_grid.rows, HLF_AT); + win_draw_end(wp, wp->w_p_fcs_chars.lastline, ' ', true, srow, wp->w_grid.rows, HLF_AT); set_empty_rows(wp, srow); wp->w_botline = lnum; } diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 1af93f061c..bc440441e1 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1328,6 +1328,7 @@ char *set_chars_option(win_T *wp, char **varp, bool apply) { &wp->w_p_fcs_chars.diff, "diff", '-' }, { &wp->w_p_fcs_chars.msgsep, "msgsep", ' ' }, { &wp->w_p_fcs_chars.eob, "eob", '~' }, + { &wp->w_p_fcs_chars.lastline, "lastline", '@' }, }; struct chars_tab lcs_tab[] = { diff --git a/src/nvim/testdir/test_display.vim b/src/nvim/testdir/test_display.vim index 217bb5d781..0962429f71 100644 --- a/src/nvim/testdir/test_display.vim +++ b/src/nvim/testdir/test_display.vim @@ -407,30 +407,45 @@ func Test_display_linebreak_breakat() let &breakat=_breakat endfunc -func Test_display_lastline() - CheckScreendump - +func Run_Test_display_lastline(euro) let lines =<< trim END - call setline(1, ['aaa', 'b'->repeat(100)]) + call setline(1, ['aaa', 'b'->repeat(200)]) set display=truncate + vsplit 100wincmd < END - call writefile(lines, 'XdispLastline') + if a:euro != '' + let lines[2] = 'set fillchars=vert:\|,lastline:€' + endif + call writefile(lines, 'XdispLastline', 'D') let buf = RunVimInTerminal('-S XdispLastline', #{rows: 10}) - call VerifyScreenDump(buf, 'Test_display_lastline_1', {}) + call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}1', {}) call term_sendkeys(buf, ":set display=lastline\<CR>") - call VerifyScreenDump(buf, 'Test_display_lastline_2', {}) + call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}2', {}) call term_sendkeys(buf, ":100wincmd >\<CR>") - call VerifyScreenDump(buf, 'Test_display_lastline_3', {}) + call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}3', {}) call term_sendkeys(buf, ":set display=truncate\<CR>") - call VerifyScreenDump(buf, 'Test_display_lastline_4', {}) + call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}4', {}) + + call term_sendkeys(buf, ":close\<CR>") + call term_sendkeys(buf, ":3split\<CR>") + call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}5', {}) call StopVimInTerminal(buf) - call delete('XdispLastline') +endfunc + +func Test_display_lastline() + CheckScreendump + + call Run_Test_display_lastline('') + call Run_Test_display_lastline('euro_') + + call assert_fails(':set fillchars=lastline:', 'E474:') + call assert_fails(':set fillchars=lastline:〇', 'E474:') endfunc |