0
0
mirror of https://github.com/vim/vim.git synced 2025-10-02 05:04:20 -04:00

patch 8.1.1072: extending sign and foldcolumn below the text is confusing

Problem:    Extending sign and foldcolumn below the text is confusing.
Solution:   Let the sign and foldcolumn stop at the last text line, just like
            the line number column.  Also stop the command line window leader.
            (Christian Brabandt, closes #3964)
This commit is contained in:
Bram Moolenaar
2019-03-29 18:08:18 +01:00
parent 2912abb3a2
commit 8ee4c01b8c
29 changed files with 381 additions and 395 deletions

View File

@@ -123,7 +123,7 @@ static schar_T *current_ScreenLine;
static void win_update(win_T *wp);
static void win_redr_status(win_T *wp, int ignore_pum);
static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T hl);
static void win_draw_end(win_T *wp, int c1, int c2, int draw_margin, int row, int endrow, hlf_T hl);
#ifdef FEAT_FOLDING
static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T lnum, int row);
static void fill_foldcolumn(char_u *p, win_T *wp, int closed, linenr_T lnum);
@@ -2217,7 +2217,7 @@ win_update(win_T *wp)
}
else
{
win_draw_end(wp, '@', ' ', srow, wp->w_height, HLF_AT);
win_draw_end(wp, '@', ' ', TRUE, srow, wp->w_height, HLF_AT);
wp->w_botline = lnum;
}
}
@@ -2231,16 +2231,14 @@ win_update(win_T *wp)
j = diff_check_fill(wp, wp->w_botline);
if (j > 0 && !wp->w_botfill)
{
/*
* Display filler lines at the end of the file
*/
// Display filler lines at the end of the file.
if (char2cells(fill_diff) > 1)
i = '-';
else
i = fill_diff;
if (row + j > wp->w_height)
j = wp->w_height - row;
win_draw_end(wp, i, i, row, row + (int)j, HLF_DED);
win_draw_end(wp, i, i, TRUE, row, row + (int)j, HLF_DED);
row += j;
}
#endif
@@ -2248,9 +2246,9 @@ win_update(win_T *wp)
else if (dollar_vcol == -1)
wp->w_botline = lnum;
/* make sure the rest of the screen is blank */
/* put '~'s on rows that aren't part of the file. */
win_draw_end(wp, '~', ' ', row, wp->w_height, HLF_EOB);
// Make sure the rest of the screen is blank
// put '~'s on rows that aren't part of the file.
win_draw_end(wp, '~', ' ', FALSE, row, wp->w_height, HLF_EOB);
}
#ifdef SYN_TIME_LIMIT
@@ -2305,113 +2303,97 @@ win_update(win_T *wp)
}
/*
* Clear the rest of the window and mark the unused lines with "c1". use "c2"
* as the filler character.
* Call screen_fill() with the columns adjusted for 'rightleft' if needed.
* Return the new offset.
*/
static int
screen_fill_end(
win_T *wp,
int c1,
int c2,
int off,
int width,
int row,
int endrow,
int attr)
{
int nn = off + width;
if (nn > wp->w_width)
nn = wp->w_width;
#ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
{
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_ENDCOL(wp) - nn, (int)W_ENDCOL(wp) - off,
c1, c2, attr);
}
else
#endif
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
wp->w_wincol + off, (int)wp->w_wincol + nn,
c1, c2, attr);
return nn;
}
/*
* Clear lines near the end the window and mark the unused lines with "c1".
* use "c2" as the filler character.
* When "draw_margin" is TRUE then draw the sign, fold and number columns.
*/
static void
win_draw_end(
win_T *wp,
int c1,
int c2,
int draw_margin,
int row,
int endrow,
hlf_T hl)
{
#if defined(FEAT_FOLDING) || defined(FEAT_SIGNS) || defined(FEAT_CMDWIN)
int n = 0;
# define FDC_OFF n
#else
# define FDC_OFF 0
#endif
if (draw_margin)
{
#ifdef FEAT_FOLDING
int fdc = compute_foldcolumn(wp, 0);
int fdc = compute_foldcolumn(wp, 0);
if (fdc > 0)
// draw the fold column
n = screen_fill_end(wp, ' ', ' ', n, fdc,
row, endrow, HL_ATTR(HLF_FC));
#endif
#ifdef FEAT_SIGNS
if (signcolumn_on(wp))
// draw the sign column
n = screen_fill_end(wp, ' ', ' ', n, 2,
row, endrow, HL_ATTR(HLF_SC));
#endif
if ((wp->w_p_nu || wp->w_p_rnu)
&& vim_strchr(p_cpo, CPO_NUMCOL) == NULL)
// draw the number column
n = screen_fill_end(wp, ' ', ' ', n, number_width(wp) + 1,
row, endrow, HL_ATTR(HLF_N));
}
#ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl)
{
/* No check for cmdline window: should never be right-left. */
# ifdef FEAT_FOLDING
n = fdc;
if (n > 0)
{
/* draw the fold column at the right */
if (n > wp->w_width)
n = wp->w_width;
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_ENDCOL(wp) - n, (int)W_ENDCOL(wp),
' ', ' ', HL_ATTR(HLF_FC));
}
# endif
# ifdef FEAT_SIGNS
if (signcolumn_on(wp))
{
int nn = n + 2;
/* draw the sign column left of the fold column */
if (nn > wp->w_width)
nn = wp->w_width;
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_ENDCOL(wp) - nn, (int)W_ENDCOL(wp) - n,
' ', ' ', HL_ATTR(HLF_SC));
n = nn;
}
# endif
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
wp->w_wincol, W_ENDCOL(wp) - 1 - FDC_OFF,
wp->w_wincol, W_ENDCOL(wp) - 1 - n,
c2, c2, HL_ATTR(hl));
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
W_ENDCOL(wp) - 1 - FDC_OFF, W_ENDCOL(wp) - FDC_OFF,
W_ENDCOL(wp) - 1 - n, W_ENDCOL(wp) - n,
c1, c2, HL_ATTR(hl));
}
else
#endif
{
#ifdef FEAT_CMDWIN
if (cmdwin_type != 0 && wp == curwin)
{
/* draw the cmdline character in the leftmost column */
n = 1;
if (n > wp->w_width)
n = wp->w_width;
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
wp->w_wincol, (int)wp->w_wincol + n,
cmdwin_type, ' ', HL_ATTR(HLF_AT));
}
#endif
#ifdef FEAT_FOLDING
if (fdc > 0)
{
int nn = n + fdc;
/* draw the fold column at the left */
if (nn > wp->w_width)
nn = wp->w_width;
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
wp->w_wincol + n, (int)wp->w_wincol + nn,
' ', ' ', HL_ATTR(HLF_FC));
n = nn;
}
#endif
#ifdef FEAT_SIGNS
if (signcolumn_on(wp))
{
int nn = n + 2;
/* draw the sign column after the fold column */
if (nn > wp->w_width)
nn = wp->w_width;
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
wp->w_wincol + n, (int)wp->w_wincol + nn,
' ', ' ', HL_ATTR(HLF_SC));
n = nn;
}
#endif
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
wp->w_wincol + FDC_OFF, (int)W_ENDCOL(wp),
wp->w_wincol + n, (int)W_ENDCOL(wp),
c1, c2, HL_ATTR(hl));
}
set_empty_rows(wp, row);
}
@@ -5885,7 +5867,7 @@ win_line(
#endif
)
{
win_draw_end(wp, '@', ' ', row, wp->w_height, HLF_AT);
win_draw_end(wp, '@', ' ', TRUE, row, wp->w_height, HLF_AT);
draw_vsep_win(wp, row);
row = endrow;
}