Skip to content

Commit ad9c2a0

Browse files
committed
patch 7.4.2109
Problem: Setting 'display' to "lastline" is a drastic change, while omitting it results in lots of "@" lines. Solution: Add "truncate" to show "@@@" for a truncated line.
1 parent adfc5c2 commit ad9c2a0

4 files changed

Lines changed: 29 additions & 5 deletions

File tree

runtime/doc/options.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2623,11 +2623,17 @@ A jump table for the options with a short description can be found at |Q_op|.
26232623
Change the way text is displayed. This is comma separated list of
26242624
flags:
26252625
lastline When included, as much as possible of the last line
2626-
in a window will be displayed. When not included, a
2627-
last line that doesn't fit is replaced with "@" lines.
2626+
in a window will be displayed. "@@@" is put in the
2627+
last columns of the last screen line to indicate the
2628+
rest of the line is not displayed.
2629+
truncate Like "lastline", but "@@@" is displayed in the first
2630+
column of the last screen line. Overrules "lastline".
26282631
uhex Show unprintable characters hexadecimal as <xx>
26292632
instead of using ^C and ~C.
26302633

2634+
When neither "lastline" or "truncate" is included, a last line that
2635+
doesn't fit is replaced with "@" lines.
2636+
26312637
*'eadirection'* *'ead'*
26322638
'eadirection' 'ead' string (default "both")
26332639
global

src/option.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,11 @@ EXTERN char_u *p_dir; /* 'directory' */
454454
EXTERN char_u *p_dy; /* 'display' */
455455
EXTERN unsigned dy_flags;
456456
#ifdef IN_OPTION_C
457-
static char *(p_dy_values[]) = {"lastline", "uhex", NULL};
457+
static char *(p_dy_values[]) = {"lastline", "truncate", "uhex", NULL};
458458
#endif
459459
#define DY_LASTLINE 0x001
460-
#define DY_UHEX 0x002
460+
#define DY_TRUNCATE 0x002
461+
#define DY_UHEX 0x004
461462
EXTERN int p_ed; /* 'edcompatible' */
462463
#ifdef FEAT_WINDOWS
463464
EXTERN char_u *p_ead; /* 'eadirection' */

src/screen.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,7 @@ win_update(win_T *wp)
20182018
&& wp->w_lines[idx].wl_valid
20192019
&& wp->w_lines[idx].wl_lnum == lnum
20202020
&& lnum > wp->w_topline
2021-
&& !(dy_flags & DY_LASTLINE)
2021+
&& !(dy_flags & (DY_LASTLINE | DY_TRUNCATE))
20222022
&& srow + wp->w_lines[idx].wl_size > wp->w_height
20232023
#ifdef FEAT_DIFF
20242024
&& diff_check_fill(wp, lnum) == 0
@@ -2139,6 +2139,21 @@ win_update(win_T *wp)
21392139
wp->w_filler_rows = wp->w_height - srow;
21402140
}
21412141
#endif
2142+
else if (dy_flags & DY_TRUNCATE) /* 'display' has "truncate" */
2143+
{
2144+
int scr_row = W_WINROW(wp) + wp->w_height - 1;
2145+
2146+
/*
2147+
* Last line isn't finished: Display "@@@" in the last screen line.
2148+
*/
2149+
screen_puts_len((char_u *)"@@", 2, scr_row, W_WINCOL(wp),
2150+
hl_attr(HLF_AT));
2151+
screen_fill(scr_row, scr_row + 1,
2152+
(int)W_WINCOL(wp) + 2, (int)W_ENDCOL(wp),
2153+
'@', ' ', hl_attr(HLF_AT));
2154+
set_empty_rows(wp, srow);
2155+
wp->w_botline = lnum;
2156+
}
21422157
else if (dy_flags & DY_LASTLINE) /* 'display' has "lastline" */
21432158
{
21442159
/*

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,8 @@ static char *(features[]) =
758758

759759
static int included_patches[] =
760760
{ /* Add new patch number below this line */
761+
/**/
762+
2109,
761763
/**/
762764
2108,
763765
/**/

0 commit comments

Comments
 (0)