Patch 9.0.0656
Problem: Cannot specify another character to use instead of '@' at the end
of the window.
Solution: Add "lastline" to 'fillchars'. (Martin Tournoij, closes #11264,
closes #10963)
Files: runtime/doc/options.txt, src/drawscreen.c, src/optiondefs.h,
src/screen.c, src/structs.h, src/testdir/test_display.vim,
src/testdir/dumps/Test_display_lastline_1.dump,
src/testdir/dumps/Test_display_lastline_2.dump,
src/testdir/dumps/Test_display_lastline_3.dump,
src/testdir/dumps/Test_display_lastline_4.dump,
src/testdir/dumps/Test_display_lastline_5.dump,
src/testdir/dumps/Test_display_lastline_euro_1.dump,
src/testdir/dumps/Test_display_lastline_euro_2.dump,
src/testdir/dumps/Test_display_lastline_euro_3.dump,
src/testdir/dumps/Test_display_lastline_euro_4.dump,
src/testdir/dumps/Test_display_lastline_euro_5.dump
*** ../vim-9.0.0655/runtime/doc/options.txt 2022-10-03 15:27:30.062072077
+0100
--- runtime/doc/options.txt 2022-10-04 14:27:38.710295008 +0100
***************
*** 2915,2921 ****
'display' 'dy' string (default "", set to "truncate" in
|defaults.vim|)
global
! Change the way text is displayed. This is comma-separated list of
flags:
lastline When included, as much as possible of the last line
in a window will be displayed. "@@@" is put in the
--- 2942,2948 ----
'display' 'dy' string (default "", set to "truncate" in
|defaults.vim|)
global
! Change the way text is displayed. This is a comma-separated list of
flags:
lastline When included, as much as possible of the last line
in a window will be displayed. "@@@" is put in the
***************
*** 2929,2934 ****
--- 2956,2964 ----
When neither "lastline" nor "truncate" is included, a last line that
doesn't fit is replaced with "@" lines.
+ The "@" character can be changed by setting the "lastline" item in
+ 'fillchars'. The character is highlighted with |hl-NonText|.
+
*'eadirection'* *'ead'*
'eadirection' 'ead' string (default "both")
global
***************
*** 3393,3398 ****
--- 3423,3429 ----
foldsep '|' open fold middle character
diff '-' deleted lines of the 'diff' option
eob '~' empty lines below the end of a buffer
+ lastline '@' 'display' contains lastline/truncate
Any one that is omitted will fall back to the default. For "stl" and
"stlnc" the space will be used when there is highlighting, '^' or '='
***************
*** 3415,3420 ****
--- 3446,3452 ----
fold Folded |hl-Folded|
diff DiffDelete |hl-DiffDelete|
eob EndOfBuffer |hl-EndOfBuffer|
+ lastline NonText |hl-NonText|
*'fixendofline'* *'fixeol'* *'nofixendofline'* *'nofixeol'*
'fixendofline' 'fixeol' boolean (default on)
*** ../vim-9.0.0655/src/drawscreen.c 2022-10-03 20:00:49.396319098 +0100
--- src/drawscreen.c 2022-10-04 14:01:11.719484492 +0100
***************
*** 2643,2675 ****
#endif
else if (dy_flags & DY_TRUNCATE) // 'display' has "truncate"
{
! int scr_row = W_WINROW(wp) + wp->w_height - 1;
// Last line isn't finished: Display "@@@" in the last screen line.
! screen_puts_len((char_u *)"@@", wp->w_width > 2 ? 2 : wp->w_width,
! scr_row, wp->w_wincol, HL_ATTR(HLF_AT));
screen_fill(scr_row, scr_row + 1,
(int)wp->w_wincol + 2, (int)W_ENDCOL(wp),
! '@', ' ', HL_ATTR(HLF_AT));
set_empty_rows(wp, srow);
wp->w_botline = lnum;
}
else if (dy_flags & DY_LASTLINE) // 'display' has "lastline"
{
int start_col = (int)W_ENDCOL(wp) - 3;
// Last line isn't finished: Display "@@@" at the end.
screen_fill(W_WINROW(wp) + wp->w_height - 1,
W_WINROW(wp) + wp->w_height,
start_col < wp->w_wincol ? wp->w_wincol : start_col,
(int)W_ENDCOL(wp),
! '@', '@', HL_ATTR(HLF_AT));
set_empty_rows(wp, srow);
wp->w_botline = lnum;
}
else
{
! win_draw_end(wp, '@', ' ', TRUE, srow, wp->w_height, HLF_AT);
wp->w_botline = lnum;
}
}
--- 2643,2684 ----
#endif
else if (dy_flags & DY_TRUNCATE) // 'display' has "truncate"
{
! int scr_row = W_WINROW(wp) + wp->w_height - 1;
! int symbol = wp->w_fill_chars.lastline;
! int len;
! char_u fillbuf[12]; // 2 characters of 6 bytes
!
! len = mb_char2bytes(symbol, &fillbuf[0]);
! len += mb_char2bytes(symbol, &fillbuf[len]);
// Last line isn't finished: Display "@@@" in the last screen line.
! screen_puts_len(fillbuf,
! wp->w_width > 2 ? len : wp->w_width,
! scr_row, wp->w_wincol, HL_ATTR(HLF_AT));
screen_fill(scr_row, scr_row + 1,
(int)wp->w_wincol + 2, (int)W_ENDCOL(wp),
! symbol, ' ', HL_ATTR(HLF_AT));
set_empty_rows(wp, srow);
wp->w_botline = lnum;
}
else if (dy_flags & DY_LASTLINE) // 'display' has "lastline"
{
int start_col = (int)W_ENDCOL(wp) - 3;
+ int symbol = wp->w_fill_chars.lastline;
// Last line isn't finished: Display "@@@" at the end.
screen_fill(W_WINROW(wp) + wp->w_height - 1,
W_WINROW(wp) + wp->w_height,
start_col < wp->w_wincol ? wp->w_wincol : start_col,
(int)W_ENDCOL(wp),
! symbol, symbol, HL_ATTR(HLF_AT));
set_empty_rows(wp, srow);
wp->w_botline = lnum;
}
else
{
! win_draw_end(wp, wp->w_fill_chars.lastline, ' ', TRUE,
! srow, wp->w_height, HLF_AT);
wp->w_botline = lnum;
}
}
*** ../vim-9.0.0655/src/optiondefs.h 2022-10-03 15:27:30.066072111 +0100
--- src/optiondefs.h 2022-10-04 14:02:06.215312926 +0100
***************
*** 936,942 ****
SCTX_INIT},
{"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_ONECOMMA|P_NODUP,
(char_u *)&p_fcs, PV_FCS,
! {(char_u *)"vert:|,fold:-,eob:~", (char_u *)0L}
SCTX_INIT},
{"fixendofline", "fixeol", P_BOOL|P_VI_DEF|P_RSTAT,
(char_u *)&p_fixeol, PV_FIXEOL,
--- 936,943 ----
SCTX_INIT},
{"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_ONECOMMA|P_NODUP,
(char_u *)&p_fcs, PV_FCS,
! {(char_u *)"vert:|,fold:-,eob:~,lastline:@",
! (char_u *)0L}
SCTX_INIT},
{"fixendofline", "fixeol", P_BOOL|P_VI_DEF|P_RSTAT,
(char_u *)&p_fixeol, PV_FIXEOL,
*** ../vim-9.0.0655/src/screen.c 2022-10-02 15:18:30.537076003 +0100
--- src/screen.c 2022-10-04 13:50:09.629661647 +0100
***************
*** 2511,2517 ****
else
force_next = FALSE;
}
! #endif
ScreenLines[off] = c;
if (enc_utf8)
{
--- 2511,2517 ----
else
force_next = FALSE;
}
! #endif // FEAT_GUI || defined(UNIX)
ScreenLines[off] = c;
if (enc_utf8)
{
***************
*** 4943,4948 ****
--- 4943,4949 ----
{&fill_chars.foldsep, "foldsep"},
{&fill_chars.diff, "diff"},
{&fill_chars.eob, "eob"},
+ {&fill_chars.lastline, "lastline"},
};
static lcs_chars_T lcs_chars;
***************
*** 5022,5027 ****
--- 5023,5029 ----
fill_chars.foldsep = '|';
fill_chars.diff = '-';
fill_chars.eob = '~';
+ fill_chars.lastline = '@';
}
}
p = value;
*** ../vim-9.0.0655/src/structs.h 2022-10-03 15:27:30.066072111 +0100
--- src/structs.h 2022-10-04 13:50:09.633661632 +0100
***************
*** 3519,3524 ****
--- 3519,3525 ----
int foldsep;
int diff;
int eob;
+ int lastline;
} fill_chars_T;
/*
*** ../vim-9.0.0655/src/testdir/test_display.vim 2022-10-03
17:07:29.993542954 +0100
--- src/testdir/test_display.vim 2022-10-04 14:31:38.265540605 +0100
***************
*** 391,420 ****
let &breakat=_breakat
endfunc
! func Test_display_lastline()
! CheckScreendump
!
let lines =<< trim END
! call setline(1, ['aaa', 'b'->repeat(100)])
set display=truncate
vsplit
100wincmd <
END
call writefile(lines, 'XdispLastline', 'D')
let buf = RunVimInTerminal('-S XdispLastline', #{rows: 10})
! call VerifyScreenDump(buf, 'Test_display_lastline_1', {})
call term_sendkeys(buf, ":set display=lastline\<CR>")
! call VerifyScreenDump(buf, 'Test_display_lastline_2', {})
call term_sendkeys(buf, ":100wincmd >\<CR>")
! call VerifyScreenDump(buf, 'Test_display_lastline_3', {})
call term_sendkeys(buf, ":set display=truncate\<CR>")
! call VerifyScreenDump(buf, 'Test_display_lastline_4', {})
call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab
--- 391,436 ----
let &breakat=_breakat
endfunc
! func Run_Test_display_lastline(euro)
let lines =<< trim END
! call setline(1, ['aaa', 'b'->repeat(200)])
set display=truncate
+
vsplit
100wincmd <
END
+ 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_{a:euro}1', {})
call term_sendkeys(buf, ":set display=lastline\<CR>")
! call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}2', {})
call term_sendkeys(buf, ":100wincmd >\<CR>")
! call VerifyScreenDump(buf, $'Test_display_lastline_{a:euro}3', {})
call term_sendkeys(buf, ":set display=truncate\<CR>")
! 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)
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
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.0655/src/testdir/dumps/Test_display_lastline_1.dump
2022-04-09 12:33:44.000000000 +0100
--- src/testdir/dumps/Test_display_lastline_1.dump 2022-10-04
14:25:05.958779518 +0100
***************
*** 1,10 ****
>a+0&#ffffff0||+1&&|a+0&&@2| @69
|a||+1&&|b+0&&@72
! |a||+1&&|b+0&&@26| @45
|b||+1&&|~+0#4040ff13&| @71
|b+0#0000000&||+1&&|~+0#4040ff13&| @71
|b+0#0000000&||+1&&|~+0#4040ff13&| @71
- |b+0#0000000&||+1&&|~+0#4040ff13&| @71
|@||+1#0000000&|~+0#4040ff13&| @71
|<+3#0000000&| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @41|1|,|1| @11|A|l@1
| +0&&@74
--- 1,10 ----
>a+0&#ffffff0||+1&&|a+0&&@2| @69
|a||+1&&|b+0&&@72
! |a||+1&&|b+0&&@72
! @1||+1&&|b+0&&@53| @18
|b||+1&&|~+0#4040ff13&| @71
|b+0#0000000&||+1&&|~+0#4040ff13&| @71
|b+0#0000000&||+1&&|~+0#4040ff13&| @71
|@||+1#0000000&|~+0#4040ff13&| @71
|<+3#0000000&| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @41|1|,|1| @11|A|l@1
| +0&&@74
*** ../vim-9.0.0655/src/testdir/dumps/Test_display_lastline_2.dump
2022-04-09 12:33:45.000000000 +0100
--- src/testdir/dumps/Test_display_lastline_2.dump 2022-10-04
14:25:07.026776117 +0100
***************
*** 1,10 ****
>a+0&#ffffff0||+1&&|a+0&&@2| @69
|a||+1&&|b+0&&@72
! |a||+1&&|b+0&&@26| @45
|b||+1&&|~+0#4040ff13&| @71
|b+0#0000000&||+1&&|~+0#4040ff13&| @71
|b+0#0000000&||+1&&|~+0#4040ff13&| @71
- |b+0#0000000&||+1&&|~+0#4040ff13&| @71
|@||+1#0000000&|~+0#4040ff13&| @71
|<+3#0000000&| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @41|1|,|1| @11|A|l@1
|:+0&&|s|e|t| |d|i|s|p|l|a|y|=|l|a|s|t|l|i|n|e| @53
--- 1,10 ----
>a+0&#ffffff0||+1&&|a+0&&@2| @69
|a||+1&&|b+0&&@72
! |a||+1&&|b+0&&@72
! @1||+1&&|b+0&&@53| @18
|b||+1&&|~+0#4040ff13&| @71
|b+0#0000000&||+1&&|~+0#4040ff13&| @71
|b+0#0000000&||+1&&|~+0#4040ff13&| @71
|@||+1#0000000&|~+0#4040ff13&| @71
|<+3#0000000&| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @41|1|,|1| @11|A|l@1
|:+0&&|s|e|t| |d|i|s|p|l|a|y|=|l|a|s|t|l|i|n|e| @53
*** ../vim-9.0.0655/src/testdir/dumps/Test_display_lastline_3.dump
2022-04-09 12:33:46.000000000 +0100
--- src/testdir/dumps/Test_display_lastline_3.dump 2022-10-04
14:25:08.090772731 +0100
***************
*** 1,7 ****
>a+0&#ffffff0@2| @69||+1&&|a+0&&
|b@72||+1&&|a+0&&
! |b@26| @45||+1&&|a+0&&
! |~+0#4040ff13&| @71||+1#0000000&|b+0&&
|~+0#4040ff13&| @71||+1#0000000&|b+0&&
|~+0#4040ff13&| @71||+1#0000000&|b+0&&
|~+0#4040ff13&| @71||+1#0000000&|b+0&&
--- 1,7 ----
>a+0&#ffffff0@2| @69||+1&&|a+0&&
|b@72||+1&&|a+0&&
! |b@72||+1&&|a+0&&
! |b@53| @18||+1&&|b+0&&
|~+0#4040ff13&| @71||+1#0000000&|b+0&&
|~+0#4040ff13&| @71||+1#0000000&|b+0&&
|~+0#4040ff13&| @71||+1#0000000&|b+0&&
*** ../vim-9.0.0655/src/testdir/dumps/Test_display_lastline_4.dump
2022-04-09 12:33:48.000000000 +0100
--- src/testdir/dumps/Test_display_lastline_4.dump 2022-10-04
14:25:09.158769332 +0100
***************
*** 1,7 ****
>a+0&#ffffff0@2| @69||+1&&|a+0&&
|b@72||+1&&|a+0&&
! |b@26| @45||+1&&|a+0&&
! |~+0#4040ff13&| @71||+1#0000000&|b+0&&
|~+0#4040ff13&| @71||+1#0000000&|b+0&&
|~+0#4040ff13&| @71||+1#0000000&|b+0&&
|~+0#4040ff13&| @71||+1#0000000&|b+0&&
--- 1,7 ----
>a+0&#ffffff0@2| @69||+1&&|a+0&&
|b@72||+1&&|a+0&&
! |b@72||+1&&|a+0&&
! |b@53| @18||+1&&|b+0&&
|~+0#4040ff13&| @71||+1#0000000&|b+0&&
|~+0#4040ff13&| @71||+1#0000000&|b+0&&
|~+0#4040ff13&| @71||+1#0000000&|b+0&&
*** ../vim-9.0.0655/src/testdir/dumps/Test_display_lastline_5.dump
2022-10-04 14:32:36.049359410 +0100
--- src/testdir/dumps/Test_display_lastline_5.dump 2022-10-04
14:25:10.222765948 +0100
***************
*** 0 ****
--- 1,10 ----
+ >a+0&#ffffff0@2| @71
+ |b@74
+ |@+0#4040ff13&@2| @71
+ |[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @43|1|,|1| @11|T|o|p
+ |a+0&&@2| @71
+ |b@74
+ @75
+ @50| @24
+ |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @43|1|,|1| @11|A|l@1
+ |:+0&&|3|s|p|l|i|t| @67
*** ../vim-9.0.0655/src/testdir/dumps/Test_display_lastline_euro_1.dump
2022-10-04 14:32:36.053359398 +0100
--- src/testdir/dumps/Test_display_lastline_euro_1.dump 2022-10-04
14:25:11.582761623 +0100
***************
*** 0 ****
--- 1,10 ----
+ >a+0&#ffffff0||+1&&|a+0&&@2| @69
+ |a||+1&&|b+0&&@72
+ |a||+1&&|b+0&&@72
+ @1||+1&&|b+0&&@53| @18
+ |b||+1&&|~+0#4040ff13&| @71
+ |b+0#0000000&||+1&&|~+0#4040ff13&| @71
+ |b+0#0000000&||+1&&|~+0#4040ff13&| @71
+ |€||+1#0000000&|~+0#4040ff13&| @71
+ |<+3#0000000&| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @41|1|,|1| @11|A|l@1
+ | +0&&@74
*** ../vim-9.0.0655/src/testdir/dumps/Test_display_lastline_euro_2.dump
2022-10-04 14:32:36.057359386 +0100
--- src/testdir/dumps/Test_display_lastline_euro_2.dump 2022-10-04
14:25:12.738757945 +0100
***************
*** 0 ****
--- 1,10 ----
+ >a+0&#ffffff0||+1&&|a+0&&@2| @69
+ |a||+1&&|b+0&&@72
+ |a||+1&&|b+0&&@72
+ @1||+1&&|b+0&&@53| @18
+ |b||+1&&|~+0#4040ff13&| @71
+ |b+0#0000000&||+1&&|~+0#4040ff13&| @71
+ |b+0#0000000&||+1&&|~+0#4040ff13&| @71
+ |€||+1#0000000&|~+0#4040ff13&| @71
+ |<+3#0000000&| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @41|1|,|1| @11|A|l@1
+ |:+0&&|s|e|t| |d|i|s|p|l|a|y|=|l|a|s|t|l|i|n|e| @53
*** ../vim-9.0.0655/src/testdir/dumps/Test_display_lastline_euro_3.dump
2022-10-04 14:32:36.061359373 +0100
--- src/testdir/dumps/Test_display_lastline_euro_3.dump 2022-10-04
14:25:13.894754269 +0100
***************
*** 0 ****
--- 1,10 ----
+ >a+0&#ffffff0@2| @69||+1&&|a+0&&
+ |b@72||+1&&|a+0&&
+ |b@72||+1&&|a+0&&
+ |b@53| @18||+1&&|b+0&&
+ |~+0#4040ff13&| @71||+1#0000000&|b+0&&
+ |~+0#4040ff13&| @71||+1#0000000&|b+0&&
+ |~+0#4040ff13&| @71||+1#0000000&|b+0&&
+ |~+0#4040ff13&| @71||+1#0000000&|€+0#4040ff13&
+ |[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @41|1|,|1| @11|A|l@1| |<+1&&
+ |:+0&&|1|0@1|w|i|n|c|m|d| |>| @62
*** ../vim-9.0.0655/src/testdir/dumps/Test_display_lastline_euro_4.dump
2022-10-04 14:32:36.065359361 +0100
--- src/testdir/dumps/Test_display_lastline_euro_4.dump 2022-10-04
14:25:15.050750588 +0100
***************
*** 0 ****
--- 1,10 ----
+ >a+0&#ffffff0@2| @69||+1&&|a+0&&
+ |b@72||+1&&|a+0&&
+ |b@72||+1&&|a+0&&
+ |b@53| @18||+1&&|b+0&&
+ |~+0#4040ff13&| @71||+1#0000000&|b+0&&
+ |~+0#4040ff13&| @71||+1#0000000&|b+0&&
+ |~+0#4040ff13&| @71||+1#0000000&|b+0&&
+ |~+0#4040ff13&| @71||+1#0000000&|€+0#4040ff13&
+ |[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @41|1|,|1| @11|A|l@1| |<+1&&
+ |:+0&&|s|e|t| |d|i|s|p|l|a|y|=|t|r|u|n|c|a|t|e| @53
*** ../vim-9.0.0655/src/testdir/dumps/Test_display_lastline_euro_5.dump
2022-10-04 14:32:36.073359334 +0100
--- src/testdir/dumps/Test_display_lastline_euro_5.dump 2022-10-04
14:25:16.202746924 +0100
***************
*** 0 ****
--- 1,10 ----
+ >a+0&#ffffff0@2| @71
+ |b@74
+ |€+0#4040ff13&@2| @71
+ |[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @43|1|,|1| @11|T|o|p
+ |a+0&&@2| @71
+ |b@74
+ @75
+ @50| @24
+ |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @43|1|,|1| @11|A|l@1
+ |:+0&&|3|s|p|l|i|t| @67
*** ../vim-9.0.0655/src/version.c 2022-10-04 13:17:27.496307898 +0100
--- src/version.c 2022-10-04 14:32:43.929334711 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 656,
/**/
--
ARTHUR: This new learning amazes me, Sir Bedevere. Explain again how sheep's
bladders may be employed to prevent earthquakes.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20221004133708.970991C09A3%40moolenaar.net.