summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-21 18:25:54 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-21 18:25:54 +0100
commit85a2002adb0eda9a9309c2fab4a79edaa91fb834 (patch)
tree99278733712406ab6f291d92f1645c0064c75037
parentfe72d08400d9064b3f959f1f62f279527e64835a (diff)
patch 8.2.0026: still some /* */ commentsv8.2.0026
Problem: Still some /* */ comments. Solution: Convert to // comments.
-rw-r--r--src/message.c920
-rw-r--r--src/message_test.c10
-rw-r--r--src/misc1.c367
-rw-r--r--src/misc2.c547
-rw-r--r--src/move.c332
-rw-r--r--src/version.c2
6 files changed, 1088 insertions, 1090 deletions
diff --git a/src/message.c b/src/message.c
index 0b690bb5d3..522f7d69c3 100644
--- a/src/message.c
+++ b/src/message.c
@@ -11,7 +11,7 @@
* message.c: functions for displaying messages on the command line
*/
-#define MESSAGE_FILE /* don't include prototype for smsg() */
+#define MESSAGE_FILE // don't include prototype for smsg()
#define USING_FLOAT_STUFF
#include "vim.h"
@@ -33,9 +33,9 @@ static int msg_check_screen(void);
static void redir_write(char_u *s, int maxlen);
#ifdef FEAT_CON_DIALOG
static char_u *msg_show_console_dialog(char_u *message, char_u *buttons, int dfltbutton);
-static int confirm_msg_used = FALSE; /* displaying confirm_msg */
-static char_u *confirm_msg = NULL; /* ":confirm" message */
-static char_u *confirm_msg_tail; /* tail of confirm_msg */
+static int confirm_msg_used = FALSE; // displaying confirm_msg
+static char_u *confirm_msg = NULL; // ":confirm" message
+static char_u *confirm_msg_tail; // tail of confirm_msg
static void display_confirm_msg(void);
#endif
#ifdef FEAT_JOB_CHANNEL
@@ -128,14 +128,14 @@ msg_attr(char *s, int attr)
msg_attr_keep(
char *s,
int attr,
- int keep) /* TRUE: set keep_msg if it doesn't scroll */
+ int keep) // TRUE: set keep_msg if it doesn't scroll
{
static int entered = 0;
int retval;
char_u *buf = NULL;
- /* Skip messages not matching ":filter pattern".
- * Don't filter when there is an error. */
+ // Skip messages not matching ":filter pattern".
+ // Don't filter when there is an error.
if (!emsg_on_display && message_filtered((char_u *)s))
return TRUE;
@@ -153,8 +153,8 @@ msg_attr_keep(
return TRUE;
++entered;
- /* Add message to history (unless it's a repeated kept message or a
- * truncated message) */
+ // Add message to history (unless it's a repeated kept message or a
+ // truncated message)
if ((char_u *)s != keep_msg
|| (*s != '<'
&& last_msg_hist != NULL
@@ -164,11 +164,11 @@ msg_attr_keep(
#ifdef FEAT_JOB_CHANNEL
if (emsg_to_channel_log)
- /* Write message in the channel log. */
+ // Write message in the channel log.
ch_log(NULL, "ERROR: %s", (char *)s);
#endif
- /* Truncate the message if needed. */
+ // Truncate the message if needed.
msg_start();
buf = msg_strtrunc((char_u *)s, FALSE);
if (buf != NULL)
@@ -194,31 +194,31 @@ msg_attr_keep(
char_u *
msg_strtrunc(
char_u *s,
- int force) /* always truncate */
+ int force) // always truncate
{
char_u *buf = NULL;
int len;
int room;
- /* May truncate message to avoid a hit-return prompt */
+ // May truncate message to avoid a hit-return prompt
if ((!msg_scroll && !need_wait_return && shortmess(SHM_TRUNCALL)
&& !exmode_active && msg_silent == 0) || force)
{
len = vim_strsize(s);
if (msg_scrolled != 0)
- /* Use all the columns. */
+ // Use all the columns.
room = (int)(Rows - msg_row) * Columns - 1;
else
- /* Use up to 'showcmd' column. */
+ // Use up to 'showcmd' column.
room = (int)(Rows - msg_row - 1) * Columns + sc_col - 1;
if (len > room && room > 0)
{
if (enc_utf8)
- /* may have up to 18 bytes per cell (6 per char, up to two
- * composing chars) */
+ // may have up to 18 bytes per cell (6 per char, up to two
+ // composing chars)
len = (room + 2) * 18;
else if (enc_dbcs == DBCS_JPNU)
- /* may have up to 2 bytes per cell for euc-jp */
+ // may have up to 2 bytes per cell for euc-jp
len = (room + 2) * 2;
else
len = room + 2;
@@ -241,7 +241,7 @@ trunc_string(
int room_in,
int buflen)
{
- size_t room = room_in - 3; /* "..." takes 3 chars */
+ size_t room = room_in - 3; // "..." takes 3 chars
size_t half;
size_t len = 0;
int e;
@@ -252,12 +252,12 @@ trunc_string(
room = 0;
half = room / 2;
- /* First part: Start of the string. */
+ // First part: Start of the string.
for (e = 0; len < half && e < buflen; ++e)
{
if (s[e] == NUL)
{
- /* text fits without truncating! */
+ // text fits without truncating!
buf[e] = NUL;
return;
}
@@ -275,13 +275,13 @@ trunc_string(
}
}
- /* Last part: End of the string. */
+ // Last part: End of the string.
i = e;
if (enc_dbcs != 0)
{
- /* For DBCS going backwards in a string is slow, but
- * computing the cell width isn't too slow: go forward
- * until the rest fits. */
+ // For DBCS going backwards in a string is slow, but
+ // computing the cell width isn't too slow: go forward
+ // until the rest fits.
n = vim_strsize(s + i);
while (len + n > room)
{
@@ -291,7 +291,7 @@ trunc_string(
}
else if (enc_utf8)
{
- /* For UTF-8 we can go backwards easily. */
+ // For UTF-8 we can go backwards easily.
half = i = (int)STRLEN(s);
for (;;)
{
@@ -314,7 +314,7 @@ trunc_string(
if (i <= e + 3)
{
- /* text fits without truncating */
+ // text fits without truncating
if (s != buf)
{
len = STRLEN(s);
@@ -329,7 +329,7 @@ trunc_string(
}
else if (e + 3 < buflen)
{
- /* set the middle and copy the last part */
+ // set the middle and copy the last part
mch_memmove(buf + e, "...", (size_t)3);
len = STRLEN(s + i) + 1;
if (len >= (size_t)buflen - e - 3)
@@ -339,7 +339,7 @@ trunc_string(
}
else
{
- /* can't fit in the "...", just truncate it */
+ // can't fit in the "...", just truncate it
buf[e - 1] = NUL;
}
}
@@ -479,8 +479,8 @@ get_emsg_lnum(void)
{
char_u *Buf, *p;
- /* lnum is 0 when executing a command from the command line
- * argument, we don't want a line number then */
+ // lnum is 0 when executing a command from the command line
+ // argument, we don't want a line number then
if (sourcing_name != NULL
&& (other_sourcing_name() || sourcing_lnum != last_sourcing_lnum)
&& sourcing_lnum != 0)
@@ -516,10 +516,10 @@ msg_source(int attr)
{
msg_attr((char *)p, HL_ATTR(HLF_N));
vim_free(p);
- last_sourcing_lnum = sourcing_lnum; /* only once for each line */
+ last_sourcing_lnum = sourcing_lnum; // only once for each line
}
- /* remember the last sourcing name printed, also when it's empty */
+ // remember the last sourcing name printed, also when it's empty
if (sourcing_name == NULL || other_sourcing_name())
{
vim_free(last_sourcing_name);
@@ -614,17 +614,17 @@ emsg_core(char_u *s)
#endif
#ifdef FEAT_EVAL
- /* When testing some errors are turned into a normal message. */
+ // When testing some errors are turned into a normal message.
if (ignore_error(s))
- /* don't call msg() if it results in a dialog */
+ // don't call msg() if it results in a dialog
return msg_use_printf() ? FALSE : msg((char *)s);
#endif
called_emsg = TRUE;
#ifdef FEAT_EVAL
- /* If "emsg_severe" is TRUE: When an error exception is to be thrown,
- * prefer this message over previous messages for the same command. */
+ // If "emsg_severe" is TRUE: When an error exception is to be thrown,
+ // prefer this message over previous messages for the same command.
severe = emsg_severe;
emsg_severe = FALSE;
#endif
@@ -646,7 +646,7 @@ emsg_core(char_u *s)
return TRUE;
}
- /* set "v:errmsg", also when using ":silent! cmd" */
+ // set "v:errmsg", also when using ":silent! cmd"
set_vim_var_string(VV_ERRMSG, s, -1);
#endif
@@ -683,16 +683,15 @@ emsg_core(char_u *s)
ex_exitval = 1;
- /* Reset msg_silent, an error causes messages to be switched back on.
- */
+ // Reset msg_silent, an error causes messages to be switched back on.
msg_silent = 0;
cmd_silent = FALSE;
- if (global_busy) /* break :global command */
+ if (global_busy) // break :global command
++global_busy;
if (p_eb)
- beep_flush(); /* also includes flush_buffers() */
+ beep_flush(); // also includes flush_buffers()
else
flush_buffers(FLUSH_MINIMAL); // flush internal buffers
++did_emsg; // flag for DoOneCmd()
@@ -701,14 +700,14 @@ emsg_core(char_u *s)
#endif
}
- emsg_on_display = TRUE; /* remember there is an error message */
- ++msg_scroll; /* don't overwrite a previous message */
- attr = HL_ATTR(HLF_E); /* set highlight mode for error messages */
+ emsg_on_display = TRUE; // remember there is an error message
+ ++msg_scroll; // don't overwrite a previous message
+ attr = HL_ATTR(HLF_E); // set highlight mode for error messages
if (msg_scrolled != 0)
- need_wait_return = TRUE; /* needed in case emsg() is called after
- * wait_return has reset need_wait_return
- * and a redraw is expected because
- * msg_scrolled is non-zero */
+ need_wait_return = TRUE; // needed in case emsg() is called after
+ // wait_return has reset need_wait_return
+ // and a redraw is expected because
+ // msg_scrolled is non-zero
#ifdef FEAT_JOB_CHANNEL
emsg_to_channel_log = TRUE;
@@ -721,7 +720,7 @@ emsg_core(char_u *s)
/*
* Display the error message itself.
*/
- msg_nowait = FALSE; /* wait for this msg */
+ msg_nowait = FALSE; // wait for this msg
r = msg_attr((char *)s, attr);
#ifdef FEAT_JOB_CHANNEL
@@ -736,10 +735,10 @@ emsg_core(char_u *s)
int
emsg(char *s)
{
- /* Skip this if not giving error messages at the moment. */
+ // Skip this if not giving error messages at the moment.
if (!emsg_not_now())
return emsg_core((char_u *)s);
- return TRUE; /* no error messages at the moment */
+ return TRUE; // no error messages at the moment
}
#ifndef PROTO // manual proto with __attribute__
@@ -831,7 +830,7 @@ internal_error(char *where)
siemsg(_(e_intern2), where);
}
-/* emsg3() and emsgn() are in misc2.c to avoid warnings for the prototypes. */
+// emsg3() and emsgn() are in misc2.c to avoid warnings for the prototypes.
void
emsg_invreg(int name)
@@ -851,7 +850,7 @@ msg_trunc_attr(char *s, int force, int attr)
int n;
char *ts;
- /* Add message to history before truncating */
+ // Add message to history before truncating
add_msg_hist((char_u *)s, -1, attr);
ts = (char *)msg_may_trunc(force, (char_u *)s);
@@ -884,7 +883,7 @@ msg_may_trunc(int force, char_u *s)
{
int size = vim_strsize(s);
- /* There may be room anyway when there are multibyte chars. */
+ // There may be room anyway when there are multibyte chars.
if (size <= room)
return s;
@@ -904,7 +903,7 @@ msg_may_trunc(int force, char_u *s)
static void
add_msg_hist(
char_u *s,
- int len, /* -1 for undetermined length */
+ int len, // -1 for undetermined length
int attr)
{
struct msg_hist *p;
@@ -912,17 +911,17 @@ add_msg_hist(
if (msg_hist_off || msg_silent != 0)
return;
- /* Don't let the message history get too big */
+ // Don't let the message history get too big
while (msg_hist_len > MAX_MSG_HIST_LEN)
(void)delete_first_msg();
- /* allocate an entry and add the message at the end of the history */
+ // allocate an entry and add the message at the end of the history
p = ALLOC_ONE(struct msg_hist);
if (p != NULL)
{
if (len < 0)
len = (int)STRLEN(s);
- /* remove leading and trailing newlines */
+ // remove leading and trailing newlines
while (len > 0 && *s == '\n')
{
++s;
@@ -956,7 +955,7 @@ delete_first_msg(void)
p = first_msg_hist;
first_msg_hist = p->next;
if (first_msg_hist == NULL)
- last_msg_hist = NULL; /* history is empty */
+ last_msg_hist = NULL; // history is empty
vim_free(p->msg);
vim_free(p);
--msg_hist_len;
@@ -993,13 +992,13 @@ ex_messages(exarg_T *eap)
p = first_msg_hist;
if (eap->addr_count != 0)
{
- /* Count total messages */
+ // Count total messages
for (; p != NULL && !got_int; p = p->next)
c++;
c -= eap->line2;
- /* Skip without number of messages specified */
+ // Skip without number of messages specified
for (p = first_msg_hist; p != NULL && !got_int && c > 0;
p = p->next, c--);
}
@@ -1017,7 +1016,7 @@ ex_messages(exarg_T *eap)
HL_ATTR(HLF_T));
}
- /* Display what was not skipped. */
+ // Display what was not skipped.
for (; p != NULL && !got_int; p = p->next)
if (p->msg != NULL)
msg_attr((char *)p->msg, p->attr);
@@ -1061,8 +1060,8 @@ wait_return(int redraw)
if (redraw == TRUE)
must_redraw = CLEAR;
- /* If using ":silent cmd", don't wait for a return. Also don't set
- * need_wait_return to do it later. */
+ // If using ":silent cmd", don't wait for a return. Also don't set
+ // need_wait_return to do it later.
if (msg_silent != 0)
return;
@@ -1082,36 +1081,36 @@ wait_return(int redraw)
return;
}
- redir_off = TRUE; /* don't redirect this message */
+ redir_off = TRUE; // don't redirect this message
oldState = State;
if (quit_more)
{
- c = CAR; /* just pretend CR was hit */
+ c = CAR; // just pretend CR was hit
quit_more = FALSE;
got_int = FALSE;
}
else if (exmode_active)
{
- msg_puts(" "); /* make sure the cursor is on the right line */
- c = CAR; /* no need for a return in ex mode */
+ msg_puts(" "); // make sure the cursor is on the right line
+ c = CAR; // no need for a return in ex mode
got_int = FALSE;
}
else
{
- /* Make sure the hit-return prompt is on screen when 'guioptions' was
- * just changed. */
+ // Make sure the hit-return prompt is on screen when 'guioptions' was
+ // just changed.
screenalloc(FALSE);
State = HITRETURN;
setmouse();
#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
+ dont_scroll = TRUE; // disallow scrolling here
#endif
cmdline_row = msg_row;
- /* Avoid the sequence that the user types ":" at the hit-return prompt
- * to start an Ex command, but the file-changed dialog gets in the
- * way. */
+ // Avoid the sequence that the user types ":" at the hit-return prompt
+ // to start an Ex command, but the file-changed dialog gets in the
+ // way.
if (need_check_timestamps)
check_timestamps(FALSE);
@@ -1119,18 +1118,18 @@ wait_return(int redraw)
do
{
- /* Remember "got_int", if it is set vgetc() probably returns a
- * CTRL-C, but we need to loop then. */
+ // Remember "got_int", if it is set vgetc() probably returns a
+ // CTRL-C, but we need to loop then.
had_got_int = got_int;
- /* Don't do mappings here, we put the character back in the
- * typeahead buffer. */
+ // Don't do mappings here, we put the character back in the
+ // typeahead buffer.
++no_mapping;
++allow_keys;
- /* Temporarily disable Recording. If Recording is active, the
- * character will be recorded later, since it will be added to the
- * typebuf after the loop */
+ // Temporarily disable Recording. If Recording is active, the
+ // character will be recorded later, since it will be added to the
+ // typebuf after the loop
save_reg_recording = reg_recording;
save_scriptout = scriptout;
reg_recording = 0;
@@ -1144,9 +1143,9 @@ wait_return(int redraw)
scriptout = save_scriptout;
#ifdef FEAT_CLIPBOARD
- /* Strange way to allow copying (yanking) a modeless selection at
- * the hit-enter prompt. Use CTRL-Y, because the same is used in
- * Cmdline-mode and it's harmless when there is no selection. */
+ // Strange way to allow copying (yanking) a modeless selection at
+ // the hit-enter prompt. Use CTRL-Y, because the same is used in
+ // Cmdline-mode and it's harmless when there is no selection.
if (c == Ctrl_Y && clip_star.state == SELECT_DONE)
{
clip_copy_modeless_selection(TRUE);
@@ -1166,7 +1165,7 @@ wait_return(int redraw)
|| c == K_UP || c == K_PAGEUP)
{
if (msg_scrolled > Rows)
- /* scroll back to show older messages */
+ // scroll back to show older messages
do_more_prompt(c);
else
{
@@ -1180,7 +1179,7 @@ wait_return(int redraw)
}
if (quit_more)
{
- c = CAR; /* just pretend CR was hit */
+ c = CAR; // just pretend CR was hit
quit_more = FALSE;
got_int = FALSE;
}
@@ -1223,11 +1222,11 @@ wait_return(int redraw)
(void)jump_to_mouse(MOUSE_SETPOS, NULL, 0);
else if (vim_strchr((char_u *)"\r\n ", c) == NULL && c != Ctrl_C)
{
- /* Put the character back in the typeahead buffer. Don't use the
- * stuff buffer, because lmaps wouldn't work. */
+ // Put the character back in the typeahead buffer. Don't use the
+ // stuff buffer, because lmaps wouldn't work.
ins_char_typebuf(c);
- do_redraw = TRUE; /* need a redraw even though there is
- typeahead */
+ do_redraw = TRUE; // need a redraw even though there is
+ // typeahead
}
}
redir_off = FALSE;
@@ -1240,7 +1239,7 @@ wait_return(int redraw)
{
if (!exmode_active)
cmdline_row = msg_row;
- skip_redraw = TRUE; /* skip redraw once */
+ skip_redraw = TRUE; // skip redraw once
do_redraw = FALSE;
#ifdef FEAT_TERMINAL
skip_term_loop = TRUE;
@@ -1253,7 +1252,7 @@ wait_return(int redraw)
* typed.
*/
tmpState = State;
- State = oldState; /* restore State before set_shellsize */
+ State = oldState; // restore State before set_shellsize
setmouse();
msg_check();
@@ -1267,22 +1266,22 @@ wait_return(int redraw)
need_wait_return = FALSE;
did_wait_return = TRUE;
- emsg_on_display = FALSE; /* can delete error message now */
- lines_left = -1; /* reset lines_left at next msg_start() */
+ emsg_on_display = FALSE; // can delete error message now
+ lines_left = -1; // reset lines_left at next msg_start()
reset_last_sourcing();
if (keep_msg != NULL && vim_strsize(keep_msg) >=
(Rows - cmdline_row - 1) * Columns + sc_col)
- VIM_CLEAR(keep_msg); /* don't redisplay message, it's too long */
+ VIM_CLEAR(keep_msg); // don't redisplay message, it's too long
- if (tmpState == SETWSIZE) /* got resize event while in vgetc() */
+ if (tmpState == SETWSIZE) // got resize event while in vgetc()
{
- starttermcap(); /* start termcap before redrawing */
+ starttermcap(); // start termcap before redrawing
shell_resized();
}
else if (!skip_redraw
&& (redraw == TRUE || (msg_scrolled != 0 && redraw != -1)))
{
- starttermcap(); /* start termcap before redrawing */
+ starttermcap(); // start termcap before redrawing
redraw_later(VALID);
}
}
@@ -1295,8 +1294,8 @@ hit_return_msg(void)
{
int save_p_more = p_more;
- p_more = FALSE; /* don't want see this message when scrolling back */
- if (msg_didout) /* start on a new line */
+ p_more = FALSE; // don't want see this message when scrolling back
+ if (msg_didout) // start on a new line
msg_putchar('\n');
if (got_int)
msg_puts(_("Interrupt: "));
@@ -1350,14 +1349,14 @@ msg_start(void)
#ifdef FEAT_EVAL
if (need_clr_eos)
{
- /* Halfway an ":echo" command and getting an (error) message: clear
- * any text from the command. */
+ // Halfway an ":echo" command and getting an (error) message: clear
+ // any text from the command.
need_clr_eos = FALSE;
msg_clr_eos();
}
#endif
- if (!msg_scroll && full_screen) /* overwrite last message */
+ if (!msg_scroll && full_screen) // overwrite last message
{
msg_row = cmdline_row;
msg_col =
@@ -1366,7 +1365,7 @@ msg_start(void)
#endif
0;
}
- else if (msg_didout) /* start message on next line */
+ else if (msg_didout) // start message on next line
{
msg_putchar('\n');
did_return = TRUE;
@@ -1377,11 +1376,11 @@ msg_start(void)
msg_starthere();
if (msg_silent == 0)
{
- msg_didout = FALSE; /* no output on current line yet */
+ msg_didout = FALSE; // no output on current line yet
cursor_off();
}
- /* when redirecting, may need to start a new line. */
+ // when redirecting, may need to start a new line.
if (!did_return)
redir_write((char_u *)"\n", -1);
}
@@ -1505,15 +1504,15 @@ msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
int mb_l;
int c;
- /* if MSG_HIST flag set, add message to history */
+ // if MSG_HIST flag set, add message to history
if (attr & MSG_HIST)
{
add_msg_hist(str, len, attr);
attr &= ~MSG_HIST;
}
- /* If the string starts with a composing character first draw a space on
- * which the composing char can be drawn. */
+ // If the string starts with a composing character first draw a space on
+ // which the composing char can be drawn.
if (enc_utf8 && utf_iscomposing(utf_ptr2char(msgstr)))
msg_puts_attr(" ", attr);
@@ -1524,7 +1523,7 @@ msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
while (--len >= 0)
{
if (enc_utf8)
- /* Don't include composing chars after the end. */
+ // Don't include composing chars after the end.
mb_l = utfc_ptr2len_len(str, len + 1);
else if (has_mbyte)
mb_l = (*mb_ptr2len)(str);
@@ -1534,12 +1533,12 @@ msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
{
c = (*mb_ptr2char)(str);
if (vim_isprintc(c))
- /* printable multi-byte char: count the cells. */
+ // printable multi-byte char: count the cells.
retval += (*mb_ptr2cells)(str);
else
{
- /* unprintable multi-byte char: print the printable chars so
- * far and the translation of the unprintable char. */
+ // unprintable multi-byte char: print the printable chars so
+ // far and the translation of the unprintable char.
if (str > plain_start)
msg_puts_attr_len((char *)plain_start,
(int)(str - plain_start), attr);
@@ -1556,8 +1555,8 @@ msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
s = transchar_byte(*str);
if (s[1] != NUL)
{
- /* unprintable char: print the printable chars so far and the
- * translation of the unprintable char. */
+ // unprintable char: print the printable chars so far and the
+ // translation of the unprintable char.
if (str > plain_start)
msg_puts_attr_len((char *)plain_start,
(int)(str - plain_start), attr);
@@ -1572,7 +1571,7 @@ msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
}
if (str > plain_start)
- /* print the printable chars at the end */
+ // print the printable chars at the end
msg_puts_attr_len((char *)plain_start, (int)(str - plain_start), attr);
return retval;
@@ -1627,7 +1626,7 @@ msg_outtrans_special(
attr = HL_ATTR(HLF_8);
while (*str != NUL)
{
- /* Leading and trailing spaces need to be displayed in <> form. */
+ // Leading and trailing spaces need to be displayed in <> form.
if ((str == strstart || str[1] == NUL) && *str == ' ')
{
text = "<Space>";
@@ -1638,7 +1637,7 @@ msg_outtrans_special(
len = vim_strsize((char_u *)text);
if (maxlen > 0 && retval + len >= maxlen)
break;
- /* Highlight special keys */
+ // Highlight special keys
msg_puts_attr(text, len > 1
&& (*mb_ptr2len)((char_u *)text) <= 1 ? attr : 0);
retval += len;
@@ -1654,7 +1653,7 @@ msg_outtrans_special(
char_u *
str2special_save(
char_u *str,
- int is_lhs) /* TRUE for lhs, FALSE for rhs */
+ int is_lhs) // TRUE for lhs, FALSE for rhs
{
garray_T ga;
char_u *p = str;
@@ -1675,7 +1674,7 @@ str2special_save(
char_u *
str2special(
char_u **sp,
- int from) /* TRUE for lhs of mapping */
+ int from) // TRUE for lhs of mapping
{
int c;
static char_u buf[7];
@@ -1687,8 +1686,8 @@ str2special(
{
char_u *p;
- /* Try to un-escape a multi-byte character. Return the un-escaped
- * string if it is a multi-byte character. */
+ // Try to un-escape a multi-byte character. Return the un-escaped
+ // string if it is a multi-byte character.
p = mb_unescape(sp);
if (p != NULL)
return p;
@@ -1708,7 +1707,7 @@ str2special(
c = TO_SPECIAL(str[1], str[2]);
str += 2;
}
- if (IS_SPECIAL(c) || modifiers) /* special key */
+ if (IS_SPECIAL(c) || modifiers) // special key
special = TRUE;
}
@@ -1716,23 +1715,23 @@ str2special(
{
int len = (*mb_ptr2len)(str);
- /* For multi-byte characters check for an illegal byte. */
+ // For multi-byte characters check for an illegal byte.
if (has_mbyte && MB_BYTE2LEN(*str) > len)
{
transchar_nonprint(buf, c);
*sp = str + 1;
return buf;
}
- /* Since 'special' is TRUE the multi-byte character 'c' will be
- * processed by get_special_key_name() */
+ // Since 'special' is TRUE the multi-byte character 'c' will be
+ // processed by get_special_key_name()
c = (*mb_ptr2char)(str);
*sp = str + len;
}
else
*sp = str + 1;
- /* Make unprintable characters in <> form, also <M-Space> and <Tab>.
- * Use <Space> only for lhs of a mapping. */
+ // Make unprintable characters in <> form, also <M-Space> and <Tab>.
+ // Use <Space> only for lhs of a mapping.
if (special || char2cells(c) > 1 || (from && c == ' '))
return get_special_key_name(c, modifiers);
buf[0] = c;
@@ -1768,7 +1767,7 @@ msg_prt_line(char_u *s, int list)
int n_extra = 0;
int c_extra = 0;
int c_final = 0;
- char_u *p_extra = NULL; /* init to make SASC shut up */
+ char_u *p_extra = NULL; // init to make SASC shut up
int n;
int attr = 0;
char_u *trail = NULL;
@@ -1778,7 +1777,7 @@ msg_prt_line(char_u *s, int list)
if (curwin->w_p_list)
list = TRUE;
- /* find start of trailing whitespace */
+ // find start of trailing whitespace
if (list && lcs_trail)
{
trail = s + STRLEN(s);
@@ -1786,8 +1785,8 @@ msg_prt_line(char_u *s, int list)
--trail;
}
- /* output a space for an empty line, otherwise the line will be
- * overwritten */
+ // output a space for an empty line, otherwise the line will be
+ // overwritten
if (*s == NUL && !(list && lcs_eol != NUL))
msg_putchar(' ');
@@ -1828,7 +1827,7 @@ msg_prt_line(char_u *s, int list)
c = *s++;
if (c == TAB && (!list || lcs_tab1))
{
- /* tab amount depends on current column */
+ // tab amount depends on current column
#ifdef FEAT_VARTABS
n_extra = tabstop_padding(col, curbuf->b_p_ts,
curbuf->b_p_vts_array) - 1;
@@ -1871,8 +1870,8 @@ msg_prt_line(char_u *s, int list)
c_extra = NUL;
c_final = NUL;
c = *p_extra++;
- /* Use special coloring to be able to distinguish <hex> from
- * the same in plain text. */
+ // Use special coloring to be able to distinguish <hex> from
+ // the same in plain text.
attr = HL_ATTR(HLF_8);
}
else if (c == ' ' && trail != NULL && s > trail)
@@ -1905,7 +1904,7 @@ screen_puts_mbyte(char_u *s, int l, int attr)
{
int cw;
- msg_didout = TRUE; /* remember that line is not empty */
+ msg_didout = TRUE; // remember that line is not empty
cw = (*mb_ptr2cells)(s);
if (cw > 1 && (
#ifdef FEAT_RIGHTLEFT
@@ -1913,7 +1912,7 @@ screen_puts_mbyte(char_u *s, int l, int attr)
#endif
msg_col == Columns - 1))
{
- /* Doesn't fit, print a highlighted '>' to fill it up. */
+ // Doesn't fit, print a highlighted '>' to fill it up.
msg_screen_putchar('>', HL_ATTR(HLF_AT));
return s;
}
@@ -2013,7 +2012,7 @@ msg_puts_attr_len(char *str, int maxlen, int attr)
if (msg_silent != 0)
return;
- /* if MSG_HIST flag set, add message to history */
+ // if MSG_HIST flag set, add message to history
if ((attr & MSG_HIST) && maxlen < 0)
{
add_msg_hist((char_u *)str, -1, attr);
@@ -2054,8 +2053,8 @@ msg_puts_display(
int recurse)
{
char_u *s = str;
- char_u *t_s = str; /* string from "t_s" to "s" is still todo */
- int t_col = 0; /* screen cells todo, 0 when "t_s" not used */
+ char_u *t_s = str; // string from "t_s" to "s" is still todo
+ int t_col = 0; // screen cells todo, 0 when "t_s" not used
int l;
int cw;
char_u *sb_str = str;
@@ -2091,21 +2090,21 @@ msg_puts_display(
* ourselves).
*/
if (t_col > 0)
- /* output postponed text */
+ // output postponed text
t_puts(&t_col, t_s, s, attr);
- /* When no more prompt and no more room, truncate here */
+ // When no more prompt and no more room, truncate here
if (msg_no_more && lines_left == 0)
break;
- /* Scroll the screen up one line. */
+ // Scroll the screen up one line.
msg_scroll_up();
msg_row = Rows - 2;
- if (msg_col >= Columns) /* can happen after screen resize */
+ if (msg_col >= Columns) // can happen after screen resize
msg_col = Columns - 1;
- /* Display char in last column before showing more-prompt. */
+ // Display char in last column before showing more-prompt.
if (*s >= ' '
#ifdef FEAT_RIGHTLEFT
&& !cmdmsg_rl
@@ -2115,7 +2114,7 @@ msg_puts_display(
if (has_mbyte)
{
if (enc_utf8 && maxlen >= 0)
- /* avoid including composing chars after the end */
+ // avoid including composing chars after the end
l = utfc_ptr2len_len(s, (int)((str + maxlen) - s));
else
l = (*mb_ptr2len)(s);
@@ -2129,11 +2128,11 @@ msg_puts_display(
did_last_char = FALSE;
if (p_more)
- /* store text for scrolling back */
+ // store text for scrolling back
store_sb_text(&sb_str, s, attr, &sb_col, TRUE);
inc_msg_scrolled();
- need_wait_return = TRUE; /* may need wait_return in main() */
+ need_wait_return = TRUE; // may need wait_return in main()
redraw_cmdline = TRUE;
if (cmdline_row > 0 && !exmode_active)
--cmdline_row;
@@ -2157,8 +2156,8 @@ msg_puts_display(
return;
}
- /* When we displayed a char in last column need to check if there
- * is still more. */
+ // When we displayed a char in last column need to check if there
+ // is still more.
if (did_last_char)
continue;
}
@@ -2169,41 +2168,41 @@ msg_puts_display(
&& msg_col + t_col >= Columns - 1);
if (t_col > 0 && (wrap || *s == '\r' || *s == '\b'
|| *s == '\t' || *s == BELL))
- /* output any postponed text */
+ // output any postponed text
t_puts(&t_col, t_s, s, attr);
if (wrap && p_more && !recurse)
- /* store text for scrolling back */
+ // store text for scrolling back
store_sb_text(&sb_str, s, attr, &sb_col, TRUE);
- if (*s == '\n') /* go to next line */
+ if (*s == '\n') // go to next line
{
- msg_didout = FALSE; /* remember that line is empty */
+ msg_didout = FALSE; // remember that line is empty
#ifdef FEAT_RIGHTLEFT
if (cmdmsg_rl)
msg_col = Columns - 1;
else
#endif
msg_col = 0;
- if (++msg_row >= Rows) /* safety check */
+ if (++msg_row >= Rows) // safety check
msg_row = Rows - 1;
}
- else if (*s == '\r') /* go to column 0 */
+ else if (*s == '\r') // go to column 0
{
msg_col = 0;
}
- else if (*s == '\b') /* go to previous char */
+ else if (*s == '\b') // go to previous char
{
if (msg_col)
--msg_col;
}
- else if (*s == TAB) /* translate Tab into spaces */
+ else if (*s == TAB) // translate Tab into spaces
{
do
msg_screen_putchar(' ', attr);
while (msg_col & 7);
}
- else if (*s == BELL) /* beep (from ":sh") */
+ else if (*s == BELL) // beep (from ":sh")
vim_beep(BO_SH);
else
{
@@ -2211,7 +2210,7 @@ msg_puts_display(
{
cw = (*mb_ptr2cells)(s);
if (enc_utf8 && maxlen >= 0)
- /* avoid including composing chars after the end */
+ // avoid including composing chars after the end
l = utfc_ptr2len_len(s, (int)((str + maxlen) - s));
else
l = (*mb_ptr2len)(s);
@@ -2222,9 +2221,9 @@ msg_puts_display(
l = 1;
}
- /* When drawing from right to left or when a double-wide character
- * doesn't fit, draw a single character here. Otherwise collect
- * characters and draw them all at once later. */
+ // When drawing from right to left or when a double-wide character
+ // doesn't fit, draw a single character here. Otherwise collect
+ // characters and draw them all at once later.
if (
# ifdef FEAT_RIGHTLEFT
cmdmsg_rl ||
@@ -2238,7 +2237,7 @@ msg_puts_display(
}
else
{
- /* postpone this character until later */
+ // postpone this character until later
if (t_col == 0)
t_s = s;
t_col += cw;
@@ -2248,7 +2247,7 @@ msg_puts_display(
++s;
}
- /* output any postponed text */
+ // output any postponed text
if (t_col > 0)
t_puts(&t_col, t_s, s, attr);
if (p_more && !recurse)
@@ -2279,25 +2278,25 @@ message_filtered(char_u *msg)
msg_scroll_up(void)
{
#ifdef FEAT_GUI
- /* Remove the cursor before scrolling, ScreenLines[] is going
- * to become invalid. */
+ // Remove the cursor before scrolling, ScreenLines[] is going
+ // to become invalid.
if (gui.in_use)
gui_undraw_cursor();
#endif
- /* scrolling up always works */
+ // scrolling up always works
mch_disable_flush();
screen_del_lines(0, 0, 1, (int)Rows, TRUE, 0, NULL);
mch_enable_flush();
if (!can_clear((char_u *)" "))
{
- /* Scrolling up doesn't result in the right background. Set the
- * background here. It's not efficient, but avoids that we have to do
- * it all over the code. */
+ // Scrolling up doesn't result in the right background. Set the
+ // background here. It's not efficient, but avoids that we have to do
+ // it all over the code.
screen_fill((int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0);
- /* Also clear the last char of the last but one line if it was not
- * cleared before to av