summaryrefslogtreecommitdiffstats
path: root/src/screen.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-05 21:10:38 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-05 21:10:38 +0100
commit63d9e730f726341bf41ee4f4b829253cb9879110 (patch)
tree02d6ed210385b78f06d7df1e30ede7d48f718600 /src/screen.c
parent0f8737355d291679659579a48db1861b88970293 (diff)
patch 8.1.2394: using old C style commentsv8.1.2394
Problem: Using old C style comments. Solution: Use // comments where appropriate.
Diffstat (limited to 'src/screen.c')
-rw-r--r--src/screen.c575
1 files changed, 287 insertions, 288 deletions
diff --git a/src/screen.c b/src/screen.c
index 17b1ff2192..795e749ff6 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -53,7 +53,7 @@ static void win_rest_invalid(win_T *wp);
static void msg_pos_mode(void);
static void recording_mode(int attr);
-/* Ugly global: overrule attribute used by screen_char() */
+// Ugly global: overrule attribute used by screen_char()
static int screen_char_attr = 0;
#if defined(FEAT_CONCEAL) || defined(PROTO)
@@ -90,8 +90,8 @@ conceal_check_cursor_line(void)
if (curwin->w_p_cole > 0 && conceal_cursor_line(curwin))
{
need_cursor_line_redraw = TRUE;
- /* Need to recompute cursor column, e.g., when starting Visual mode
- * without concealing. */
+ // Need to recompute cursor column, e.g., when starting Visual mode
+ // without concealing.
curs_columns(TRUE);
}
}
@@ -244,8 +244,8 @@ compute_foldcolumn(win_T *wp, int col)
fill_foldcolumn(
char_u *p,
win_T *wp,
- int closed, /* TRUE of FALSE */
- linenr_T lnum) /* current line number */
+ int closed, // TRUE of FALSE
+ linenr_T lnum) // current line number
{
int i = 0;
int level;
@@ -253,17 +253,17 @@ fill_foldcolumn(
int empty;
int fdc = compute_foldcolumn(wp, 0);
- /* Init to all spaces. */
+ // Init to all spaces.
vim_memset(p, ' ', (size_t)fdc);
level = win_foldinfo.fi_level;
if (level > 0)
{
- /* If there is only one column put more info in it. */
+ // If there is only one column put more info in it.
empty = (fdc == 1) ? 0 : 1;
- /* If the column is too narrow, we start at the lowest level that
- * fits and use numbers to indicated the depth. */
+ // If the column is too narrow, we start at the lowest level that
+ // fits and use numbers to indicated the depth.
first_level = level - fdc - closed + 1 + empty;
if (first_level < 1)
first_level = 1;
@@ -286,7 +286,7 @@ fill_foldcolumn(
if (closed)
p[i >= fdc ? i - 1 : i] = '+';
}
-#endif /* FEAT_FOLDING */
+#endif // FEAT_FOLDING
/*
* Return if the composing characters at "off_from" and "off_to" differ.
@@ -409,19 +409,19 @@ screen_line(
unsigned max_off_to;
int col = 0;
int hl;
- int force = FALSE; /* force update rest of the line */
- int redraw_this /* bool: does character need redraw? */
+ int force = FALSE; // force update rest of the line
+ int redraw_this // bool: does character need redraw?
#ifdef FEAT_GUI
- = TRUE /* For GUI when while-loop empty */
+ = TRUE // For GUI when while-loop empty
#endif
;
- int redraw_next; /* redraw_this for next character */
+ int redraw_next; // redraw_this for next character
int clear_next = FALSE;
- int char_cells; /* 1: normal char */
- /* 2: occupies two display cells */
+ int char_cells; // 1: normal char
+ // 2: occupies two display cells
# define CHAR_CELLS char_cells
- /* Check for illegal row and col, just in case. */
+ // Check for illegal row and col, just in case.
if (row >= Rows)
row = Rows - 1;
if (endcol > Columns)
@@ -439,7 +439,7 @@ screen_line(
#ifdef FEAT_RIGHTLEFT
if (flags & SLF_RIGHTLEFT)
{
- /* Clear rest first, because it's left of the text. */
+ // Clear rest first, because it's left of the text.
if (clear_width > 0)
{
while (col <= endcol && ScreenLines[off_to] == ' '
@@ -458,7 +458,7 @@ screen_line(
off_from += col;
endcol = (clear_width > 0 ? clear_width : -clear_width);
}
-#endif /* FEAT_RIGHTLEFT */
+#endif // FEAT_RIGHTLEFT
#ifdef FEAT_PROP_POPUP
// First char of a popup window may go on top of the right half of a
@@ -486,10 +486,9 @@ screen_line(
off_to + CHAR_CELLS, endcol - col - CHAR_CELLS);
#ifdef FEAT_GUI
- /* If the next character was bold, then redraw the current character to
- * remove any pixels that might have spilt over into us. This only
- * happens in the GUI.
- */
+ // If the next character was bold, then redraw the current character to
+ // remove any pixels that might have spilt over into us. This only
+ // happens in the GUI.
if (redraw_next && gui.in_use)
{
hl = ScreenAttrs[off_to + CHAR_CELLS];
@@ -529,10 +528,10 @@ screen_line(
* Need to remove highlighting attributes here.
*/
windgoto(row, col + coloff);
- out_str(T_CE); /* clear rest of this screen line */
- screen_start(); /* don't know where cursor is now */
- force = TRUE; /* force redraw of rest of the line */
- redraw_next = TRUE; /* or else next char would miss out */
+ out_str(T_CE); // clear rest of this screen line
+ screen_start(); // don't know where cursor is now
+ force = TRUE; // force redraw of rest of the line
+ redraw_next = TRUE; // or else next char would miss out
/*
* If the previous character was highlighted, need to stop
@@ -545,20 +544,20 @@ screen_line(
screen_stop_highlight();
}
else
- screen_attr = 0; /* highlighting has stopped */
+ screen_attr = 0; // highlighting has stopped
}
if (enc_dbcs != 0)
{
- /* Check if overwriting a double-byte with a single-byte or
- * the other way around requires another character to be
- * redrawn. For UTF-8 this isn't needed, because comparing
- * ScreenLinesUC[] is sufficient. */
+ // Check if overwriting a double-byte with a single-byte or
+ // the other way around requires another character to be
+ // redrawn. For UTF-8 this isn't needed, because comparing
+ // ScreenLinesUC[] is sufficient.
if (char_cells == 1
&& col + 1 < endcol
&& (*mb_off2cells)(off_to, max_off_to) > 1)
{
- /* Writing a single-cell character over a double-cell
- * character: need to redraw the next cell. */
+ // Writing a single-cell character over a double-cell
+ // character: need to redraw the next cell.
ScreenLines[off_to + 1] = 0;
redraw_next = TRUE;
}
@@ -567,9 +566,9 @@ screen_line(
&& (*mb_off2cells)(off_to, max_off_to) == 1
&& (*mb_off2cells)(off_to + 1, max_off_to) > 1)
{
- /* Writing the second half of a double-cell character over
- * a double-cell character: need to redraw the second
- * cell. */
+ // Writing the second half of a double-cell character over
+ // a double-cell character: need to redraw the second
+ // cell.
ScreenLines[off_to + 2] = 0;
redraw_next = TRUE;
}
@@ -577,11 +576,11 @@ screen_line(
if (enc_dbcs == DBCS_JPNU)
ScreenLines2[off_to] = ScreenLines2[off_from];
}
- /* When writing a single-width character over a double-width
- * character and at the end of the redrawn text, need to clear out
- * the right halve of the old character.
- * Also required when writing the right halve of a double-width
- * char over the left halve of an existing one. */
+ // When writing a single-width character over a double-width
+ // character and at the end of the redrawn text, need to clear out
+ // the right halve of the old character.
+ // Also required when writing the right halve of a double-width
+ // char over the left halve of an existing one.
if (has_mbyte && col + char_cells == endcol
&& ((char_cells == 1
&& (*mb_off2cells)(off_to, max_off_to) > 1)
@@ -606,10 +605,10 @@ screen_line(
ScreenLines[off_to + 1] = ScreenLines[off_from + 1];
#if defined(FEAT_GUI) || defined(UNIX)
- /* The bold trick makes a single column of pixels appear in the
- * next character. When a bold character is removed, the next
- * character should be redrawn too. This happens for our own GUI
- * and for some xterms. */
+ // The bold trick makes a single column of pixels appear in the
+ // next character. When a bold character is removed, the next
+ // character should be redrawn too. This happens for our own GUI
+ // and for some xterms.
if (
# ifdef FEAT_GUI
gui.in_use
@@ -631,8 +630,8 @@ screen_line(
#endif
ScreenAttrs[off_to] = ScreenAttrs[off_from];
- /* For simplicity set the attributes of second half of a
- * double-wide character equal to the first half. */
+ // For simplicity set the attributes of second half of a
+ // double-wide character equal to the first half.
if (char_cells == 2)
ScreenAttrs[off_to + 1] = ScreenAttrs[off_from];
@@ -666,8 +665,8 @@ screen_line(
if (clear_next)
{
- /* Clear the second half of a double-wide character of which the left
- * half was overwritten with a single-wide character. */
+ // Clear the second half of a double-wide character of which the left
+ // half was overwritten with a single-wide character.
ScreenLines[off_to] = ' ';
if (enc_utf8)
ScreenLinesUC[off_to] = 0;
@@ -684,7 +683,7 @@ screen_line(
int startCol = col;
#endif
- /* blank out the rest of the line */
+ // blank out the rest of the line
while (col < clear_width && ScreenLines[off_to] == ' '
&& ScreenAttrs[off_to] == 0
&& (!enc_utf8 || ScreenLinesUC[off_to] == 0))
@@ -710,13 +709,13 @@ screen_line(
int prev_cells = 1;
if (enc_utf8)
- /* for utf-8, ScreenLines[char_offset + 1] == 0 means
- * that its width is 2. */
+ // for utf-8, ScreenLines[char_offset + 1] == 0 means
+ // that its width is 2.
prev_cells = ScreenLines[off_to - 1] == 0 ? 2 : 1;
else if (enc_dbcs != 0)
{
- /* find previous character by counting from first
- * column and get its width. */
+ // find previous character by counting from first
+ // column and get its width.
unsigned off = LineOffset[row];
unsigned max_off = LineOffset[row] + screen_Columns;
@@ -817,7 +816,7 @@ draw_vsep_win(win_T *wp, int row)
if (wp->w_vsep_width)
{
- /* draw the vertical separator right of this window */
+ // draw the vertical separator right of this window
c = fillchar_vsep(&hl);
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height,
W_ENDCOL(wp), W_ENDCOL(wp) + 1,
@@ -840,7 +839,7 @@ status_match_len(expand_T *xp, char_u *s)
int emenu = (xp->xp_context == EXPAND_MENUS
|| xp->xp_context == EXPAND_MENUNAMES);
- /* Check for menu separators - replace with '|'. */
+ // Check for menu separators - replace with '|'.
if (emenu && menu_is_separator(s))
return 1;
#endif
@@ -890,7 +889,7 @@ skip_status_match_char(expand_T *xp, char_u *s)
win_redr_status_matches(
expand_T *xp,
int num_matches,
- char_u **matches, /* list of matches */
+ char_u **matches, // list of matches
int match,
int showtail)
{
@@ -898,7 +897,7 @@ win_redr_status_matches(
int row;
char_u *buf;
int len;
- int clen; /* length in screen cells */
+ int clen; // length in screen cells
int fillchar;
int attr;
int i;
@@ -914,7 +913,7 @@ win_redr_status_matches(
#endif
int l;
- if (matches == NULL) /* interrupted completion? */
+ if (matches == NULL) // interrupted completion?
return;
if (has_mbyte)
@@ -924,33 +923,33 @@ win_redr_status_matches(
if (buf == NULL)
return;
- if (match == -1) /* don't show match but original text */
+ if (match == -1) // don't show match but original text
{
match = 0;
highlight = FALSE;
}
- /* count 1 for the ending ">" */
+ // count 1 for the ending ">"
clen = status_match_len(xp, L_MATCH(match)) + 3;
if (match == 0)
first_match = 0;
else if (match < first_match)
{
- /* jumping left, as far as we can go */
+ // jumping left, as far as we can go
first_match = match;
add_left = TRUE;
}
else
{
- /* check if match fits on the screen */
+ // check if match fits on the screen
for (i = first_match; i < match; ++i)
clen += status_match_len(xp, L_MATCH(i)) + 2;
if (first_match > 0)
clen += 2;
- /* jumping right, put match at the left */
+ // jumping right, put match at the left
if ((long)clen > Columns)
{
first_match = match;
- /* if showing the last match, we can add some on the left */
+ // if showing the last match, we can add some on the left
clen = 2;
for (i = match; i < num_matches; ++i)
{
@@ -995,7 +994,7 @@ win_redr_status_matches(
}
s = L_MATCH(i);
- /* Check for menu separators - replace with '|' */
+ // Check for menu separators - replace with '|'
#ifdef FEAT_MENU
emenu = (xp->xp_context == EXPAND_MENUS
|| xp->xp_context == EXPAND_MENUNAMES);
@@ -1049,8 +1048,8 @@ win_redr_status_matches(
{
if (msg_scrolled > 0)
{
- /* Put the wildmenu just above the command line. If there is
- * no room, scroll the screen one line up. */
+ // Put the wildmenu just above the command line. If there is
+ // no room, scroll the screen one line up.
if (cmdline_row == Rows - 1)
{
screen_del_lines(0, 0, 1, (int)Rows, TRUE, 0, NULL);
@@ -1065,9 +1064,9 @@ win_redr_status_matches(
}
else
{
- /* Create status line if needed by setting 'laststatus' to 2.
- * Set 'winminheight' to zero to avoid that the window is
- * resized. */
+ // Create status line if needed by setting 'laststatus' to 2.
+ // Set 'winminheight' to zero to avoid that the window is
+ // resized.
if (lastwin->w_status_height == 0)
{
save_p_ls = p_ls;
@@ -1130,9 +1129,9 @@ stl_connected(win_T *wp)
int
get_keymap_str(
win_T *wp,
- char_u *fmt, /* format string containing one %s item */
- char_u *buf, /* buffer for the result */
- int len) /* length of buffer */
+ char_u *fmt, // format string containing one %s item
+ char_u *buf, // buffer for the result
+ int len) // length of buffer
{
char_u *p;
@@ -1147,7 +1146,7 @@ get_keymap_str(
curbuf = wp->w_buffer;
curwin = wp;
- STRCPY(buf, "b:keymap_name"); /* must be writable */
+ STRCPY(buf, "b:keymap_name"); // must be writable
++emsg_skip;
s = p = eval_to_string(buf, NULL, FALSE);
--emsg_skip;
@@ -1516,7 +1515,7 @@ screen_puts_len(
&& *ptr != NUL)
{
c = *ptr;
- /* check if this is the first byte of a multibyte */
+ // check if this is the first byte of a multibyte
if (has_mbyte)
{
if (enc_utf8 && len > 0)
@@ -1527,7 +1526,7 @@ screen_puts_len(
mbyte_cells = 1;
else if (enc_dbcs != 0)
mbyte_cells = mbyte_blen;
- else /* enc_utf8 */
+ else // enc_utf8
{
if (len >= 0)
u8c = utfc_ptr2char_len(ptr, u8cc,
@@ -1538,10 +1537,10 @@ screen_puts_len(
#ifdef FEAT_ARABIC
if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c))
{
- /* Do Arabic shaping. */
+ // Do Arabic shaping.
if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len)
{
- /* Past end of string to be displayed. */
+ // Past end of string to be displayed.
nc = NUL;
nc1 = NUL;
}
@@ -1560,8 +1559,8 @@ screen_puts_len(
#endif
if (col + mbyte_cells > screen_Columns)
{
- /* Only 1 cell left, but character requires 2 cells:
- * display a '>' in the last column to avoid wrapping. */
+ // Only 1 cell left, but character requires 2 cells:
+ // display a '>' in the last column to avoid wrapping.
c = '>';
mbyte_cells = 1;
}
@@ -1592,10 +1591,10 @@ screen_puts_len(
)
{
#if defined(FEAT_GUI) || defined(UNIX)
- /* The bold trick makes a single row of pixels appear in the next
- * character. When a bold character is removed, the next
- * character should be redrawn too. This happens for our own GUI
- * and for some xterms. */
+ // The bold trick makes a single row of pixels appear in the next
+ // character. When a bold character is removed, the next
+ // character should be redrawn too. This happens for our own GUI
+ // and for some xterms.
if (need_redraw && ScreenLines[off] != ' ' && (
# ifdef FEAT_GUI
gui.in_use
@@ -1616,11 +1615,11 @@ screen_puts_len(
force_redraw_next = TRUE;
}
#endif
- /* When at the end of the text and overwriting a two-cell
- * character with a one-cell character, need to clear the next
- * cell. Also when overwriting the left halve of a two-cell char
- * with the right halve of a two-cell char. Do this only once
- * (mb_off2cells() may return 2 on the right halve). */
+ // When at the end of the text and overwriting a two-cell
+ // character with a one-cell character, need to clear the next
+ // cell. Also when overwriting the left halve of a two-cell char
+ // with the right halve of a two-cell char. Do this only once
+ // (mb_off2cells() may return 2 on the right halve).
if (clear_next_cell)
clear_next_cell = FALSE;
else if (has_mbyte
@@ -1632,8 +1631,8 @@ screen_puts_len(
&& (*mb_off2cells)(off + 1, max_off) > 1)))
clear_next_cell = TRUE;
- /* Make sure we never leave a second byte of a double-byte behind,
- * it confuses mb_off2cells(). */
+ // Make sure we never leave a second byte of a double-byte behind,
+ // it confuses mb_off2cells().
if (enc_dbcs
&& ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1)
|| (mbyte_cells == 2
@@ -1686,7 +1685,7 @@ screen_puts_len(
ptr += mbyte_blen;
if (clear_next_cell)
{
- /* This only happens at the end, display one space next. */
+ // This only happens at the end, display one space next.
ptr = (char_u *)" ";
len = -1;
}
@@ -1699,8 +1698,8 @@ screen_puts_len(
}
}
- /* If we detected the next character needs to be redrawn, but the text
- * doesn't extend up to there, update the character here. */
+ // If we detected the next character needs to be redrawn, but the text
+ // doesn't extend up to there, update the character here.
if (force_redraw_next && col < screen_Columns)
{
if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1)
@@ -1722,7 +1721,7 @@ start_search_hl(void)
last_pat_prog(&screen_search_hl.rm);
screen_search_hl.attr = HL_ATTR(HLF_L);
# ifdef FEAT_RELTIME
- /* Set the time limit to 'redrawtime'. */
+ // Set the time limit to 'redrawtime'.
profile_setlimit(p_rdt, &screen_search_hl.tm);
# endif
}
@@ -1759,20 +1758,20 @@ screen_start_highlight(int attr)
{
char buf[20];
- /* The GUI handles this internally. */
+ // The GUI handles this internally.
sprintf(buf, IF_EB("\033|%dh", ESC_STR "|%dh"), attr);
OUT_STR(buf);
}
else
#endif
{
- if (attr > HL_ALL) /* special HL attr. */
+ if (attr > HL_ALL) // special HL attr.
{
if (IS_CTERM)
aep = syn_cterm_attr2entry(attr);
else
aep = syn_term_attr2entry(attr);
- if (aep == NULL) /* did ":syntax clear" */
+ if (aep == NULL) // did ":syntax clear"
attr = 0;
else
attr = aep->ae_attr;
@@ -1804,7 +1803,7 @@ screen_start_highlight(int attr)
}
}
#endif
- if ((attr & HL_BOLD) && *T_MD != NUL) /* bold */
+ if ((attr & HL_BOLD) && *T_MD != NUL) // bold
out_str(T_MD);
else if (aep != NULL && cterm_normal_fg_bold && (
#ifdef FEAT_TERMGUICOLORS
@@ -1813,22 +1812,22 @@ screen_start_highlight(int attr)
:
#endif
t_colors > 1 && aep->ae_u.cterm.fg_color))
- /* If the Normal FG color has BOLD attribute and the new HL
- * has a FG color defined, clear BOLD. */
+ // If the Normal FG color has BOLD attribute and the new HL
+ // has a FG color defined, clear BOLD.
out_str(T_ME);
- if ((attr & HL_STANDOUT) && *T_SO != NUL) /* standout */
+ if ((attr & HL_STANDOUT) && *T_SO != NUL) // standout
out_str(T_SO);
- if ((attr & HL_UNDERCURL) && *T_UCS != NUL) /* undercurl */
+ if ((attr & HL_UNDERCURL) && *T_UCS != NUL) // undercurl
out_str(T_UCS);
- if (((attr & HL_UNDERLINE) /* underline or undercurl */
+ if (((attr & HL_UNDERLINE) // underline or undercurl
|| ((attr & HL_UNDERCURL) && *T_UCS == NUL))
&& *T_US != NUL)
out_str(T_US);
- if ((attr & HL_ITALIC) && *T_CZH != NUL) /* italic */
+ if ((attr & HL_ITALIC) && *T_CZH != NUL) // italic
out_str(T_CZH);
- if ((attr & HL_INVERSE) && *T_MR != NUL) /* inverse (reverse) */
+ if ((attr & HL_INVERSE) && *T_MR != NUL) // inverse (reverse)
out_str(T_MR);
- if ((attr & HL_STRIKETHROUGH) && *T_STS != NUL) /* strike */
+ if ((attr & HL_STRIKETHROUGH) && *T_STS != NUL) // strike
out_str(T_STS);
/*
@@ -1838,9 +1837,9 @@ screen_start_highlight(int attr)
if (aep != NULL)
{
#ifdef FEAT_TERMGUICOLORS
- /* When 'termguicolors' is set but fg or bg is unset,
- * fall back to the cterm colors. This helps for SpellBad,
- * where the GUI uses a red undercurl. */
+ // When 'termguicolors' is set but fg or bg is unset,
+ // fall back to the cterm colors. This helps for SpellBad,
+ // where the GUI uses a red undercurl.
if (p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR)
{
if (aep->ae_u.cterm.fg_rgb != INVALCOLOR)
@@ -1880,7 +1879,7 @@ screen_start_highlight(int attr)
void
screen_stop_highlight(void)
{
- int do_ME = FALSE; /* output T_ME code */
+ int do_ME = FALSE; // output T_ME code
if (screen_attr != 0
#ifdef MSWIN
@@ -1893,14 +1892,14 @@ screen_stop_highlight(void)
{
char buf[20];
- /* use internal GUI code */
+ // use internal GUI code
sprintf(buf, IF_EB("\033|%dH", ESC_STR "|%dH"), screen_attr);
OUT_STR(buf);
}
else
#endif
{
- if (screen_attr > HL_ALL) /* special HL attr. */
+ if (screen_attr > HL_ALL) // special HL attr.
{
attrentry_T *aep;
@@ -1936,7 +1935,7 @@ screen_stop_highlight(void)
out_str(aep->ae_u.term.stop);
}
}
- if (aep == NULL) /* did ":syntax clear" */
+ if (aep == NULL) // did ":syntax clear"
screen_attr = 0;
else
screen_attr = aep->ae_attr;
@@ -1998,7 +1997,7 @@ screen_stop_highlight(void)
{
if (t_colors > 1)
{
- /* set Normal cterm colors */
+ // set Normal cterm colors
if (cterm_normal_fg_color != 0)
term_fg_color(cterm_normal_fg_color - 1);
if (cterm_normal_bg_color != 0)
@@ -2021,7 +2020,7 @@ reset_cterm_colors(void)
{
if (IS_CTERM)
{
- /* set Normal cterm colors */
+ // set Normal cterm colors
#ifdef FEAT_TERMGUICOLORS
if (p_tgc ? (cterm_normal_fg_gui_color != INVALCOLOR
|| cterm_normal_bg_gui_color != INVALCOLOR)
@@ -2050,8 +2049,8 @@ screen_char(unsigned off, int row, int col)
{
int attr;
- /* Check for illegal values, just in case (could happen just after
- * resizing). */
+ // Check for illegal values, just in case (could happen just after
+ // resizing).
if (row >= screen_Rows || col >= screen_Columns)
return;
@@ -2068,13 +2067,13 @@ screen_char(unsigned off, int row, int col)
return;
#endif
- /* Outputting a character in the last cell on the screen may scroll the
- * screen up. Only do it when the "xn" termcap property is set, otherwise
- * mark the character invalid (update it when scrolled up). */
+ // Outputting a character in the last cell on the screen may scroll the
+ // screen up. Only do it when the "xn" termcap property is set, otherwise
+ // mark the character invalid (update it when scrolled up).
if (*T_XN == NUL
&& row == screen_Rows - 1 && col == screen_Columns - 1
#ifdef FEAT_RIGHTLEFT
- /* account for first command-line character in rightleft mode */
+ // account for first command-line character in rightleft mode
&& !cmdmsg_rl
#endif
)
@@ -2110,19 +2109,19 @@ screen_char(unsigned off, int row, int col)
#endif
)
{
- /* Clear the two screen cells. If the character is actually
- * single width it won't change the second cell. */
+ // Clear the two screen cells. If the character is actually
+ // single width it won't change the second cell.
out_str((char_u *)" ");
term_windgoto(row, col);
}
- /* not sure where the cursor is after drawing the ambiguous width
- * character */
+ // not sure where the cursor is after drawing the ambiguous width
+ // character
screen_cur_col = 9999;
}
else if (utf_char2cells(ScreenLinesUC[off]) > 1)
++screen_cur_col;
- /* Convert the UTF-8 character to bytes and write it. */
+ // Convert the UTF-8 character to bytes and write it.
buf[utfc_char2bytes(off, buf)] = NUL;
out_str(buf);
}
@@ -2130,7 +2129,7 @@ screen_char(unsigned off, int row, int col)
{
out_flush_check();
out_char(ScreenLines[off]);
- /* double-byte character in single-width cell */
+ // double-byte character in single-width cell
if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e)
out_char(ScreenLines2[off]);
}
@@ -2147,20 +2146,20 @@ screen_char(unsigned off, int row, int col)
static void
screen_char_2(unsigned off, int row, int col)
{
- /* Check for illegal values (could be wrong when screen was resized). */
+ // Check for illegal values (could be wrong when screen was resized).
if (off + 1 >= (unsigned)(screen_Rows * screen_Columns))
return;
- /* Outputting the last character on the screen may scrollup the screen.
- * Don't to it! Mark the character invalid (update it when scrolled up) */
+ // Outputting the last character on the screen may scrollup the screen.
+ // Don't to it! Mark the character invalid (update it when scrolled up)
if (row == screen_Rows - 1 && col >= screen_Columns - 2)
{
ScreenAttrs[off] = (sattr_T)-1;
return;
}
- /* Output the first byte normally (positions the cursor), then write the
- * second byte directly. */
+ // Output the first byte normally (positions the cursor), then write the
+ // second byte directly.
screen_char(off, row, col);
out_char(ScreenLines[off + 1]);
++screen_cur_col;
@@ -2182,7 +2181,7 @@ screen_draw_rectangle(
int off;
int max_off;
- /* Can't use ScreenLines unless initialized */
+ // Can't use ScreenLines unless initialized
if (ScreenLines == NULL)
return;
@@ -2271,16 +2270,16 @@ screen_fill(
int force_next = FALSE;
#endif
- if (end_row > screen_Rows) /* safety check */
+ if (end_row > screen_Rows) // safety check
end_row = screen_Rows;
- if (end_col > screen_Columns) /* safety check */
+ if (end_col > screen_Columns) // safety check
end_col = screen_Columns;
if (ScreenLines == NULL
|| start_row >= end_row
- || start_col >= end_col) /* nothing to do */
+ || start_col >= end_col) // nothing to do
return;
- /* it's a "normal" terminal when not in a GUI or cterm */
+ // it's a "normal" terminal when not in a GUI or cterm
norm_term = (
#ifdef FEAT_GUI
!gui.in_use &&
@@ -2294,10 +2293,10 @@ screen_fill(
#endif
)
{
- /* When drawing over the right halve of a double-wide char clear
- * out the left halve. When drawing over the left halve of a
- * double wide-char clear out the right halve. Only needed in a
- * terminal. */
+ // When drawing over the right halve of a double-wide char clear
+ // out the left halve. When drawing over the left halve of a
+ // double wide-char clear out the right halve. Only needed in a
+ // terminal.
if (start_col > 0 && mb_fix_col(start_col, row) != start_col)
screen_puts_len((char_u *)" ", 1, row, start_col - 1, 0);
if (end_col < screen_Columns && mb_fix_col(end_col, row) != end_col)
@@ -2321,13 +2320,13 @@ screen_fill(
* check if we really need to clear something
*/
col = start_col;
- if (c1 != ' ') /* don't clear first char */
+ if (c1 != ' ') // don't clear first char
++col;
off = LineOffset[row] + col;
end_off = LineOffset[row] + end_col;
- /* skip blanks (used often, keep it fast!) */
+ // skip blanks (used often, keep it fast!)
if (enc_utf8)
while (off < end_off && ScreenLines[off] == ' '
&& ScreenAttrs[off] == 0 && ScreenLinesUC[off] == 0)
@@ -2336,21 +2335,21 @@ screen_fill(
while (off < end_off && ScreenLines[off] == ' '
&& ScreenAttrs[off] == 0)
++off;
- if (off < end_off) /* something to be cleared */
+ if (off < end_off) // something to be cleared
{
col = off - LineOffset[row];
screen_stop_highlight();
- term_windgoto(row, col);/* clear rest of this screen line */
+ term_windgoto(row, col);// clear rest of this screen line
out_str(T_CE);
- screen_start(); /* don't know where cursor is now */
+ screen_start(); // don't know where cursor is now
col = end_col - col;
- while (col--) /* clear chars in ScreenLines */
+ while (col--) // clear chars in ScreenLines
{
space_to_screenline(off, 0);
++off;
}
}
- did_delete = TRUE; /* the chars are cleared now */
+ did_delete = TRUE; // the chars are cleared now
}
off = LineOffset[row] + start_col;
@@ -2372,10 +2371,10 @@ screen_fill(
)
{
#if defined(FEAT_GUI) || defined(UNIX)
- /* The bold trick may make a single row of pixels appear in
- * the next character. When a bold character is removed, the
- * next character should be redrawn too. This happens for our
- * own GUI and for some xterms. */
+ // The bold trick may make a single row of pixels appear in
+ // the next character. When a bold character is removed, the
+ // next character should be redrawn too. This happens for our
+ // own GUI and for some xterms.
if (
# ifdef FEAT_GUI
gui.in_use
@@ -2421,14 +2420,14 @@ screen_fill(
}
if (end_col == Columns)
LineWraps[row] = FALSE;
- if (row == Rows - 1) /* overwritten the command line */
+ if (row == Rows - 1) // overwritten the command line
{
redraw_cmdline = TRUE;
if (start_col == 0 && end_col == Columns
&& c1 == ' ' && c2 == ' ' && attr == 0)
- clear_cmdline = FALSE; /* command line has been cleared */
+ clear_cmdline = FALSE; // command line has been cleared
if (start_col == 0)
- mode_displayed = FALSE; /* mode cleared or overwritten */
+ mode_displayed = FALSE; // mode cleared or overwritten
}
}
}
@@ -2473,7 +2472,7 @@ clear_TabPageIdxs(void)
int
screen_valid(int doclear)
{
- screenalloc(doclear); /* allocate screen buffers if size changed */
+ screenalloc(doclear); // allocate screen buffers if size changed
return (ScreenLines != NULL);
}
@@ -2512,8 +2511,8 @@ screenalloc(int doclear)
char *new_popup_transparent;
#endif
tabpage_T *tp;
- static int entered = FALSE; /* avoid recursiveness */
- static int done_outofmem_msg = FALSE; /* did outofmem message */
+ static int entered = FALSE; // avoid recursiveness
+ static int done_outofmem_msg = FALSE; // did outofmem message
int retry_count = 0;
retry:
@@ -2548,9 +2547,9 @@ retry:
*/
++RedrawingDisabled;
- win_new_shellsize(); /* fit the windows in the new sized shell */
+ win_new_shellsize(); // fit the windows in the new sized shell
- comp_col(); /* recompute columns for shown command and ruler */
+ comp_col(); // recompute columns for shown command and ruler
/*
* We're changing the size of the screen.
@@ -2648,11 +2647,11 @@ give_up:
{
if (ScreenLines != NULL || !done_outofmem_msg)
{
- /* guess the size */
+ // guess the size
do_outofmem_msg((long_u)((Rows + 1) * Columns));
- /* Remember we did this to avoid getting outofmem messages over
- * and over again. */
+ // Remember we did this to avoid getting outofmem messages over
+ // and over again.
done_outofmem_msg = TRUE;
}
VIM_CLEAR(new_ScreenLines);
@@ -2710,8 +2709,8 @@ give_up:
len = screen_Columns;
else
len = Columns;
- /* When switching to utf-8 don't copy characters, they
- * may be invalid now. Also when p_mco changes. */
+ // When switching to utf-8 don't copy characters, they
+ // may be invalid now. Also when p_mco changes.
if (!(enc_utf8 && ScreenLinesUC == NULL)
&& p_mco == Screen_mco)
mch_memmove(new_ScreenLines + new_LineOffset[new_row],
@@ -2739,7 +2738,7 @@ give_up:
}
}
}
- /* Use the last line of the screen for the current line. */
+ // Use the last line of the screen for the current line.
current_ScreenLine = new_ScreenLines + Rows * Columns;
#ifdef FEAT_PROP_POPUP
@@ -2768,15 +2767,15 @@ give_up:
popup_mask_refresh = TRUE;
#endif
- /* It's important that screen_Rows and screen_Columns reflect the actual
- * size of ScreenLines[]. Set them before calling anything. */
+ // It's important that screen_Rows and screen_Columns reflect the actual
+ // size of ScreenLines[]. Set them before calling anything.
#ifdef FEAT_GUI
old_Rows = screen_Rows;
#endif
screen_Rows = Rows;
screen_Columns = Columns;
- must_redraw = CLEAR; /* need to clear the screen later */
+ must_redraw = CLEAR; // need to clear the screen later
if (doclear)
screenclear2();
#ifdef FEAT_GUI
@@ -2790,12 +2789,12 @@ give_up:
* Adjust the position of the cursor, for when executing an external
* command.
*/
- if (msg_row >= Rows) /* Rows got smaller */
- msg_row = Rows - 1; /* put cursor at last row */
- else if (Rows > old_Rows) /* Rows got bigger */
- msg_row += Rows - old_Rows; /* put cursor in same place */
- if (msg_col >= Columns) /* Columns got smaller */
- msg_col = Columns - 1; /* put cursor at last column */
+ if (msg_row >= Rows) // Rows got smaller
+ msg_row = Rows - 1; // put cursor at last row
+ else if (Rows > old_Rows) // Rows got bigger
+ msg_row += Rows - old_Rows; // put cursor in same place
+ if (msg_col >= Columns) // Columns got smaller
+ msg_col = Columns - 1; // put cursor at last column
}
#endif
clear_TabPageIdxs();
@@ -2810,8 +2809,8 @@ give_up:
if (starting == 0 && ++retry_count <= 3)
{
apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf);
- /* In rare cases, autocommands may have altered Rows or Columns,
- * jump back to check if we need to allocate the screen again. */
+ // In rare cases, autocommands may have altered Rows or Columns,
+ // jump back to check if we need to allocate the screen again.
goto retry;
}
}
@@ -2841,8 +2840,8 @@ free_screenlines(void)
screenclear(void)
{
check_for_delay(FALSE);
- screenalloc(FALSE); /* allocate screen buffers if size changed */
- screenclear2(); /* clear the screen */
+ screenalloc(FALSE); // allocate screen buffers if size changed
+ screenclear2(); // clear the screen
}
static void
@@ -2860,15 +2859,15 @@ screenclear2(void)
#ifdef FEAT_GUI
if (!gui.in_use)
#endif
- screen_attr = -1; /* force setting the Normal colors */
- screen_stop_highlight(); /* don't want highlighting here */
+ screen_attr = -1; // force setting the Normal colors
+ screen_stop_highlight(); // don't want highlighting here
#ifdef FEAT_CLIPBOARD
- /* disable selection without redrawing it */
+ // disable selection without redrawing it
clip_scroll_selection(9999);
#endif
- /* blank out ScreenLines */
+ // blank out ScreenLines
for (i = 0; i < Rows; ++i)
{
lineclear(LineOffset[i], (int)Columns, 0);
@@ -2877,30 +2876,30 @@ screenclear2(void)
if (can_clear(T_CL))
{
- out_str(T_CL); /* clear the display */
+ out_str(T_CL); // clear the dis