Patch 9.0.0519

3 views
Skip to first unread message

Bram Moolenaar

unread,
Sep 20, 2022, 2:00:56 PM9/20/22
to vim...@googlegroups.com

Patch 9.0.0519
Problem: The win_line() function is much too long.
Solution: Move the code to draw the line number to a separate function.
Files: src/drawline.c


*** ../vim-9.0.0518/src/drawline.c 2022-09-20 17:57:31.826990773 +0100
--- src/drawline.c 2022-09-20 18:56:52.670059720 +0100
***************
*** 102,107 ****
--- 102,108 ----

int win_attr; // background for the whole window, except
// margins and "~" lines.
+ int wcr_attr; // attributes from 'wincolor'

int screen_line_flags; // flags for screen_line()

***************
*** 123,131 ****
--- 124,139 ----
int saved_c_final;
int saved_char_attr;

+ char_u extra[21]; // "%ld " and 'fdc' must fit in here
+
#ifdef FEAT_DIFF
hlf_T diff_hlf; // type of diff highlighting
#endif
+ int filler_lines; // nr of filler lines to be drawn
+ int filler_todo; // nr of filler lines still to do + 1
+ #ifdef FEAT_SIGNS
+ sign_attrs_T sattr;
+ #endif
} winlinevars_T;

// draw_state values for items that are drawn in sequence:
***************
*** 171,191 ****
}

/*
! * Get information needed to display the sign in line 'lnum' in window 'wp'.
! * If 'nrcol' is TRUE, the sign is going to be displayed in the number column.
* Otherwise the sign is going to be displayed in the sign column.
*/
static void
get_sign_display_info(
int nrcol,
win_T *wp,
! linenr_T lnum,
! winlinevars_T *wlv,
! sign_attrs_T *sattr,
! int wcr_attr,
! int filler_lines UNUSED,
! int filler_todo UNUSED,
! char_u *extra)
{
int text_sign;
# ifdef FEAT_SIGN_ICONS
--- 179,194 ----
}

/*
! * Get information needed to display the sign in line "wlv->lnum" in window
! * "wp".
! * If "nrcol" is TRUE, the sign is going to be displayed in the number column.
* Otherwise the sign is going to be displayed in the sign column.
*/
static void
get_sign_display_info(
int nrcol,
win_T *wp,
! winlinevars_T *wlv)
{
int text_sign;
# ifdef FEAT_SIGN_ICONS
***************
*** 199,241 ****
wlv->n_extra = number_width(wp) + 1;
else
{
! if (use_cursor_line_sign(wp, lnum))
! wlv->char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLS));
else
! wlv->char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_SC));
wlv->n_extra = 2;
}

if (wlv->row == wlv->startrow
#ifdef FEAT_DIFF
! + filler_lines && filler_todo <= 0
#endif
)
{
! text_sign = (sattr->sat_text != NULL) ? sattr->sat_typenr : 0;
# ifdef FEAT_SIGN_ICONS
! icon_sign = (sattr->sat_icon != NULL) ? sattr->sat_typenr : 0;
if (gui.in_use && icon_sign != 0)
{
// Use the image in this position.
if (nrcol)
{
wlv->c_extra = NUL;
! sprintf((char *)extra, "%-*c ", number_width(wp), SIGN_BYTE);
! wlv->p_extra = extra;
wlv->n_extra = (int)STRLEN(wlv->p_extra);
}
else
wlv->c_extra = SIGN_BYTE;
# ifdef FEAT_NETBEANS_INTG
! if (netbeans_active() && (buf_signcount(wp->w_buffer, lnum) > 1))
{
if (nrcol)
{
wlv->c_extra = NUL;
! sprintf((char *)extra, "%-*c ", number_width(wp),
MULTISIGN_BYTE);
! wlv->p_extra = extra;
wlv->n_extra = (int)STRLEN(wlv->p_extra);
}
else
--- 202,246 ----
wlv->n_extra = number_width(wp) + 1;
else
{
! if (use_cursor_line_sign(wp, wlv->lnum))
! wlv->char_attr = hl_combine_attr(wlv->wcr_attr, HL_ATTR(HLF_CLS));
else
! wlv->char_attr = hl_combine_attr(wlv->wcr_attr, HL_ATTR(HLF_SC));
wlv->n_extra = 2;
}

if (wlv->row == wlv->startrow
#ifdef FEAT_DIFF
! + wlv->filler_lines && wlv->filler_todo <= 0
#endif
)
{
! text_sign = (wlv->sattr.sat_text != NULL) ? wlv->sattr.sat_typenr : 0;
# ifdef FEAT_SIGN_ICONS
! icon_sign = (wlv->sattr.sat_icon != NULL) ? wlv->sattr.sat_typenr : 0;
if (gui.in_use && icon_sign != 0)
{
// Use the image in this position.
if (nrcol)
{
wlv->c_extra = NUL;
! sprintf((char *)wlv->extra, "%-*c ",
! number_width(wp), SIGN_BYTE);
! wlv->p_extra = wlv->extra;
wlv->n_extra = (int)STRLEN(wlv->p_extra);
}
else
wlv->c_extra = SIGN_BYTE;
# ifdef FEAT_NETBEANS_INTG
! if (netbeans_active() && (buf_signcount(wp->w_buffer, wlv->lnum)
! > 1))
{
if (nrcol)
{
wlv->c_extra = NUL;
! sprintf((char *)wlv->extra, "%-*c ", number_width(wp),
MULTISIGN_BYTE);
! wlv->p_extra = wlv->extra;
wlv->n_extra = (int)STRLEN(wlv->p_extra);
}
else
***************
*** 249,255 ****
# endif
if (text_sign != 0)
{
! wlv->p_extra = sattr->sat_text;
if (wlv->p_extra != NULL)
{
if (nrcol)
--- 254,260 ----
# endif
if (text_sign != 0)
{
! wlv->p_extra = wlv->sattr.sat_text;
if (wlv->p_extra != NULL)
{
if (nrcol)
***************
*** 257,282 ****
int n, width = number_width(wp) - 2;

for (n = 0; n < width; n++)
! extra[n] = ' ';
! extra[n] = 0;
! STRCAT(extra, wlv->p_extra);
! STRCAT(extra, " ");
! wlv->p_extra = extra;
}
wlv->c_extra = NUL;
wlv->c_final = NUL;
wlv->n_extra = (int)STRLEN(wlv->p_extra);
}

! if (use_cursor_line_sign(wp, lnum) && sattr->sat_culhl > 0)
! wlv->char_attr = sattr->sat_culhl;
else
! wlv->char_attr = sattr->sat_texthl;
}
}
}
#endif

#if defined(FEAT_PROP_POPUP) || defined(PROTO)
/*
* Return the cell size of virtual text after truncation.
--- 262,396 ----
int n, width = number_width(wp) - 2;

for (n = 0; n < width; n++)
! wlv->extra[n] = ' ';
! wlv->extra[n] = 0;
! STRCAT(wlv->extra, wlv->p_extra);
! STRCAT(wlv->extra, " ");
! wlv->p_extra = wlv->extra;
}
wlv->c_extra = NUL;
wlv->c_final = NUL;
wlv->n_extra = (int)STRLEN(wlv->p_extra);
}

! if (use_cursor_line_sign(wp, wlv->lnum)
! && wlv->sattr.sat_culhl > 0)
! wlv->char_attr = wlv->sattr.sat_culhl;
else
! wlv->char_attr = wlv->sattr.sat_texthl;
}
}
}
#endif

+ /*
+ * Display the absolute or relative line number. After the first row fill with
+ * blanks when the 'n' flag isn't in 'cpo'.
+ */
+ static void
+ handle_lnum_col(
+ win_T *wp,
+ winlinevars_T *wlv,
+ int sign_present UNUSED,
+ int num_attr)
+ {
+ if ((wp->w_p_nu || wp->w_p_rnu)
+ && (wlv->row == wlv->startrow + wlv->filler_lines
+ || vim_strchr(p_cpo, CPO_NUMCOL) == NULL))
+ {
+ #ifdef FEAT_SIGNS
+ // If 'signcolumn' is set to 'number' and a sign is present
+ // in 'lnum', then display the sign instead of the line
+ // number.
+ if ((*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u') && sign_present)
+ get_sign_display_info(TRUE, wp, wlv);
+ else
+ #endif
+ {
+ // Draw the line number (empty space after wrapping).
+ if (wlv->row == wlv->startrow + wlv->filler_lines)
+ {
+ long num;
+ char *fmt = "%*ld ";
+
+ if (wp->w_p_nu && !wp->w_p_rnu)
+ // 'number' + 'norelativenumber'
+ num = (long)wlv->lnum;
+ else
+ {
+ // 'relativenumber', don't use negative numbers
+ num = labs((long)get_cursor_rel_lnum(wp, wlv->lnum));
+ if (num == 0 && wp->w_p_nu && wp->w_p_rnu)
+ {
+ // 'number' + 'relativenumber'
+ num = wlv->lnum;
+ fmt = "%-*ld ";
+ }
+ }
+
+ sprintf((char *)wlv->extra, fmt, number_width(wp), num);
+ if (wp->w_skipcol > 0)
+ for (wlv->p_extra = wlv->extra; *wlv->p_extra == ' ';
+ ++wlv->p_extra)
+ *wlv->p_extra = '-';
+ #ifdef FEAT_RIGHTLEFT
+ if (wp->w_p_rl) // reverse line numbers
+ {
+ char_u *p1, *p2;
+ int t;
+
+ // like rl_mirror(), but keep the space at the end
+ p2 = skipwhite(wlv->extra);
+ p2 = skiptowhite(p2) - 1;
+ for (p1 = skipwhite(wlv->extra); p1 < p2; ++p1, --p2)
+ {
+ t = *p1;
+ *p1 = *p2;
+ *p2 = t;
+ }
+ }
+ #endif
+ wlv->p_extra = wlv->extra;
+ wlv->c_extra = NUL;
+ wlv->c_final = NUL;
+ }
+ else
+ {
+ wlv->c_extra = ' ';
+ wlv->c_final = NUL;
+ }
+ wlv->n_extra = number_width(wp) + 1;
+ wlv->char_attr = hl_combine_attr(wlv->wcr_attr, HL_ATTR(HLF_N));
+ #ifdef FEAT_SYN_HL
+ // When 'cursorline' is set highlight the line number of
+ // the current line differently.
+ // When 'cursorlineopt' does not have "line" only
+ // highlight the line number itself.
+ // TODO: Can we use CursorLine instead of CursorLineNr
+ // when CursorLineNr isn't set?
+ if (wp->w_p_cul
+ && wlv->lnum == wp->w_cursor.lnum
+ && (wp->w_p_culopt_flags & CULOPT_NBR)
+ && (wlv->row == wlv->startrow + wlv->filler_lines
+ || (wlv->row > wlv->startrow + wlv->filler_lines
+ && (wp->w_p_culopt_flags & CULOPT_LINE))))
+ wlv->char_attr = hl_combine_attr(wlv->wcr_attr, HL_ATTR(HLF_CLN));
+ #endif
+ if (wp->w_p_rnu && wlv->lnum < wp->w_cursor.lnum
+ && HL_ATTR(HLF_LNA) != 0)
+ // Use LineNrAbove
+ wlv->char_attr = hl_combine_attr(wlv->wcr_attr, HL_ATTR(HLF_LNA));
+ if (wp->w_p_rnu && wlv->lnum > wp->w_cursor.lnum
+ && HL_ATTR(HLF_LNB) != 0)
+ // Use LineNrBelow
+ wlv->char_attr = hl_combine_attr(wlv->wcr_attr, HL_ATTR(HLF_LNB));
+ }
+ #ifdef FEAT_SIGNS
+ if (num_attr)
+ wlv->char_attr = num_attr;
+ #endif
+ }
+ }
#if defined(FEAT_PROP_POPUP) || defined(PROTO)
/*
* Return the cell size of virtual text after truncation.
***************
*** 613,619 ****
char_u *line; // current line
char_u *ptr; // current position in "line"

- char_u extra[21]; // "%ld " and 'fdc' must fit in here
char_u *p_extra_free = NULL; // p_extra needs to be freed
#ifdef FEAT_PROP_POPUP
char_u *p_extra_free2 = NULL; // another p_extra to be freed
--- 727,732 ----
***************
*** 649,655 ****
// in this line
int vi_attr = 0; // attributes for Visual and incsearch
// highlighting
- int wcr_attr = 0; // attributes from 'wincolor'
int area_attr = 0; // attributes desired by highlighting
int search_attr = 0; // attributes desired by 'hlsearch'
#ifdef FEAT_SYN_HL
--- 762,767 ----
***************
*** 702,713 ****
int mb_c = 0; // decoded multi-byte character
int mb_utf8 = FALSE; // screen char is UTF-8 char
int u8cc[MAX_MCO]; // composing UTF-8 chars
- #if defined(FEAT_DIFF) || defined(FEAT_SIGNS)
- int filler_lines = 0; // nr of filler lines to be drawn
- int filler_todo = 0; // nr of filler lines still to do + 1
- #else
- # define filler_lines 0
- #endif
#ifdef FEAT_DIFF
int change_start = MAXCOL; // first col of changed area
int change_end = -1; // last col of changed area
--- 814,819 ----
***************
*** 729,735 ****
#endif
#ifdef FEAT_SIGNS
int sign_present = FALSE;
- sign_attrs_T sattr;
int num_attr = 0; // attribute for the number column
#endif
#ifdef FEAT_ARABIC
--- 835,840 ----
***************
*** 996,1005 ****
}

#ifdef FEAT_DIFF
! filler_lines = diff_check(wp, lnum);
! if (filler_lines < 0)
{
! if (filler_lines == -1)
{
if (diff_find_change(wp, lnum, &change_start, &change_end))
wlv.diff_hlf = HLF_ADD; // added line
--- 1101,1110 ----
}

#ifdef FEAT_DIFF
! wlv.filler_lines = diff_check(wp, lnum);
! if (wlv.filler_lines < 0)
{
! if (wlv.filler_lines == -1)
{
if (diff_find_change(wp, lnum, &change_start, &change_end))
wlv.diff_hlf = HLF_ADD; // added line
***************
*** 1010,1034 ****
}
else
wlv.diff_hlf = HLF_ADD; // added line
! filler_lines = 0;
area_highlighting = TRUE;
}
if (lnum == wp->w_topline)
! filler_lines = wp->w_topfill;
! filler_todo = filler_lines;
#endif

#ifdef FEAT_SIGNS
! sign_present = buf_get_signattrs(wp, lnum, &sattr);
if (sign_present)
! num_attr = sattr.sat_numhl;
#endif

#ifdef LINE_ATTR
# ifdef FEAT_SIGNS
// If this line has a sign with line highlighting set line_attr.
if (sign_present)
! line_attr = sattr.sat_linehl;
# endif
# if defined(FEAT_QUICKFIX)
// Highlight the current line in the quickfix window.
--- 1115,1139 ----
}
else
wlv.diff_hlf = HLF_ADD; // added line
! wlv.filler_lines = 0;
area_highlighting = TRUE;
}
if (lnum == wp->w_topline)
! wlv.filler_lines = wp->w_topfill;
! wlv.filler_todo = wlv.filler_lines;
#endif

#ifdef FEAT_SIGNS
! sign_present = buf_get_signattrs(wp, lnum, &wlv.sattr);
if (sign_present)
! num_attr = wlv.sattr.sat_numhl;
#endif

#ifdef LINE_ATTR
# ifdef FEAT_SIGNS
// If this line has a sign with line highlighting set line_attr.
if (sign_present)
! line_attr = wlv.sattr.sat_linehl;
# endif
# if defined(FEAT_QUICKFIX)
// Highlight the current line in the quickfix window.
***************
*** 1114,1123 ****
}
}

! wcr_attr = get_wcr_attr(wp);
! if (wcr_attr != 0)
{
! wlv.win_attr = wcr_attr;
area_highlighting = TRUE;
}

--- 1219,1228 ----
}
}

! wlv.wcr_attr = get_wcr_attr(wp);
! if (wlv.wcr_attr != 0)
{
! wlv.win_attr = wlv.wcr_attr;
area_highlighting = TRUE;
}

***************
*** 1286,1294 ****
# ifdef FEAT_SIGNS
// Combine the 'cursorline' and sign highlighting, depending on
// the sign priority.
! if (sign_present && sattr.sat_linehl > 0)
{
! if (sattr.sat_priority >= 100)
line_attr = hl_combine_attr(cul_attr, line_attr);
else
line_attr = hl_combine_attr(line_attr, cul_attr);
--- 1391,1399 ----
# ifdef FEAT_SIGNS
// Combine the 'cursorline' and sign highlighting, depending on
// the sign priority.
! if (sign_present && wlv.sattr.sat_linehl > 0)
{
! if (wlv.sattr.sat_priority >= 100)
line_attr = hl_combine_attr(cul_attr, line_attr);
else
line_attr = hl_combine_attr(line_attr, cul_attr);
***************
*** 1374,1380 ****
wlv.n_extra = 1;
wlv.c_extra = cmdwin_type;
wlv.c_final = NUL;
! wlv.char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_AT));
}
}
#endif
--- 1479,1486 ----
wlv.n_extra = 1;
wlv.c_extra = cmdwin_type;
wlv.c_final = NUL;
! wlv.char_attr =
! hl_combine_attr(wlv.wcr_attr, HL_ATTR(HLF_AT));
}
}
#endif
***************
*** 1387,1394 ****
wlv.draw_state = WL_FOLD;
if (fdc > 0)
{
! // Draw the 'foldcolumn'. Allocate a buffer, "extra" may
! // already be in use.
vim_free(p_extra_free);
p_extra_free = alloc(MAX_MCO * fdc + 1);
if (p_extra_free != NULL)
--- 1493,1500 ----
wlv.draw_state = WL_FOLD;
if (fdc > 0)
{
! // Draw the 'foldcolumn'. Allocate a buffer, "wlv.extra"
! // may already be in use.
vim_free(p_extra_free);
p_extra_free = alloc(MAX_MCO * fdc + 1);
if (p_extra_free != NULL)
***************
*** 1401,1410 ****
wlv.c_final = NUL;
if (use_cursor_line_sign(wp, lnum))
wlv.char_attr =
! hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLF));
else
wlv.char_attr =
! hl_combine_attr(wcr_attr, HL_ATTR(HLF_FC));
}
}
}
--- 1507,1516 ----
wlv.c_final = NUL;
if (use_cursor_line_sign(wp, lnum))
wlv.char_attr =
! hl_combine_attr(wlv.wcr_attr, HL_ATTR(HLF_CLF));
else
wlv.char_attr =
! hl_combine_attr(wlv.wcr_attr, HL_ATTR(HLF_FC));
}
}
}
***************
*** 1413,1534 ****
#ifdef FEAT_SIGNS
if (wlv.draw_state == WL_SIGN - 1 && wlv.n_extra == 0)
{
wlv.draw_state = WL_SIGN;
- // Show the sign column when there are any signs in this
- // buffer or when using Netbeans.
if (signcolumn_on(wp))
! get_sign_display_info(FALSE, wp, lnum, &wlv, &sattr,
! wcr_attr, filler_lines, filler_todo, extra);
}
#endif

if (wlv.draw_state == WL_NR - 1 && wlv.n_extra == 0)
{
wlv.draw_state = WL_NR;
! // Display the absolute or relative line number. After the
! // first fill with blanks when the 'n' flag isn't in 'cpo'
! if ((wp->w_p_nu || wp->w_p_rnu)
! && (wlv.row == startrow + filler_lines
! || vim_strchr(p_cpo, CPO_NUMCOL) == NULL))
! {
! #ifdef FEAT_SIGNS
! // If 'signcolumn' is set to 'number' and a sign is present
! // in 'lnum', then display the sign instead of the line
! // number.
! if ((*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u')
! && sign_present)
! get_sign_display_info(TRUE, wp, lnum, &wlv, &sattr,
! wcr_attr, filler_lines, filler_todo, extra);
! else
! #endif
! {
! // Draw the line number (empty space after wrapping).
! if (wlv.row == startrow + filler_lines)
! {
! long num;
! char *fmt = "%*ld ";
!
! if (wp->w_p_nu && !wp->w_p_rnu)
! // 'number' + 'norelativenumber'
! num = (long)lnum;
! else
! {
! // 'relativenumber', don't use negative numbers
! num = labs((long)get_cursor_rel_lnum(wp, lnum));
! if (num == 0 && wp->w_p_nu && wp->w_p_rnu)
! {
! // 'number' + 'relativenumber'
! num = lnum;
! fmt = "%-*ld ";
! }
! }
!
! sprintf((char *)extra, fmt,
! number_width(wp), num);
! if (wp->w_skipcol > 0)
! for (wlv.p_extra = extra; *wlv.p_extra == ' ';
! ++wlv.p_extra)
! *wlv.p_extra = '-';
! #ifdef FEAT_RIGHTLEFT
! if (wp->w_p_rl) // reverse line numbers
! {
! char_u *p1, *p2;
! int t;
!
! // like rl_mirror(), but keep the space at the end
! p2 = skipwhite(extra);
! p2 = skiptowhite(p2) - 1;
! for (p1 = skipwhite(extra); p1 < p2; ++p1, --p2)
! {
! t = *p1;
! *p1 = *p2;
! *p2 = t;
! }
! }
! #endif
! wlv.p_extra = extra;
! wlv.c_extra = NUL;
! wlv.c_final = NUL;
! }
! else
! {
! wlv.c_extra = ' ';
! wlv.c_final = NUL;
! }
! wlv.n_extra = number_width(wp) + 1;
! wlv.char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_N));
! #ifdef FEAT_SYN_HL
! // When 'cursorline' is set highlight the line number of
! // the current line differently.
! // When 'cursorlineopt' does not have "line" only
! // highlight the line number itself.
! // TODO: Can we use CursorLine instead of CursorLineNr
! // when CursorLineNr isn't set?
! if (wp->w_p_cul
! && lnum == wp->w_cursor.lnum
! && (wp->w_p_culopt_flags & CULOPT_NBR)
! && (wlv.row == startrow + filler_lines
! || (wlv.row > startrow + filler_lines
! && (wp->w_p_culopt_flags & CULOPT_LINE))))
! wlv.char_attr = hl_combine_attr(wcr_attr,
! HL_ATTR(HLF_CLN));
! #endif
! if (wp->w_p_rnu && lnum < wp->w_cursor.lnum
! && HL_ATTR(HLF_LNA) != 0)
! // Use LineNrAbove
! wlv.char_attr = hl_combine_attr(wcr_attr,
! HL_ATTR(HLF_LNA));
! if (wp->w_p_rnu && lnum > wp->w_cursor.lnum
! && HL_ATTR(HLF_LNB) != 0)
! // Use LineNrBelow
! wlv.char_attr = hl_combine_attr(wcr_attr,
! HL_ATTR(HLF_LNB));
! }
! #ifdef FEAT_SIGNS
! if (num_attr)
! wlv.char_attr = num_attr;
! #endif
! }
}

#ifdef FEAT_LINEBREAK
--- 1519,1536 ----
#ifdef FEAT_SIGNS
if (wlv.draw_state == WL_SIGN - 1 && wlv.n_extra == 0)
{
+ // Show the sign column when desired or when using Netbeans.
wlv.draw_state = WL_SIGN;
if (signcolumn_on(wp))
! get_sign_display_info(FALSE, wp, &wlv);
}
#endif

if (wlv.draw_state == WL_NR - 1 && wlv.n_extra == 0)
{
+ // Show the line number, if desired.
wlv.draw_state = WL_NR;
! handle_lnum_col(wp, &wlv, sign_present, num_attr);
}

#ifdef FEAT_LINEBREAK
***************
*** 1549,1555 ****
// if need_showbreak is set, breakindent also applies
if (wp->w_p_bri && (wlv.row != startrow || need_showbreak)
# ifdef FEAT_DIFF
! && filler_lines == 0
# endif
# ifdef FEAT_PROP_POPUP
&& !dont_use_showbreak
--- 1551,1557 ----
// if need_showbreak is set, breakindent also applies
if (wp->w_p_bri && (wlv.row != startrow || need_showbreak)
# ifdef FEAT_DIFF
! && wlv.filler_lines == 0
# endif
# ifdef FEAT_PROP_POPUP
&& !dont_use_showbreak
***************
*** 1589,1595 ****

wlv.draw_state = WL_SBR;
# ifdef FEAT_DIFF
! if (filler_todo > 0)
{
// Draw "deleted" diff line(s).
if (char2cells(wp->w_fill_chars.diff) > 1)
--- 1591,1597 ----

wlv.draw_state = WL_SBR;
# ifdef FEAT_DIFF
! if (wlv.filler_todo > 0)
{
// Draw "deleted" diff line(s).
if (char2cells(wp->w_fill_chars.diff) > 1)
***************
*** 1674,1680 ****
&& lnum == wp->w_cursor.lnum && wlv.vcol >= (long)wp->w_virtcol)
|| (number_only && wlv.draw_state > WL_NR))
#ifdef FEAT_DIFF
! && filler_todo <= 0
#endif
)
{
--- 1676,1682 ----
&& lnum == wp->w_cursor.lnum && wlv.vcol >= (long)wp->w_virtcol)
|| (number_only && wlv.draw_state > WL_NR))
#ifdef FEAT_DIFF
! && wlv.filler_todo <= 0
#endif
)
{
***************
*** 2279,2290 ****
{
// Illegal UTF-8 byte: display as <xx>.
// Non-BMP character : display as ? or fullwidth ?.
! transchar_hex(extra, mb_c);
# ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl) // reverse
! rl_mirror(extra);
# endif
! wlv.p_extra = extra;
c = *wlv.p_extra;
mb_c = mb_ptr2char_adv(&wlv.p_extra);
mb_utf8 = (c >= 0x80);
--- 2281,2292 ----
{
// Illegal UTF-8 byte: display as <xx>.
// Non-BMP character : display as ? or fullwidth ?.
! transchar_hex(wlv.extra, mb_c);
# ifdef FEAT_RIGHTLEFT
if (wp->w_p_rl) // reverse
! rl_mirror(wlv.extra);
# endif
! wlv.p_extra = wlv.extra;
c = *wlv.p_extra;
mb_c = mb_ptr2char_adv(&wlv.p_extra);
mb_utf8 = (c >= 0x80);
***************
*** 2348,2363 ****
{
// head byte at end of line
mb_l = 1;
! transchar_nonprint(wp->w_buffer, extra, c);
}
else
{
// illegal tail byte
mb_l = 2;
! STRCPY(extra, "XX");
}
! wlv.p_extra = extra;
! wlv.n_extra = (int)STRLEN(extra) - 1;
wlv.c_extra = NUL;
wlv.c_final = NUL;
c = *wlv.p_extra++;
--- 2350,2365 ----
{
// head byte at end of line
mb_l = 1;
! transchar_nonprint(wp->w_buffer, wlv.extra, c);
}
else
{
// illegal tail byte
mb_l = 2;
! STRCPY(wlv.extra, "XX");
}
! wlv.p_extra = wlv.extra;
! wlv.n_extra = (int)STRLEN(wlv.extra) - 1;
wlv.c_extra = NUL;
wlv.c_final = NUL;
c = *wlv.p_extra++;
***************
*** 3167,3173 ****
(wp->w_skipcol > 0 && wlv.row == 0) :
wp->w_leftcol > 0)
#ifdef FEAT_DIFF
! && filler_todo <= 0
#endif
&& wlv.draw_state > WL_NR
&& c != NUL)
--- 3169,3175 ----
(wp->w_skipcol > 0 && wlv.row == 0) :
wp->w_leftcol > 0)
#ifdef FEAT_DIFF
! && wlv.filler_todo <= 0
#endif
&& wlv.draw_state > WL_NR
&& c != NUL)
***************
*** 3323,3329 ****
&& wp->w_p_list
&& !wp->w_p_wrap
#ifdef FEAT_DIFF
! && filler_todo <= 0
#endif
&& (
#ifdef FEAT_RIGHTLEFT
--- 3325,3331 ----
&& wp->w_p_list
&& !wp->w_p_wrap
#ifdef FEAT_DIFF
! && wlv.filler_todo <= 0
#endif
&& (
#ifdef FEAT_RIGHTLEFT
***************
*** 3367,3373 ****
&& search_attr == 0
&& area_attr == 0)
# ifdef FEAT_DIFF
! && filler_todo <= 0
# endif
)
{
--- 3369,3375 ----
&& search_attr == 0
&& area_attr == 0)
# ifdef FEAT_DIFF
! && wlv.filler_todo <= 0
# endif
)
{
***************
*** 3449,3455 ****
ScreenLines[wlv.off] = mb_c & 0xff;
if (wlv.draw_state > WL_NR
#ifdef FEAT_DIFF
! && filler_todo <= 0
#endif
)
++wlv.vcol;
--- 3451,3457 ----
ScreenLines[wlv.off] = mb_c & 0xff;
if (wlv.draw_state > WL_NR
#ifdef FEAT_DIFF
! && wlv.filler_todo <= 0
#endif
)
++wlv.vcol;
***************
*** 3571,3577 ****
// 'relativenumber' column.
if (wlv.draw_state > WL_NR
#ifdef FEAT_DIFF
! && filler_todo <= 0
#endif
)
++wlv.vcol;
--- 3573,3579 ----
// 'relativenumber' column.
if (wlv.draw_state > WL_NR
#ifdef FEAT_DIFF
! && wlv.filler_todo <= 0
#endif
)
++wlv.vcol;
***************
*** 3602,3608 ****
&& (wlv.draw_state != WL_LINE
|| *ptr != NUL
#ifdef FEAT_DIFF
! || filler_todo > 0
#endif
#ifdef FEAT_PROP_POPUP
|| text_prop_above || text_prop_follows
--- 3604,3610 ----
&& (wlv.draw_state != WL_LINE
|| *ptr != NUL
#ifdef FEAT_DIFF
! || wlv.filler_todo > 0
#endif
#ifdef FEAT_PROP_POPUP
|| text_prop_above || text_prop_follows
***************
*** 3629,3635 ****
// '$' and highlighting until last column, break here.
if ((!wp->w_p_wrap
#ifdef FEAT_DIFF
! && filler_todo <= 0
#endif
#ifdef FEAT_PROP_POPUP
&& !text_prop_above && !text_prop_follows
--- 3631,3637 ----
// '$' and highlighting until last column, break here.
if ((!wp->w_p_wrap
#ifdef FEAT_DIFF
! && wlv.filler_todo <= 0
#endif
#ifdef FEAT_PROP_POPUP
&& !text_prop_above && !text_prop_follows
***************
*** 3650,3656 ****
// When the window is too narrow draw all "@" lines.
if (wlv.draw_state != WL_LINE
#ifdef FEAT_DIFF
! && filler_todo <= 0
#endif
)
{
--- 3652,3658 ----
// When the window is too narrow draw all "@" lines.
if (wlv.draw_state != WL_LINE
#ifdef FEAT_DIFF
! && wlv.filler_todo <= 0
#endif
)
{
***************
*** 3668,3674 ****

if (screen_cur_row == wlv.screen_row - 1
#ifdef FEAT_DIFF
! && filler_todo <= 0
#endif
#ifdef FEAT_PROP_POPUP
&& !text_prop_above && !text_prop_follows
--- 3670,3676 ----

if (screen_cur_row == wlv.screen_row - 1
#ifdef FEAT_DIFF
! && wlv.filler_todo <= 0
#endif
#ifdef FEAT_PROP_POPUP
&& !text_prop_above && !text_prop_follows
***************
*** 3731,3746 ****
#ifdef FEAT_LINEBREAK
if (!dont_use_showbreak
# ifdef FEAT_DIFF
! && filler_todo <= 0
# endif
)
need_showbreak = TRUE;
#endif
#ifdef FEAT_DIFF
! --filler_todo;
// When the filler lines are actually below the last line of the
// file, don't draw the line itself, break here.
! if (filler_todo == 0 && wp->w_botfill)
break;
#endif
}
--- 3733,3748 ----
#ifdef FEAT_LINEBREAK
if (!dont_use_showbreak
# ifdef FEAT_DIFF
! && wlv.filler_todo <= 0
# endif
)
need_showbreak = TRUE;
#endif
#ifdef FEAT_DIFF
! --wlv.filler_todo;
// When the filler lines are actually below the last line of the
// file, don't draw the line itself, break here.
! if (wlv.filler_todo == 0 && wp->w_botfill)
break;
#endif
}
*** ../vim-9.0.0518/src/version.c 2022-09-20 17:57:31.826990773 +0100
--- src/version.c 2022-09-20 18:58:14.953814975 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 519,
/**/

--
Corduroy pillows: They're making headlines!

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages