Mercurial > vim
changeset 18931:80b40bd5ec1a v8.2.0026
patch 8.2.0026: still some /* */ comments
Commit: https://github.com/vim/vim/commit/85a2002adb0eda9a9309c2fab4a79edaa91fb834
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Dec 21 18:25:54 2019 +0100
patch 8.2.0026: still some /* */ comments
Problem: Still some /* */ comments.
Solution: Convert to // comments.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 21 Dec 2019 18:30:05 +0100 |
parents | 394f34c5c683 |
children | ec2cc19cacf6 |
files | src/message.c src/message_test.c src/misc1.c src/misc2.c src/move.c src/version.c |
diffstat | 6 files changed, 1098 insertions(+), 1100 deletions(-) [+] |
line wrap: on
line diff
--- 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 a 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 */ - - if (tmpState == SETWSIZE) /* got resize event while in vgetc() */ + VIM_CLEAR(keep_msg); // don't redisplay message, it's too long + + 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, in 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, in 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, in { 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, in 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, in } 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 { 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 #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, 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 avoid a scroll-up. */ + // Also clear the last char of the last but one line if it was not + // cleared before to avoid a scroll-up. if (ScreenAttrs[LineOffset[Rows - 2] + Columns - 1] == (sattr_T)-1) screen_fill((int)Rows - 2, (int)Rows - 1, (int)Columns - 1, (int)Columns, ' ', ' ', 0); @@ -2317,8 +2316,8 @@ inc_msg_scrolled(void) char_u *tofree = NULL; int len; - /* v:scrollstart is empty, set it to the script/function name and line - * number */ + // v:scrollstart is empty, set it to the script/function name and line + // number if (p == NULL) p = (char_u *)_("Unknown"); else @@ -2350,13 +2349,13 @@ struct msgchunk_S { msgchunk_T *sb_next; msgchunk_T *sb_prev; - char sb_eol; /* TRUE when line ends after this text */ - int sb_msg_col; /* column in which text starts */ - int sb_attr; /* text attributes */ - char_u sb_text[1]; /* text to be displayed, actually longer */ + char sb_eol; // TRUE when line ends after this text + int sb_msg_col; // column in which text starts + int sb_attr; // text attributes + char_u sb_text[1]; // text to be displayed, actually longer }; -static msgchunk_T *last_msgchunk = NULL; /* last displayed text */ +static msgchunk_T *last_msgchunk = NULL; // last displayed text static msgchunk_T *msg_sb_start(msgchunk_T *mps); @@ -2367,7 +2366,7 @@ typedef enum { SB_CLEAR_CMDLINE_DONE } sb_clear_T; -/* When to clear text on next msg. */ +// When to clear text on next msg. static sb_clear_T do_clear_sb_text = SB_CLEAR_NONE; /* @@ -2375,11 +2374,11 @@ static sb_clear_T do_clear_sb_text = SB_ */ static void store_sb_text( - char_u **sb_str, /* start of string */ - char_u *s, /* just after string */ + char_u **sb_str, // start of string + char_u *s, // just after string int attr, int *sb_col, - int finish) /* line ends */ + int finish) // line ends { msgchunk_T *mp; @@ -2485,8 +2484,8 @@ show_sb_text(void) { msgchunk_T *mp; - /* Only show something if there is more than one line, otherwise it looks - * weird, typing a command without output results in one line. */ + // Only show something if there is more than one line, otherwise it looks + // weird, typing a command without output results in one line. mp = msg_sb_start(last_msgchunk); if (mp == NULL || mp->sb_prev == NULL) vim_beep(BO_MESS); @@ -2535,7 +2534,7 @@ disp_sb_line(int row, msgchunk_T *smp) msg_row = row; msg_col = mp->sb_msg_col; p = mp->sb_text; - if (*p == '\n') /* don't display the line break */ + if (*p == '\n') // don't display the line break ++p; msg_puts_display(p, -1, mp->sb_attr, TRUE); if (mp->sb_eol || mp->sb_next == NULL) @@ -2555,13 +2554,13 @@ t_puts( char_u *s, int attr) { - /* output postponed text */ - msg_didout = TRUE; /* remember that line is not empty */ + // output postponed text + msg_didout = TRUE; // remember that line is not empty screen_puts_len(t_s, (int)(s - t_s), msg_row, msg_col, attr); msg_col += *t_col; *t_col = 0; - /* If the string starts with a composing character don't increment the - * column position for it. */ + // If the string starts with a composing character don't increment the + // column position for it. if (enc_utf8 && utf_iscomposing(utf_ptr2char(t_s))) --msg_col; if (msg_col >= Columns) @@ -2606,7 +2605,7 @@ msg_puts_printf(char_u *str, int maxlen) #ifdef MSWIN if (!(silent_mode && p_verbose == 0)) - mch_settmode(TMODE_COOK); /* handle CR and NL correctly */ + mch_settmode(TMODE_COOK); // handle CR and NL correctly #endif while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL) { @@ -2702,16 +2701,16 @@ do_more_prompt(int typed_char) msgchunk_T *mp; int i; - /* We get called recursively when a timer callback outputs a message. In - * that case don't show another prompt. Also when at the hit-Enter prompt - * and nothing was typed. */ + // We get called recursively when a timer callback outputs a message. In + // that case don't show another prompt. Also when at the hit-Enter prompt + // and nothing was typed. if (entered || (State == HITRETURN && typed_char == 0)) return FALSE; entered = TRUE; if (typed_char == 'G') { - /* "g<": Find first line on the last page. */ + // "g<": Find first line on the last page. mp_last = msg_sb_start(last_msgchunk); for (i = 0; i < Rows - 2 && mp_last != NULL && mp_last->sb_prev != NULL; ++i) @@ -2729,7 +2728,7 @@ do_more_prompt(int typed_char) */ if (used_typed_char != NUL) { - c = used_typed_char; /* was typed at hit-enter prompt */ + c = used_typed_char; // was typed at hit-enter prompt used_typed_char = NUL; } else @@ -2740,9 +2739,9 @@ do_more_prompt(int typed_char) { int idx = get_menu_index(current_menu, ASKMORE); - /* Used a menu. If it starts with CTRL-Y, it must - * be a "Copy" for the clipboard. Otherwise - * assume that we end */ + // Used a menu. If it starts with CTRL-Y, it must + // be a "Copy" for the clipboard. Otherwise + // assume that we end if (idx == MENU_INDEX_INVALID) continue; c = *current_menu->strings[idx]; @@ -2756,72 +2755,72 @@ do_more_prompt(int typed_char) toscroll = 0; switch (c) { - case BS: /* scroll one line back */ + case BS: // scroll one line back case K_BS: case 'k': case K_UP: toscroll = -1; break; - case CAR: /* one extra line */ + case CAR: // one extra line case NL: case 'j': case K_DOWN: toscroll = 1; break; - case 'u': /* Up half a page */ + case 'u': // Up half a page toscroll = -(Rows / 2); break; - case 'd': /* Down half a page */ + case 'd': // Down half a page toscroll = Rows / 2; break; - case 'b': /* one page back */ + case 'b': // one page back case K_PAGEUP: toscroll = -(Rows - 1); break; - case ' ': /* one extra page */ + case ' ': // one extra page case 'f': case K_PAGEDOWN: case K_LEFTMOUSE: toscroll = Rows - 1; break; - case 'g': /* all the way back to the start */ + case 'g': // all the way back to the start toscroll = -999999; break; - case 'G': /* all the way to the end */ + case 'G': // all the way to the end toscroll = 999999; lines_left = 999999; break; - case ':': /* start new command line */ + case ':': // start new command line #ifdef FEAT_CON_DIALOG if (!confirm_msg_used) #endif { - /* Since got_int is set all typeahead will be flushed, but we - * want to keep this ':', remember that in a special way. */ + // Since got_int is set all typeahead will be flushed, but we + // want to keep this ':', remember that in a special way. typeahead_noflush(':'); #ifdef FEAT_TERMINAL skip_term_loop = TRUE; #endif - cmdline_row = Rows - 1; /* put ':' on this line */ - skip_redraw = TRUE; /* skip redraw once */ - need_wait_return = FALSE; /* don't wait in main() */ + cmdline_row = Rows - 1; // put ':' on this line + skip_redraw = TRUE; // skip redraw once + need_wait_return = FALSE; // don't wait in main() } - /* FALLTHROUGH */ - case 'q': /* quit */ + // FALLTHROUGH + case 'q': // quit case Ctrl_C: case ESC: #ifdef FEAT_CON_DIALOG if (confirm_msg_used) { - /* Jump to the choices of the dialog. */ + // Jump to the choices of the dialog. retval = TRUE; } else @@ -2830,23 +2829,23 @@ do_more_prompt(int typed_char) got_int = TRUE; quit_more = TRUE; } - /* When there is some more output (wrapping line) display that - * without another prompt. */ + // When there is some more output (wrapping line) display that + // without another prompt. lines_left = Rows - 1; break; #ifdef FEAT_CLIPBOARD case Ctrl_Y: - /* Strange way to allow copying (yanking) a modeless - * selection at the more prompt. Use CTRL-Y, - * because the same is used in Cmdline-mode and at the - * hit-enter prompt. However, scrolling one line up - * might be expected... */ + // Strange way to allow copying (yanking) a modeless + // selection at the more prompt. Use CTRL-Y, + // because the same is used in Cmdline-mode and at the + // hit-enter prompt. However, scrolling one line up + // might be expected... if (clip_star.state == SELECT_DONE) clip_copy_modeless_selection(TRUE); continue; #endif - default: /* no valid response */ + default: // no valid response msg_moremsg(TRUE); continue; } @@ -2855,7 +2854,7 @@ do_more_prompt(int typed_char) { if (toscroll < 0) { - /* go to start of last line */ + // go to start of last line if (mp_last == NULL) mp = msg_sb_start(last_msgchunk); else if (mp_last->sb_prev != NULL) @@ -2863,14 +2862,14 @@ do_more_prompt(int typed_char) else mp = NULL; - /* go to start of line at top of the screen */ + // go to start of line at top of the screen for (i = 0; i < Rows - 2 && mp != NULL && mp->sb_prev != NULL; ++i) mp = msg_sb_start(mp->sb_prev); if (mp != NULL && mp->sb_prev != NULL) { - /* Find line to be displayed at top. */ + // Find line to be displayed at top. for (i = 0; i > toscroll; --i) { if (mp == NULL || mp->sb_prev == NULL) @@ -2885,12 +2884,12 @@ do_more_prompt(int typed_char) if (toscroll == -1 && screen_ins_lines(0, 0, 1, (int)Rows, 0, NULL) == OK) { - /* display line at top */ + // display line at top (void)disp_sb_line(0, mp); } else { - /* redisplay all lines */ + // redisplay all lines screenclear(); for (i = 0; mp != NULL && i < Rows - 1; ++i) { @@ -2903,10 +2902,10 @@ do_more_prompt(int typed_char) } else { - /* First display any text that we scrolled back. */ + // First display any text that we scrolled back. while (toscroll > 0 && mp_last != NULL) { - /* scroll up, display line at bottom */ + // scroll up, display line at bottom msg_scroll_up(); inc_msg_scrolled(); screen_fill((int)Rows - 2, (int)Rows - 1, 0, @@ -2918,21 +2917,21 @@ do_more_prompt(int typed_char) if (toscroll <= 0) { - /* displayed the requested text, more prompt again */ + // displayed the requested text, more prompt again screen_fill((int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0); msg_moremsg(FALSE); continue; } - /* display more text, return to caller */ + // display more text, return to caller lines_left = toscroll; } break; } - /* clear the --more-- message */ + // clear the --more-- message screen_fill((int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0); State = oldState; setmouse(); @@ -3000,9 +2999,9 @@ mch_errmsg(char *str) #endif #if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) - /* On Unix use stderr if it's a tty. - * When not going to start the GUI also use stderr. - * On Mac, when started from Finder, stderr is the console. */ + // On Unix use stderr if it's a tty. + // When not going to start the GUI also use stderr. + // On Mac, when started from Finder, stderr is the console. if ( # ifdef UNIX # ifdef MACOS_X @@ -3035,7 +3034,7 @@ mch_errmsg(char *str) #endif #if !defined(MSWIN) || defined(FEAT_GUI_MSWIN) - /* avoid a delay for a message that isn't there */ + // avoid a delay for a message that isn't there emsg_on_display = FALSE; len = (int)STRLEN(str) + 1; @@ -3049,7 +3048,7 @@ mch_errmsg(char *str) mch_memmove((char_u *)error_ga.ga_data + error_ga.ga_len, (char_u *)str, len); # ifdef UNIX - /* remove CR characters, they are displayed */ + // remove CR characters, they are displayed { char_u *p; @@ -3063,7 +3062,7 @@ mch_errmsg(char *str) } } # endif - --len; /* don't count the NUL at the end */ + --len; // don't count the NUL at the end error_ga.ga_len += len; } #endif @@ -3103,10 +3102,10 @@ mch_msg_c(char *str) mch_msg(char *str) { #if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) - /* On Unix use stdout if we have a tty. This allows "vim -h | more" and - * uses mch_errmsg() when started from the desktop. - * When not going to start the GUI also use stdout. - * On Mac, when started from Finder, stderr is the console. */ + // On Unix use stdout if we have a tty. This allows "vim -h | more" and + // uses mch_errmsg() when started from the desktop. + // When not going to start the GUI also use stdout. + // On Mac, when started from Finder, stderr is the console. if ( # ifdef UNIX # ifdef MACOS_X @@ -3141,7 +3140,7 @@ mch_msg(char *str) mch_errmsg(str); #endif } -#endif /* USE_MCH_ERRMSG */ +#endif // USE_MCH_ERRMSG /* * Put a character on the screen at the current message position and advance @@ -3150,7 +3149,7 @@ mch_msg(char *str) static void msg_screen_putchar(int c, int attr) { - msg_didout = TRUE; /* remember that line is not empty */ + msg_didout = TRUE; // remember that line is not empty screen_putchar(c, msg_row, msg_col, attr); #ifdef FEAT_RIGHTLEFT if (cmdmsg_rl) @@ -3195,27 +3194,27 @@ repeat_message(void) { if (State == ASKMORE) { - msg_moremsg(TRUE); /* display --more-- message again */ + msg_moremsg(TRUE); // display --more-- message again msg_row = Rows - 1; } #ifdef FEAT_CON_DIALOG else if (State == CONFIRM) { - display_confirm_msg(); /* display ":confirm" message again */ + display_confirm_msg(); // display ":confirm" message again msg_row = Rows - 1; } #endif else if (State == EXTERNCMD) { - windgoto(msg_row, msg_col); /* put cursor back */ + windgoto(msg_row, msg_col); // put cursor back } else if (State == HITRETURN || State == SETWSIZE) { if (msg_row == Rows - 1) { - /* Avoid drawing the "hit-enter" prompt below the previous one, - * overwrite it. Esp. useful when regaining focus and a - * FocusGained autocmd exists but didn't draw anything. */ + // Avoid drawing the "hit-enter" prompt below the previous one, + // overwrite it. Esp. useful when regaining focus and a + // FocusGained autocmd exists but didn't draw anything. msg_didout = FALSE; msg_col = 0; msg_clr_eos(); @@ -3265,12 +3264,12 @@ msg_clr_eos_force(void) { if (msg_use_printf()) { - if (full_screen) /* only when termcap codes are valid */ + if (full_screen) // only when termcap codes are valid { if (*T_CD) - out_str(T_CD); /* clear to end of display */ + out_str(T_CD); // clear to end of display else if (*T_CE) - out_str(T_CE); /* clear to end of line */ + out_str(T_CE); // clear to end of line } } else @@ -3349,17 +3348,17 @@ redir_write(char_u *str, int maxlen) char_u *s = str; static int cur_col = 0; - /* Don't do anything for displaying prompts and the like. */ + // Don't do anything for displaying prompts and the like. if (redir_off) return; - /* If 'verbosefile' is set prepare for writing in that file. */ + // If 'verbosefile' is set prepare for writing in that file. if (*p_vfile != NUL && verbose_fd == NULL) verbose_open(); if (redirecting()) { - /* If the string doesn't start with CR or NL, go to msg_col */ + // If the string doesn't start with CR or NL, go to msg_col if (*s != '\n' && *s != '\r') { while (cur_col < msg_col) @@ -3390,7 +3389,7 @@ redir_write(char_u *str, int maxlen) var_redir_str(s, maxlen); #endif - /* Write and adjust the current column. */ + // Write and adjust the current column. while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen)) { #ifdef FEAT_EVAL @@ -3409,7 +3408,7 @@ redir_write(char_u *str, int maxlen) ++s; } - if (msg_silent != 0) /* should update msg_col */ + if (msg_silent != 0) // should update msg_col msg_col = cur_col; } } @@ -3456,7 +3455,7 @@ verbose_enter_scroll(void) if (*p_vfile != NUL) ++msg_silent; else - /* always scroll up, don't overwrite */ + // always scroll up, don't overwrite msg_scroll = TRUE; } @@ -3498,7 +3497,7 @@ verbose_open(void) { if (verbose_fd == NULL && !verbose_did_open) { - /* Only give the error message once. */ + // Only give the error message once. verbose_did_open = TRUE; verbose_fd = mch_fopen((char *)p_vfile, "a"); @@ -3518,11 +3517,11 @@ verbose_open(void) void give_warning(char_u *message, int hl) { - /* Don't do this for ":silent". */ + // Don't do this for ":silent". if (msg_silent != 0) return; - /* Don't want a hit-enter prompt here. */ + // Don't want a hit-enter prompt here. ++no_wait_return; #ifdef FEAT_EVAL @@ -3535,8 +3534,8 @@ give_warning(char_u *message, int hl) keep_msg_attr = 0; if (msg_attr((char *)message, keep_msg_attr) && msg_scrolled == 0) set_keep_msg(message, keep_msg_attr); - msg_didout = FALSE; /* overwrite this message */ - msg_nowait = TRUE; /* don't wait for this message */ + msg_didout = FALSE; // overwrite this message + msg_nowait = TRUE; // don't wait for this message msg_col = 0; --no_wait_return; @@ -3566,12 +3565,12 @@ give_warning2(char_u *message, char_u *a void msg_advance(int col) { - if (msg_silent != 0) /* nothing to advance to */ + if (msg_silent != 0) // nothing to advance to { - msg_col = col; /* for redirection, may fill it up later */ + msg_col = col; // for redirection, may fill it up later return; } - if (col >= Columns) /* not enough room */ + if (col >= Columns) // not enough room col = Columns - 1; #ifdef FEAT_RIGHTLEFT if (cmdmsg_rl) @@ -3609,10 +3608,10 @@ do_dialog( char_u *message, char_u *buttons, int dfltbutton, - char_u *textfield UNUSED, /* IObuff for inputdialog(), NULL - otherwise */ - int ex_cmd) /* when TRUE pressing : accepts default and starts - Ex command */ + char_u *textfield UNUSED, // IObuff for inputdialog(), NULL + // otherwise + int ex_cmd) // when TRUE pressing : accepts default and starts + // Ex command { int oldState; int retval = 0; @@ -3621,24 +3620,24 @@ do_dialog( int i; #ifndef NO_CONSOLE - /* Don't output anything in silent mode ("ex -s") */ + // Don't output anything in silent mode ("ex -s") if (silent_mode) - return dfltbutton; /* return default option */ + return dfltbutton; // return default option #endif #ifdef FEAT_GUI_DIALOG - /* When GUI is running and 'c' not in 'guioptions', use the GUI dialog */ + // When GUI is running and 'c' not in 'guioptions', use the GUI dialog if (gui.in_use && vim_strchr(p_go, GO_CONDIALOG) == NULL) { c = gui_mch_dialog(type, title, message, buttons, dfltbutton, textfield, ex_cmd); - /* avoid a hit-enter prompt without clearing the cmdline */ + // avoid a hit-enter prompt without clearing the cmdline need_wait_return = FALSE; emsg_on_display = FALSE; cmdline_row = msg_row; - /* Flush output to avoid that further messages and redrawing is done - * in the wrong order. */ + // Flush output to avoid that further messages and redrawing is done + // in the wrong order. out_flush(); gui_mch_update(); @@ -3661,20 +3660,20 @@ do_dialog( { for (;;) { - /* Get a typed character directly from the user. */ + // Get a typed character directly from the user. c = get_keystroke(); switch (c) { - case CAR: /* User accepts default option */ + case CAR: // User accepts default option case NL: retval = dfltbutton; break; - case Ctrl_C: /* User aborts/cancels */ + case Ctrl_C: // User aborts/cancels case ESC: retval = 0; break; - default: /* Could be a hotkey? */ - if (c < 0) /* special keys are ignored here */ + default: // Could be a hotkey? + if (c < 0) // special keys are ignored here continue; if (c == ':' && ex_cmd) { @@ -3683,7 +3682,7 @@ do_dialog( break; } - /* Make the character lowercase, as chars in "hotkeys" are. */ + // Make the character lowercase, as chars in "hotkeys" are. c = MB_TOLOWER(c); retval = 1; for (i = 0; hotkeys[i]; ++i) @@ -3701,7 +3700,7 @@ do_dialog( } if (hotkeys[i]) break; - /* No hotkey match, so keep waiting */ + // No hotkey match, so keep waiting continue; } break; @@ -3726,7 +3725,7 @@ do_dialog( copy_char( char_u *from, char_u *to, - int lowercase) /* make character lower case */ + int lowercase) // make character lower case { int len; int c; @@ -3772,7 +3771,7 @@ msg_show_console_dialog( { int len = 0; #define HOTK_LEN (has_mbyte ? MB_MAXBYTES : 1) - int lenhotkey = HOTK_LEN; /* count first button */ + int lenhotkey = HOTK_LEN; // count first button char_u *hotk = NULL; char_u *msgp = NULL; char_u *hotkp = NULL; @@ -3780,7 +3779,7 @@ msg_show_console_dialog( int copy; #define HAS_HOTKEY_LEN 30 char_u has_hotkey[HAS_HOTKEY_LEN]; - int first_hotkey = FALSE; /* first char of button is hotkey */ + int first_hotkey = FALSE; // first char of button is hotkey int idx; has_hotkey[0] = FALSE; @@ -3800,9 +3799,9 @@ msg_show_console_dialog( if (copy) { *msgp++ = ','; - *msgp++ = ' '; /* '\n' -> ', ' */ - - /* advance to next hotkey and set default hotkey */ + *msgp++ = ' '; // '\n' -> ', ' + + // advance to next hotkey and set default hotkey if (has_mbyte) hotkp += STRLEN(hotkp); else @@ -3811,14 +3810,14 @@ msg_show_console_dialog( if (dfltbutton) --dfltbutton; - /* If no hotkey is specified first char is used. */ + // If no hotkey is specified first char is used. if (idx < HAS_HOTKEY_LEN - 1 && !has_hotkey[++idx]) first_hotkey = TRUE; } else { - len += 3; /* '\n' -> ', '; 'x' -> '(x)' */ - lenhotkey += HOTK_LEN; /* each button needs a hotkey */ + len += 3; // '\n' -> ', '; 'x' -> '(x)' + lenhotkey += HOTK_LEN; // each button needs a hotkey if (idx < HAS_HOTKEY_LEN - 1) has_hotkey[++idx] = FALSE; } @@ -3830,34 +3829,34 @@ msg_show_console_dialog( first_hotkey = FALSE; if (copy) { - if (*r == DLG_HOTKEY_CHAR) /* '&&a' -> '&a' */ + if (*r == DLG_HOTKEY_CHAR) // '&&a' -> '&a' *msgp++ = *r; else { - /* '&a' -> '[a]' */ + // '&a' -> '[a]' *msgp++ = (dfltbutton == 1) ? '[' : '('; msgp += copy_char(r, msgp, FALSE); *msgp++ = (dfltbutton == 1) ? ']' : ')'; - /* redefine hotkey */ + // redefine hotkey hotkp[copy_char(r, hotkp, TRUE)] = NUL; } } else { - ++len; /* '&a' -> '[a]' */ + ++len; // '&a' -> '[a]' if (idx < HAS_HOTKEY_LEN - 1) has_hotkey[idx] = TRUE; } } else { - /* everything else copy literally */ + // everything else copy literally if (copy) msgp += copy_char(r, msgp, FALSE); } - /* advance to the next character */ + // advance to the next character MB_PTR_ADV(r); } @@ -3870,16 +3869,16 @@ msg_show_console_dialog( else { len += (int)(STRLEN(message) - + 2 /* for the NL's */ + + 2 // for the NL's + STRLEN(buttons) - + 3); /* for the ": " and NUL */ - lenhotkey++; /* for the NUL */ - - /* If no hotkey is specified first char is used. */ + + 3); // for the ": " and NUL + lenhotkey++; // for the NUL + + // If no hotkey is specified first char is used. if (!has_hotkey[0]) { first_hotkey = TRUE; - len += 2; /* "x" -> "[x]" */ + len += 2; // "x" -> "[x]" } /* @@ -3900,12 +3899,12 @@ msg_show_console_dialog( msgp = confirm_msg + 1 + STRLEN(message); hotkp = hotk; - /* Define first default hotkey. Keep the hotkey string NUL - * terminated to avoid reading past the end. */ + // Define first default hotkey. Keep the hotkey string NUL + // terminated to avoid reading past the end. hotkp[copy_char(buttons, hotkp, TRUE)] = NUL; - /* Remember where the choices start, displaying starts here when - * "hotkp" typed at the more prompt. */ + // Remember where the choices start, displaying starts here when + // "hotkp" typed at the more prompt. confirm_msg_tail = msgp; *msgp++ = '\n'; } @@ -3921,14 +3920,14 @@ msg_show_console_dialog( static void display_confirm_msg(void) { - /* avoid that 'q' at the more prompt truncates the message here */ + // avoid that 'q' at the more prompt truncates the message here ++confirm_msg_used; if (confirm_msg != NULL) msg_puts_attr((char *)confirm_msg, HL_ATTR(HLF_M)); --confirm_msg_used; } -#endif /* FEAT_CON_DIALOG */ +#endif // FEAT_CON_DIALOG #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG) @@ -3986,7 +3985,7 @@ vim_dialog_yesnoallcancel( return VIM_CANCEL; } -#endif /* FEAT_GUI_DIALOG || FEAT_CON_DIALOG */ +#endif // FEAT_GUI_DIALOG || FEAT_CON_DIALOG #if defined(FEAT_EVAL) static char *e_printf = N_("E766: Insufficient arguments for printf()"); @@ -4134,11 +4133,11 @@ infinity_str(int positive, * "typval_T". When the latter is not used it must be NULL. */ -/* When generating prototypes all of this is skipped, cproto doesn't - * understand this. */ +// When generating prototypes all of this is skipped, cproto doesn't +// understand this. #ifndef PROTO -/* Like vim_vsnprintf() but append to the string. */ +// Like vim_vsnprintf() but append to the string. int vim_snprintf_add(char *str, size_t str_m, const char *fmt, ...) { @@ -4200,7 +4199,7 @@ vim_vsnprintf_typval( char *q = strchr(p + 1, '%'); size_t n = (q == NULL) ? STRLEN(p) : (size_t)(q - p); - /* Copy up to the next '%' or NUL without any changes. */ + // Copy up to the next '%' or NUL without any changes. if (str_l < str_m) { size_t avail = str_m - str_l; @@ -4216,18 +4215,18 @@ vim_vsnprintf_typval( int zero_padding = 0, precision_specified = 0, justify_left = 0; int alternate_form = 0, force_sign = 0; - /* If both the ' ' and '+' flags appear, the ' ' flag should be - * ignored. */ + // If both the ' ' and '+' flags appear, the ' ' flag should be + // ignored. int space_for_positive = 1; - /* allowed values: \0, h, l, L */ + // allowed values: \0, h, l, L char length_modifier = '\0'; - /* temporary buffer for simple numeric->string conversion */ + // temporary buffer for simple numeric->string conversion # if defined(FEAT_FLOAT) -# define TMP_LEN 350 /* On my system 1e308 is the biggest number possible. - * That sounds reasonable to use as the maximum - * printable. */ +# define TMP_LEN 350 // On my system 1e308 is the biggest number possible. + // That sounds reasonable to use as the maximum + // printable. # elif defined(FEAT_NUM64) # define TMP_LEN 66 # else @@ -4235,34 +4234,34 @@ vim_vsnprintf_typval( # endif char tmp[TMP_LEN]; - /* string address in case of string argument */ + // string address in case of string argument const char *str_arg = NULL; - /* natural field width of arg without padding and sign */ + // natural field width of arg without padding and sign size_t str_arg_l; - /* unsigned char argument value - only defined for c conversion. - * N.B. standard explicitly states the char argument for the c - * conversion is unsigned */ + // unsigned char argument value - only defined for c conversion. + // N.B. standard explicitly states the char argument for the c + // conversion is unsigned unsigned char uchar_arg; - /* number of zeros to be inserted for numeric conversions as - * required by the precision or minimal field width */ + // number of zeros to be inserted for numeric conversions as + // required by the precision or minimal field width size_t number_of_zeros_to_pad = 0; - /* index into tmp where zero padding is to be inserted */ + // index into tmp where zero padding is to be inserted size_t zero_padding_insertion_ind = 0; - /* current conversion specifier character */ + // current conversion specifier character char fmt_spec = '\0'; - /* buffer for 's' and 'S' specs */ + // buffer for 's' and 'S' specs char_u *tofree = NULL; - p++; /* skip '%' */ - - /* parse flags */ + p++; // skip '%' + + // parse flags while (*p == '0' || *p == '-' || *p == '+' || *p == ' ' || *p == '#' || *p == '\'') { @@ -4272,18 +4271,18 @@ vim_vsnprintf_typval( case '-': justify_left = 1; break; case '+': force_sign = 1; space_for_positive = 0; break; case ' ': force_sign = 1; - /* If both the ' ' and '+' flags appear, the ' ' - * flag should be ignored */ + // If both the ' ' and '+' flags appear, the ' ' + // flag should be ignored break; case '#': alternate_form = 1; break; case '\'': break; } p++; } - /* If the '0' and '-' flags both appear, the '0' flag should be - * ignored. */ - - /* parse field width */ + // If the '0' and '-' flags both appear, the '0' flag should be + // ignored. + + // parse field width if (*p == '*') { int j; @@ -4304,8 +4303,8 @@ vim_vsnprintf_typval( } else if (VIM_ISDIGIT((int)(*p))) { - /* size_t could be wider than unsigned int; make sure we treat - * argument like common implementations do */ + // size_t could be wider than unsigned int; make sure we treat + // argument like common implementations do unsigned int uj = *p++ - '0'; while (VIM_ISDIGIT((int)(*p))) @@ -4313,7 +4312,7 @@ vim_vsnprintf_typval( min_field_width = uj; } - /* parse precision */ + // parse precision if (*p == '.') { p++; @@ -4338,8 +4337,8 @@ vim_vsnprintf_typval( } else if (VIM_ISDIGIT((int)(*p))) { - /* size_t could be wider than unsigned int; make sure we - * treat argument like common implementations do */ + // size_t could be wider than unsigned int; make sure we + // treat argument like common implementations do unsigned int uj = *p++ - '0'; while (VIM_ISDIGIT((int)(*p))) @@ -4348,25 +4347,25 @@ vim_vsnprintf_typval( } } - /* parse 'h', 'l' and 'll' length modifiers */ + // parse 'h', 'l' and 'll' length modifiers if (*p == 'h' || *p == 'l') { length_modifier = *p; p++; if (length_modifier == 'l' && *p == 'l') { - /* double l = long long */ + // double l = long long # ifdef FEAT_NUM64 length_modifier = 'L'; # else - length_modifier = 'l'; /* treat it as a single 'l' */ + length_modifier = 'l'; // treat it as a single 'l' # endif p++; } } fmt_spec = *p; - /* common synonyms: */ + // common synonyms: switch (fmt_spec) { case 'i': fmt_spec = 'd'; break; @@ -4385,11 +4384,11 @@ vim_vsnprintf_typval( } # endif - /* get parameter value, do initial processing */ + // get parameter value, do initial processing switch (fmt_spec) { - /* '%' and 'c' behave similar to 's' regarding flags and field - * widths */ + // '%' and 'c' behave similar to 's' regarding flags and field + // widths case '%': case 'c': case 's': @@ -4410,7 +4409,7 @@ vim_vsnprintf_typval( tvs != NULL ? tv_nr(tvs, &arg_idx) : # endif va_arg(ap, int); - /* standard demands unsigned char */ + // standard demands unsigned char uchar_arg = (unsigned char)j; str_arg = (char *)&uchar_arg; break; @@ -4428,18 +4427,18 @@ vim_vsnprintf_typval( str_arg = "[NULL]"; str_arg_l = 6; } - /* make sure not to address string beyond the specified - * precision !!! */ + // make sure not to address string beyond the specified + // precision !!! else if (!precision_specified) str_arg_l = strlen(str_arg); - /* truncate string if necessary as requested by precision */ + // truncate string if necessary as requested by precision else if (precision == 0) str_arg_l = 0; else { - /* Don't put the #if inside memchr(), it can be a - * macro. */ - /* memchr on HP does not like n > 2^31 !!! */ + // Don't put the #if inside memchr(), it can be a + // macro. + // memchr on HP does not like n > 2^31 !!! char *q = memchr(str_arg, '\0', precision <= (size_t)0x7fffffffL ? precision : (size_t)0x7fffffffL); @@ -4479,36 +4478,36 @@ vim_vsnprintf_typval( case 'x': case 'X': case 'p': { - /* NOTE: the u, b, o, x, X and p conversion specifiers - * imply the value is unsigned; d implies a signed - * value */ - - /* 0 if numeric argument is zero (or if pointer is - * NULL for 'p'), +1 if greater than zero (or nonzero - * for unsigned arguments), -1 if negative (unsigned - * argument is never negative) */ + // NOTE: the u, b, o, x, X and p conversion specifiers + // imply the value is unsigned; d implies a signed + // value + + // 0 if numeric argument is zero (or if pointer is + // NULL for 'p'), +1 if greater than zero (or nonzero + // for unsigned arguments), -1 if negative (unsigned + // argument is never negative) int arg_sign = 0; - /* only defined for length modifier h, or for no - * length modifiers */ + // only defined for length modifier h, or for no + // length modifiers int int_arg = 0; unsigned int uint_arg = 0; - /* only defined for length modifier l */ + // only defined for length modifier l long int long_arg = 0; unsigned long int ulong_arg = 0; # ifdef FEAT_NUM64 - /* only defined for length modifier ll */ + // only defined for length modifier ll varnumber_T llong_arg = 0; uvarnumber_T ullong_arg = 0; # endif - /* only defined for b conversion */ + // only defined for b conversion uvarnumber_T bin_arg = 0; - /* pointer argument value -only defined for p - * conversion */ + // pointer argument value -only defined for p + // conversion void *ptr_arg = NULL; if (fmt_spec == 'p') @@ -4536,12 +4535,12 @@ vim_vsnprintf_typval( } else if (fmt_spec == 'd') { - /* signed */ + // signed switch (length_modifier) { case '\0': case 'h': - /* char and short arguments are passed as int. */ + // char and short arguments are passed as int. int_arg = # if defined(FEAT_EVAL) tvs != NULL ? tv_nr(tvs, &arg_idx) : @@ -4580,7 +4579,7 @@ vim_vsnprintf_typval( } else { - /* unsigned */ + // unsigned switch (length_modifier) { case '\0': @@ -4622,20 +4621,19 @@ vim_vsnprintf_typval( str_arg = tmp; str_arg_l = 0; - /* NOTE: - * For d, i, u, o, x, and X conversions, if precision is - * specified, the '0' flag should be ignored. This is so - * with Solaris 2.6, Digital UNIX 4.0, HPUX 10, Linux, - * FreeBSD, NetBSD; but not with Perl. - */ + // NOTE: + // For d, i, u, o, x, and X conversions, if precision is + // specified, the '0' flag should be ignored. This is so + // with Solaris 2.6, Digital UNIX 4.0, HPUX 10, Linux, + // FreeBSD, NetBSD; but not with Perl. if (precision_specified) zero_padding = 0; if (fmt_spec == 'd') { if (force_sign && arg_sign >= 0) tmp[str_arg_l++] = space_for_positive ? ' ' : '+'; - /* leave negative numbers for sprintf to handle, to - * avoid handling tricky cases like (short int)-32768 */ + // leave negative numbers for sprintf to handle, to + // avoid handling tricky cases like (short int)-32768 } else if (alternate_form) { @@ -4646,25 +4644,25 @@ vim_vsnprintf_typval( tmp[str_arg_l++] = '0'; tmp[str_arg_l++] = fmt_spec; } - /* alternate form should have no effect for p - * conversion, but ... */ + // alternate form should have no effect for p + // conversion, but ... } zero_padding_insertion_ind = str_arg_l; if (!precision_specified) - precision = 1; /* default precision is 1 */ + precision = 1; // default precision is 1 if (precision == 0 && arg_sign == 0) { - /* When zero value is formatted with an explicit - * precision 0, the resulting formatted string is - * empty (d, i, u, b, B, o, x, X, p). */ + // When zero value is formatted with an explicit + // precision 0, the resulting formatted string is + // empty (d, i, u, b, B, o, x, X, p). } else { char f[6]; int f_l = 0; - /* construct a simple format string for sprintf */ + // construct a simple format string for sprintf f[f_l++] = '%'; if (!length_modifier) ; @@ -4708,7 +4706,7 @@ vim_vsnprintf_typval( } else if (fmt_spec == 'd') { - /* signed */ + // signed switch (length_modifier) { case '\0': @@ -4727,7 +4725,7 @@ vim_vsnprintf_typval( } else { - /* unsigned */ + // unsigned switch (length_modifier) { case '\0': @@ -4745,9 +4743,9 @@ vim_vsnprintf_typval( } } - /* include the optional minus sign and possible - * "0x" in the region before the zero padding - * insertion point */ + // include the optional minus sign and possible + // "0x" in the region before the zero padding + // insertion point if (zero_padding_insertion_ind < str_arg_l && tmp[zero_padding_insertion_ind] == '-') zero_padding_insertion_ind++; @@ -4763,28 +4761,28 @@ vim_vsnprintf_typval( - zero_padding_insertion_ind; if (alternate_form && fmt_spec == 'o' - /* unless zero is already the first - * character */ + // unless zero is already the first + // character && !(zero_padding_insertion_ind < str_arg_l && tmp[zero_padding_insertion_ind] == '0')) { - /* assure leading zero for alternate-form - * octal numbers */ + // assure leading zero for alternate-form + // octal numbers if (!precision_specified || precision < num_of_digits + 1) { - /* precision is increased to force the - * first character to be zero, except if a - * zero value is formatted with an - * explicit precision of zero */ + // precision is increased to force the + // first character to be zero, except if a + // zero value is formatted with an + // explicit precision of zero precision = num_of_digits + 1; } } - /* zero padding to specified precision? */ + // zero padding to specified precision? if (num_of_digits < precision) number_of_zeros_to_pad = precision - num_of_digits; } - /* zero padding to specified minimal field width? */ + // zero padding to specified minimal field width? if (!justify_left && zero_padding) { int n = (int)(min_field_width - (str_arg_l @@ -4803,7 +4801,7 @@ vim_vsnprintf_typval( case 'g': case 'G': { - /* Floating point. */ + // Floating point. double f; double abs_f; char format[40]; @@ -4819,8 +4817,8 @@ vim_vsnprintf_typval( if (fmt_spec == 'g' || fmt_spec == 'G') { - /* Would be nice to use %g directly, but it prints - * "1.0" as "1", we don't want that. */ + // Would be nice to use %g directly, but it prints + // "1.0" as "1", we don't want that. if ((abs_f >= 0.001 && abs_f < 10000000.0) || abs_f == 0.0) fmt_spec = ASCII_ISUPPER(fmt_spec) ? 'F' : 'f'; @@ -4837,7 +4835,7 @@ vim_vsnprintf_typval( # endif ) { - /* Avoid a buffer overflow */ + // Avoid a buffer overflow STRCPY(tmp, infinity_str(f > 0.0, fmt_spec, force_sign, space_for_positive)); str_arg_l = STRLEN(tmp); @@ -4847,7 +4845,7 @@ vim_vsnprintf_typval( { if (isnan(f)) { - /* Not a number: nan or NAN */ + // Not a number: nan or NAN STRCPY(tmp, ASCII_ISUPPER(fmt_spec) ? "NAN" : "nan"); str_arg_l = 3; @@ -4862,7 +4860,7 @@ vim_vsnprintf_typval( } else { - /* Regular float number */ + // Regular float number format[0] = '%'; l = 1; if (force_sign) @@ -4871,8 +4869,8 @@ vim_vsnprintf_typval( { size_t max_prec = TMP_LEN - 10; - /* Make sure we don't get more digits than we - * have room for. */ + // Make sure we don't get more digits than we + // have room for. if ((fmt_spec == 'f' || fmt_spec == 'F') && abs_f > 1.0) max_prec -= (size_t)log10(abs_f); @@ -4891,7 +4889,7 @@ vim_vsnprintf_typval( int i; char *tp; - /* Using %g or %G: remove superfluous zeroes. */ + // Using %g or %G: remove superfluous zeroes. if (fmt_spec == 'f' || fmt_spec == 'F') tp = tmp + str_arg_l - 1; else @@ -4900,18 +4898,18 @@ vim_vsnprintf_typval( fmt_spec == 'e' ? 'e' : 'E'); if (tp != NULL) { - /* Remove superfluous '+' and leading - * zeroes from the exponent. */ + // Remove superfluous '+' and leading + // zeroes from the exponent. if (tp[1] == '+') { - /* Change "1.0e+07" to "1.0e07" */ + // Change "1.0e+07" to "1.0e07" STRMOVE(tp + 1, tp + 2); --str_arg_l; } i = (tp[1] == '-') ? 2 : 1; while (tp[i] == '0') { - /* Change "1.0e07" to "1.0e7" */ + // Change "1.0e07" to "1.0e7" STRMOVE(tp + i, tp + i + 1); --str_arg_l; } @@ -4920,8 +4918,8 @@ vim_vsnprintf_typval( } if (tp != NULL && !precision_specified) - /* Remove trailing zeroes, but keep the one - * just after a dot. */ + // Remove trailing zeroes, but keep the one + // just after a dot. while (tp > tmp + 2 && *tp == '0' && tp[-1] != '.') { @@ -4934,9 +4932,9 @@ vim_vsnprintf_typval( { char *tp; - /* Be consistent: some printf("%e") use 1.0e+12 - * and some 1.0e+012. Remove one zero in the last - * case. */ + // Be consistent: some printf("%e") use 1.0e+12 + // and some 1.0e+012. Remove one zero in the last + // case. tp = (char *)vim_strchr((char_u *)tmp, fmt_spec == 'e' ? 'e' : 'E'); if (tp != NULL && (tp[1] == '+' || tp[1] == '-') @@ -4952,7 +4950,7 @@ vim_vsnprintf_typval( if (zero_padding && min_field_width > str_arg_l && (tmp[0] == '-' || force_sign)) { - /* padding 0's should be inserted after the sign */ + // padding 0's should be inserted after the sign number_of_zeros_to_pad = min_field_width - str_arg_l; zero_padding_insertion_ind = 1; } @@ -4962,32 +4960,32 @@ vim_vsnprintf_typval( # endif default: - /* unrecognized conversion specifier, keep format string - * as-is */ - zero_padding = 0; /* turn zero padding off for non-numeric - conversion */ + // unrecognized conversion specifier, keep format string + // as-is + zero_padding = 0; // turn zero padding off for non-numeric + // conversion justify_left = 1; - min_field_width = 0; /* reset flags */ - - /* discard the unrecognized conversion, just keep * - * the unrecognized conversion character */ + min_field_width = 0; // reset flags + + // discard the unrecognized conversion, just keep * + // the unrecognized conversion character str_arg = p; str_arg_l = 0; if (*p != NUL) - str_arg_l++; /* include invalid conversion specifier - unchanged if not at end-of-string */ + str_arg_l++; // include invalid conversion specifier + // unchanged if not at end-of-string break; } if (*p != NUL) - p++; /* step over the just processed conversion specifier */ - - /* insert padding to the left as requested by min_field_width; - * this does not include the zero padding in case of numerical - * conversions*/ + p++; // step over the just processed conversion specifier + + // insert padding to the left as requested by min_field_width; + // this does not include the zero padding in case of numerical + // conversions if (!justify_left) { - /* left padding with blank or zero */ + // left padding with blank or zero int pn = (int)(min_field_width - (str_arg_l + number_of_zeros_to_pad)); if (pn > 0) @@ -5004,18 +5002,18 @@ vim_vsnprintf_typval( } } - /* zero padding as requested by the precision or by the minimal - * field width for numeric conversions required? */ + // zero padding as requested by the precision or by the minimal + // field width for numeric conversions required? if (number_of_zeros_to_pad == 0) { - /* will not copy first part of numeric right now, * - * force it to be copied later in its entirety */ + // will not copy first part of numeric right now, * + // force it to be copied later in its entirety zero_padding_insertion_ind = 0; } else { - /* insert first part of numerics (sign or '0x') before zero - * padding */ + // insert first part of numerics (sign or '0x') before zero + // padding int zn = (int)zero_padding_insertion_ind; if (zn > 0) @@ -5031,8 +5029,8 @@ vim_vsnprintf_typval( str_l += zn; } - /* insert zero padding as requested by the precision or min - * field width */ + // insert zero padding as requested by the precision or min + // field width zn = (int)number_of_zeros_to_pad; if (zn > 0) { @@ -5048,8 +5046,8 @@ vim_vsnprintf_typval( } } - /* insert formatted string - * (or as-is conversion specifier for unknown conversions) */ + // insert formatted string + // (or as-is conversion specifier for unknown conversions) { int sn = (int)(str_arg_l - zero_padding_insertion_ind); @@ -5067,10 +5065,10 @@ vim_vsnprintf_typval( } } - /* insert right padding */ + // insert right padding if (justify_left) { - /* right blank padding to the field width */ + // right blank padding to the field width int pn = (int)(min_field_width - (str_arg_l + number_of_zeros_to_pad)); @@ -5093,19 +5091,19 @@ vim_vsnprintf_typval( if (str_m > 0) { - /* make sure the string is nul-terminated even at the expense of - * overwriting the last character (shouldn't happen, but just in case) - * */ + // make sure the string is nul-terminated even at the expense of + // overwriting the last character (shouldn't happen, but just in case) + // str[str_l <= str_m - 1 ? str_l : str_m - 1] = '\0'; } if (tvs != NULL && tvs[arg_idx - 1].v_type != VAR_UNKNOWN) emsg(_("E767: Too many arguments to printf()")); - /* Return the number of characters formatted (excluding trailing nul - * character), that is, the number of characters that would have been - * written to the buffer if it were large enough. */ + // Return the number of characters formatted (excluding trailing nul + // character), that is, the number of characters that would have been + // written to the buffer if it were large enough. return (int)str_l; } -#endif /* PROTO */ +#endif // PROTO
--- a/src/message_test.c +++ b/src/message_test.c @@ -14,12 +14,12 @@ #undef NDEBUG #include <assert.h> -/* Must include main.c because it contains much more than just main() */ +// Must include main.c because it contains much more than just main() #define NO_VIM_MAIN #include "main.c" -/* This file has to be included because some of the tested functions are - * static. */ +// This file has to be included because some of the tested functions are +// static. #include "message.c" /* @@ -31,7 +31,7 @@ test_trunc_string(void) char_u *buf; /*allocated every time to find uninit errors */ char_u *s; - /* in place */ + // in place buf = alloc(40); STRCPY(buf, "text"); trunc_string(buf, buf, 20, 40); @@ -56,7 +56,7 @@ test_trunc_string(void) assert(STRCMP(buf, "a text t...nott fits") == 0); vim_free(buf); - /* copy from string to buf */ + // copy from string to buf buf = alloc(40); s = vim_strsave((char_u *)"text"); trunc_string(s, buf, 20, 40);
--- a/src/misc1.c +++ b/src/misc1.c @@ -18,8 +18,8 @@ # include <lm.h> #endif -#define URL_SLASH 1 /* path_is_url() has found "://" */ -#define URL_BACKSLASH 2 /* path_is_url() has found ":\\" */ +#define URL_SLASH 1 // path_is_url() has found "://" +#define URL_BACKSLASH 2 // path_is_url() has found ":\\" // All user names (for ~user completion as done by shell). static garray_T ga_users; @@ -45,15 +45,15 @@ get_leader_len( int result; int got_com = FALSE; int found_one; - char_u part_buf[COM_MAX_LEN]; /* buffer for one option part */ - char_u *string; /* pointer to comment string */ + char_u part_buf[COM_MAX_LEN]; // buffer for one option part + char_u *string; // pointer to comment string char_u *list; int middle_match_len = 0; char_u *prev_list; char_u *saved_flags = NULL; result = i = 0; - while (VIM_ISWHITE(line[i])) /* leading white space is ignored */ + while (VIM_ISWHITE(line[i])) // leading white space is ignored ++i; /* @@ -67,60 +67,60 @@ get_leader_len( found_one = FALSE; for (list = curbuf->b_p_com; *list; ) { - /* Get one option part into part_buf[]. Advance "list" to next - * one. Put "string" at start of string. */ + // Get one option part into part_buf[]. Advance "list" to next + // one. Put "string" at start of string. if (!got_com && flags != NULL) - *flags = list; /* remember where flags started */ + *flags = list; // remember where flags started prev_list = list; (void)copy_option_part(&list, part_buf, COM_MAX_LEN, ","); string = vim_strchr(part_buf, ':'); - if (string == NULL) /* missing ':', ignore this part */ + if (string == NULL) // missing ':', ignore this part continue; - *string++ = NUL; /* isolate flags from string */ + *string++ = NUL; // isolate flags from string - /* If we found a middle match previously, use that match when this - * is not a middle or end. */ + // If we found a middle match previously, use that match when this + // is not a middle or end. if (middle_match_len != 0 && vim_strchr(part_buf, COM_MIDDLE) == NULL && vim_strchr(part_buf, COM_END) == NULL) break; - /* When we already found a nested comment, only accept further - * nested comments. */ + // When we already found a nested comment, only accept further + // nested comments. if (got_com && vim_strchr(part_buf, COM_NEST) == NULL) continue; - /* When 'O' flag present and using "O" command skip this one. */ + // When 'O' flag present and using "O" command skip this one. if (backward && vim_strchr(part_buf, COM_NOBACK) != NULL) continue; - /* Line contents and string must match. - * When string starts with white space, must have some white space - * (but the amount does not need to match, there might be a mix of - * TABs and spaces). */ + // Line contents and string must match. + // When string starts with white space, must have some white space + // (but the amount does not need to match, there might be a mix of + // TABs and spaces). if (VIM_ISWHITE(string[0])) { if (i == 0 || !VIM_ISWHITE(line[i - 1])) - continue; /* missing white space */ + continue; // missing white space while (VIM_ISWHITE(string[0])) ++string; } for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j) ; if (string[j] != NUL) - continue; /* string doesn't match */ + continue; // string doesn't match - /* When 'b' flag used, there must be white space or an - * end-of-line after the string in the line. */ + // When 'b' flag used, there must be white space or an + // end-of-line after the string in the line. if (vim_strchr(part_buf, COM_BLANK) != NULL && !VIM_ISWHITE(line[i + j]) && line[i + j] != NUL) continue; - /* We have found a match, stop searching unless this is a middle - * comment. The middle comment can be a substring of the end - * comment in which case it's better to return the length of the - * end comment and its flags. Thus we keep searching with middle - * and end matches and use an end match if it matches better. */ + // We have found a match, stop searching unless this is a middle + // comment. The middle comment can be a substring of the end + // comment in which case it's better to return the length of the + // end comment and its flags. Thus we keep searching with middle + // and end matches and use an end match if it matches better. if (vim_strchr(part_buf, COM_MIDDLE) != NULL) { if (middle_match_len == 0) @@ -131,8 +131,8 @@ get_leader_len( continue; } if (middle_match_len != 0 && j > middle_match_len) - /* Use this match instead of the middle match, since it's a - * longer thus better match. */ + // Use this match instead of the middle match, since it's a + // longer thus better match. middle_match_len = 0; if (middle_match_len == 0) @@ -143,28 +143,28 @@ get_leader_len( if (middle_match_len != 0) { - /* Use the previously found middle match after failing to find a - * match with an end. */ + // Use the previously found middle match after failing to find a + // match with an end. if (!got_com && flags != NULL) *flags = saved_flags; i += middle_match_len; found_one = TRUE; } - /* No match found, stop scanning. */ + // No match found, stop scanning. if (!found_one) break; result = i; - /* Include any trailing white space. */ + // Include any trailing white space. while (VIM_ISWHITE(line[i])) ++i; if (include_space) result = i; - /* If this comment doesn't nest, stop here. */ + // If this comment doesn't nest, stop here. got_com = TRUE; if (vim_strchr(part_buf, COM_NEST) == NULL) break; @@ -190,7 +190,7 @@ get_last_leader_offset(char_u *line, cha char_u *com_flags; char_u *list; int found_one; - char_u part_buf[COM_MAX_LEN]; /* buffer for one option part */ + char_u part_buf[COM_MAX_LEN]; // buffer for one option part /* * Repeat to match several nested comment strings. @@ -212,10 +212,10 @@ get_last_leader_offset(char_u *line, cha */ (void)copy_option_part(&list, part_buf, COM_MAX_LEN, ","); string = vim_strchr(part_buf, ':'); - if (string == NULL) /* If everything is fine, this cannot actually - * happen. */ + if (string == NULL) // If everything is fine, this cannot actually + // happen. continue; - *string++ = NUL; /* Isolate flags from string. */ + *string++ = NUL; // Isolate flags from string. com_leader = string; /* @@ -271,7 +271,7 @@ get_last_leader_offset(char_u *line, cha if (found_one) { - char_u part_buf2[COM_MAX_LEN]; /* buffer for one option part */ + char_u part_buf2[COM_MAX_LEN]; // buffer for one option part int len1, len2, off; result = i; @@ -283,11 +283,10 @@ get_last_leader_offset(char_u *line, cha lower_check_bound = i; - /* Let's verify whether the comment leader found is a substring - * of other comment leaders. If it is, let's adjust the - * lower_check_bound so that we make sure that we have determined - * the comment leader correctly. - */ + // Let's verify whether the comment leader found is a substring + // of other comment leaders. If it is, let's adjust the + // lower_check_bound so that we make sure that we have determined + // the comment leader correctly. while (VIM_ISWHITE(*com_leader)) ++com_leader; @@ -308,8 +307,8 @@ get_last_leader_offset(char_u *line, cha if (len2 == 0) continue; - /* Now we have to verify whether string ends with a substring - * beginning the com_leader. */ + // Now we have to verify whether string ends with a substring + // beginning the com_leader. for (off = (len2 > i ? i : len2); off > 0 && off + len1 > len2;) { --off; @@ -338,11 +337,11 @@ plines(linenr_T lnum) plines_win( win_T *wp, linenr_T lnum, - int winheight) /* when TRUE limit to window height */ + int winheight) // when TRUE limit to window height { #if defined(FEAT_DIFF) || defined(PROTO) - /* Check for filler lines above this buffer line. When folded the result - * is one line anyway. */ + // Check for filler lines above this buffer line. When folded the result + // is one line anyway. return plines_win_nofill(wp, lnum, winheight) + diff_check_fill(wp, lnum); } @@ -356,7 +355,7 @@ plines_nofill(linenr_T lnum) plines_win_nofill( win_T *wp, linenr_T lnum, - int winheight) /* when TRUE limit to window height */ + int winheight) // when TRUE limit to window height { #endif int lines; @@ -368,8 +367,8 @@ plines_win_nofill( return 1; #ifdef FEAT_FOLDING - /* A folded lines is handled just like an empty line. */ - /* NOTE: Caller must handle lines that are MAYBE folded. */ + // A folded lines is handled just like an empty line. + // NOTE: Caller must handle lines that are MAYBE folded. if (lineFolded(wp, lnum) == TRUE) return 1; #endif @@ -392,7 +391,7 @@ plines_win_nofold(win_T *wp, linenr_T ln int width; s = ml_get_buf(wp->w_buffer, lnum, FALSE); - if (*s == NUL) /* empty line */ + if (*s == NUL) // empty line return 1; col = win_linetabsize(wp, s, (colnr_T)MAXCOL); @@ -430,8 +429,8 @@ plines_win_col(win_T *wp, linenr_T lnum, char_u *line; #ifdef FEAT_DIFF - /* Check for filler lines above this buffer line. When folded the result - * is one line anyway. */ + // Check for filler lines above this buffer line. When folded the result + // is one line anyway. lines = diff_check_fill(wp, lnum); #endif @@ -483,12 +482,12 @@ plines_m_win(win_T *wp, linenr_T first, #ifdef FEAT_FOLDING int x; - /* Check if there are any really folded lines, but also included lines - * that are maybe folded. */ + // Check if there are any really folded lines, but also included lines + // that are maybe folded. x = foldedCount(wp, first, NULL); if (x > 0) { - ++count; /* count 1 for "+-- folded" line */ + ++count; // count 1 for "+-- folded" line first += x; } else @@ -511,7 +510,7 @@ gchar_pos(pos_T *pos) { char_u *ptr; - /* When searching columns is sometimes put at the end of a line. */ + // When searching columns is sometimes put at the end of a line. if (pos->col == MAXCOL) return NUL; ptr = ml_get_pos(pos); @@ -585,7 +584,7 @@ ask_yesno(char_u *str, int direct) int r = ' '; int save_State = State; - if (exiting) /* put terminal in raw mode for this question */ + if (exiting) // put terminal in raw mode for this question settmode(TMODE_RAW); ++no_wait_return; #ifdef USE_ON_FLY_SCROLL @@ -598,7 +597,7 @@ ask_yesno(char_u *str, int direct) while (r != 'y' && r != 'n') { - /* same highlighting as for wait_return */ + // same highlighting as for wait_return smsg_attr(HL_ATTR(HLF_R), "%s (y/n)?", str); if (direct) r = get_keystroke(); @@ -606,7 +605,7 @@ ask_yesno(char_u *str, int direct) r = plain_vgetc(); if (r == Ctrl_C || r == ESC) r = 'n'; - msg_putchar(r); /* show what you typed */ + msg_putchar(r); // show what you typed out_flush(); } --no_wait_return; @@ -632,7 +631,7 @@ f_mode(typval_T *argvars, typval_T *rett if (time_for_testing == 93784) { - /* Testing the two-character code. */ + // Testing the two-character code. buf[0] = 'x'; buf[1] = '!'; } @@ -702,8 +701,8 @@ f_mode(typval_T *argvars, typval_T *rett } } - /* Clear out the minor mode when the argument is not a non-zero number or - * non-empty string. */ + // Clear out the minor mode when the argument is not a non-zero number or + // non-empty string. if (!non_zero_arg(&argvars[0])) buf[1] = NUL; @@ -777,15 +776,15 @@ get_keystroke(void) int save_mapped_ctrl_c = mapped_ctrl_c; int waited = 0; - mapped_ctrl_c = FALSE; /* mappings are not used here */ + mapped_ctrl_c = FALSE; // mappings are not used here for (;;) { cursor_on(); out_flush(); - /* Leave some room for check_termcode() to insert a key code into (max - * 5 chars plus NUL). And fix_input_buffer() can triple the number of - * bytes. */ + // Leave some room for check_termcode() to insert a key code into (max + // 5 chars plus NUL). And fix_input_buffer() can triple the number of + // bytes. maxlen = (buflen - 6 - len) / 3; if (buf == NULL) buf = alloc(buflen); @@ -793,8 +792,8 @@ get_keystroke(void) { char_u *t_buf = buf; - /* Need some more space. This might happen when receiving a long - * escape sequence. */ + // Need some more space. This might happen when receiving a long + // escape sequence. buflen += 100; buf = vim_realloc(buf, buflen); if (buf == NULL) @@ -804,43 +803,43 @@ get_keystroke(void) if (buf == NULL) { do_outofmem_msg((long_u)buflen); - return ESC; /* panic! */ + return ESC; // panic! } - /* First time: blocking wait. Second time: wait up to 100ms for a - * terminal code to complete. */ + // First time: blocking wait. Second time: wait up to 100ms for a + // terminal code to complete. n = ui_inchar(buf + len, maxlen, len == 0 ? -1L : 100L, 0); if (n > 0) { - /* Replace zero and CSI by a special key code. */ + // Replace zero and CSI by a special key code. n = fix_input_buffer(buf + len, n); len += n; waited = 0; } else if (len > 0) - ++waited; /* keep track of the waiting time */ + ++waited; // keep track of the waiting time - /* Incomplete termcode and not timed out yet: get more characters */ + // Incomplete termcode and not timed out yet: get more characters if ((n = check_termcode(1, buf, buflen, &len)) < 0 && (!p_ttimeout || waited * 100L < (p_ttm < 0 ? p_tm : p_ttm))) continue; - if (n == KEYLEN_REMOVED) /* key code removed */ + if (n == KEYLEN_REMOVED) // key code removed { if (must_redraw != 0 && !need_wait_return && (State & CMDLINE) == 0) { - /* Redrawing was postponed, do it now. */ + // Redrawing was postponed, do it now. update_screen(0); - setcursor(); /* put cursor back where it belongs */ + setcursor(); // put cursor back where it belongs } continue; } - if (n > 0) /* found a termcode: adjust length */ + if (n > 0) // found a termcode: adjust length len = n; - if (len == 0) /* nothing typed yet */ + if (len == 0) // nothing typed yet continue; - /* Handle modifier and/or special key code. */ + // Handle modifier and/or special key code. n = buf[0]; if (n == K_SPECIAL) { @@ -866,7 +865,7 @@ get_keystroke(void) if (has_mbyte) { if (MB_BYTE2LEN(n) > len) - continue; /* more bytes to get */ + continue; // more bytes to get buf[len >= buflen ? buflen - 1 : len] = NUL; n = (*mb_ptr2char)(buf); } @@ -888,7 +887,7 @@ get_keystroke(void) */ int get_number( - int colon, /* allow colon to abort */ + int colon, // allow colon to abort int *mouse_used) { int n = 0; @@ -898,16 +897,16 @@ get_number( if (mouse_used != NULL) *mouse_used = FALSE; - /* When not printing messages, the user won't know what to type, return a - * zero (as if CR was hit). */ + // When not printing messages, the user won't know what to type, return a + // zero (as if CR was hit). if (msg_silent != 0) return 0; #ifdef USE_ON_FLY_SCROLL - dont_scroll = TRUE; /* disallow scrolling here */ + dont_scroll = TRUE; // disallow scrolling here #endif ++no_mapping; - ++allow_keys; /* no mapping here, but recognize keys */ + ++allow_keys; // no mapping here, but recognize keys for (;;) { windgoto(msg_row, msg_col); @@ -938,7 +937,7 @@ get_number( stuffcharReadbuff(':'); if (!exmode_active) cmdline_row = msg_row; - skip_redraw = TRUE; /* skip redraw once */ + skip_redraw = TRUE; // skip redraw once do_redraw = FALSE; break; } @@ -962,7 +961,7 @@ prompt_for_number(int *mouse_used) int save_cmdline_row; int save_State; - /* When using ":silent" assume that <CR> was entered. */ + // When using ":silent" assume that <CR> was entered. if (mouse_used != NULL) msg_puts(_("Type number and <Enter> or click with mouse (empty cancels): ")); else @@ -1002,13 +1001,13 @@ msgmore(long n) { long pn; - if (global_busy /* no messages now, wait until global is finished */ - || !messaging()) /* 'lazyredraw' set, don't do messages now */ + if (global_busy // no messages now, wait until global is finished + || !messaging()) // 'lazyredraw' set, don't do messages now return; - /* We don't want to overwrite another important message, but do overwrite - * a previous "more lines" or "fewer lines" message, so that "5dd" and - * then "put" reports the last action. */ + // We don't want to overwrite another important message, but do overwrite + // a previous "more lines" or "fewer lines" message, so that "5dd" and + // then "put" reports the last action. if (keep_msg != NULL && !keep_msg_more) return; @@ -1054,7 +1053,7 @@ beep_flush(void) */ void vim_beep( - unsigned val) /* one of the BO_ values, e.g., BO_OPER */ + unsigned val) // one of the BO_ values, e.g., BO_OPER { #ifdef FEAT_EVAL called_vim_beep = TRUE; @@ -1068,8 +1067,8 @@ vim_beep( static int did_init = FALSE; static elapsed_T start_tv; - /* Only beep once per half a second, otherwise a sequence of beeps - * would freeze Vim. */ + // Only beep once per half a second, otherwise a sequence of beeps + // would freeze Vim. if (!did_init || ELAPSED_FUNC(start_tv) > 500) { did_init = TRUE; @@ -1077,15 +1076,15 @@ vim_beep( #endif if (p_vb #ifdef FEAT_GUI - /* While the GUI is starting up the termcap is set for - * the GUI but the output still goes to a terminal. */ + // While the GUI is starting up the termcap is set for + // the GUI but the output still goes to a terminal. && !(gui.in_use && gui.starting) #endif ) { out_str_cf(T_VB); #ifdef FEAT_VTP - /* No restore color information, refresh the screen. */ + // No restore color information, refresh the screen. if (has_vtp_working() != 0 # ifdef FEAT_TERMGUICOLORS && (p_tgc || (!p_tgc && t_colors >= 256)) @@ -1105,9 +1104,9 @@ vim_beep( #endif } - /* When 'debug' contains "beep" produce a message. If we are sourcing - * a script or executing a function give the user a hint where the beep - * comes from. */ + // When 'debug' contains "beep" produce a message. If we are sourcing + // a script or executing a function give the user a hint where the beep + // comes from. if (vim_strchr(p_debug, 'e') != NULL) { msg_source(HL_ATTR(HLF_W)); @@ -1132,7 +1131,7 @@ init_homedir(void) { char_u *var; - /* In case we are called a second time (when 'encoding' changes). */ + // In case we are called a second time (when 'encoding' changes). VIM_CLEAR(homedir); #ifdef VMS @@ -1192,7 +1191,7 @@ init_homedir(void) } } - if (var != NULL && *var == NUL) /* empty is same as not set */ + if (var != NULL && *var == NUL) // empty is same as not set var = NULL; if (enc_utf8 && var != NULL) @@ -1200,8 +1199,8 @@ init_homedir(void) int len; char_u *pp = NULL; - /* Convert from active codepage to UTF-8. Other conversions are - * not done, because they would fail for non-ASCII characters. */ + // Convert from active codepage to UTF-8. Other conversions are + // not done, because they would fail for non-ASCII characters. acp_to_enc(var, (int)STRLEN(var), &pp, &len); if (pp != NULL) { @@ -1286,40 +1285,40 @@ expand_env_save_opt(char_u *src, int one */ void expand_env( - char_u *src, /* input string e.g. "$HOME/vim.hlp" */ - char_u *dst, /* where to put the result */ - int dstlen) /* maximum length of the result */ + char_u *src, // input string e.g. "$HOME/vim.hlp" + char_u *dst, // where to put the result + int dstlen) // maximum length of the result { expand_env_esc(src, dst, dstlen, FALSE, FALSE, NULL); } void expand_env_esc( - char_u *srcp, /* input string e.g. "$HOME/vim.hlp" */ - char_u *dst, /* where to put the result */ - int dstlen, /* maximum length of the result */ - int esc, /* escape spaces in expanded variables */ - int one, /* "srcp" is one file name */ - char_u *startstr) /* start again after this (can be NULL) */ + char_u *srcp, // input string e.g. "$HOME/vim.hlp" + char_u *dst, // where to put the result + int dstlen, // maximum length of the result + int esc, // escape spaces in expanded variables + int one, // "srcp" is one file name + char_u *startstr) // start again after this (can be NULL) { char_u *src; char_u *tail; int c; char_u *var; int copy_char; - int mustfree; /* var was allocated, need to free it later */ - int at_start = TRUE; /* at start of a name */ + int mustfree; // var was allocated, need to free it later + int at_start = TRUE; // at start of a name int startstr_len = 0; if (startstr != NULL) startstr_len = (int)STRLEN(startstr); src = skipwhite(srcp); - --dstlen; /* leave one char space for "\," */ + --dstlen; // leave one char space for "\," while (*src && dstlen > 0) { #ifdef FEAT_EVAL - /* Skip over `=expr`. */ + // Skip over `=expr`. if (src[0] == '`' && src[1] == '=') { size_t len; @@ -1355,17 +1354,17 @@ expand_env_esc( * The variable name is copied into dst temporarily, because it may * be a string in read-only memory and a NUL needs to be appended. */ - if (*src != '~') /* environment var */ + if (*src != '~') // environment var { tail = src + 1; var = dst; c = dstlen - 1; #ifdef UNIX - /* Unix has ${var-name} type environment vars */ + // Unix has ${var-name} type environment vars if (*tail == '{' && !vim_isIDc('{')) { - tail++; /* ignore '{' */ + tail++; // ignore '{' while (c-- > 0 && *tail && *tail != '}') *var++ = *tail++; } @@ -1402,7 +1401,7 @@ expand_env_esc( } #endif } - /* home directory */ + // home directory else if ( src[1] == NUL || vim_ispathsep(src[1]) || vim_strchr((char_u *)" ,\t\n", src[1]) != NULL) @@ -1410,7 +1409,7 @@ expand_env_esc( var = homedir; tail = src + 1; } - else /* user directory */ + else // user directory { #if defined(UNIX) || (defined(VMS) && defined(USER_HOME)) /* @@ -1434,8 +1433,8 @@ expand_env_esc( */ # if defined(HAVE_GETPWNAM) && defined(HAVE_PWD_H) { - /* Note: memory allocated by getpwnam() is never freed. - * Calling endpwent() apparently doesn't help. */ + // Note: memory allocated by getpwnam() is never freed. + // Calling endpwent() apparently doesn't help. struct passwd *pw = (*dst == NUL) ? NULL : getpwnam((char *)dst + 1); @@ -1453,7 +1452,7 @@ expand_env_esc( mustfree = TRUE; } -# else /* !UNIX, thus VMS */ +# else // !UNIX, thus VMS /* * USER_HOME is a comma-separated list of * directories to search for the user account in. @@ -1483,17 +1482,17 @@ expand_env_esc( } } } -# endif /* UNIX */ +# endif // UNIX #else - /* cannot expand user's home directory, so don't try */ + // cannot expand user's home directory, so don't try var = NULL; - tail = (char_u *)""; /* for gcc */ -#endif /* UNIX || VMS */ + tail = (char_u *)""; // for gcc +#endif // UNIX || VMS } #ifdef BACKSLASH_IN_FILENAME - /* If 'shellslash' is set change backslashes to forward slashes. - * Can't use slash_adjust(), p_ssl may be set temporarily. */ + // If 'shellslash' is set change backslashes to forward slashes. + // Can't use slash_adjust(), p_ssl may be set temporarily. if (p_ssl && var != NULL && vim_strchr(var, '\\') != NULL) { char_u *p = vim_strsave(var); @@ -1509,8 +1508,8 @@ expand_env_esc( } #endif - /* If "var" contains white space, escape it with a backslash. - * Required for ":e ~/tt" when $HOME includes a space. */ + // If "var" contains white space, escape it with a backslash. + // Required for ":e ~/tt" when $HOME includes a space. if (esc && var != NULL && vim_strpbrk(var, (char_u *)" \t") != NULL) { char_u *p = vim_strsave_escaped(var, (char_u *)" \t"); @@ -1530,8 +1529,8 @@ expand_env_esc( STRCPY(dst, var); dstlen -= (int)STRLEN(var); c = (int)STRLEN(var); - /* if var[] ends in a path separator and tail[] starts - * with it, skip a character */ + // if var[] ends in a path separator and tail[] starts + // with it, skip a character if (*var != NUL && after_pathsep(dst, dst + c) #if defined(BACKSLASH_IN_FILENAME) || defined(AMIGA) && dst[-1] != ':' @@ -1546,7 +1545,7 @@ expand_env_esc( vim_free(var); } - if (copy_char) /* copy at least one char */ + if (copy_char) // copy at least one char { /* * Recognize the start of a new name, for '~'. @@ -1729,16 +1728,16 @@ vim_getenv(char_u *name, int *mustfree) #endif if (p != NULL) { - /* remove the file name */ + // remove the file name pend = gettail(p); - /* remove "doc/" from 'helpfile', if present */ + // remove "doc/" from 'helpfile', if present if (p == p_hf) pend = remove_tail(p, pend, (char_u *)"doc"); #ifdef USE_EXE_NAME # ifdef MACOS_X - /* remove "MacOS" from exe_name and add "Resources/vim" */ + // remove "MacOS" from exe_name and add "Resources/vim" if (p == exe_name) { char_u *pend1; @@ -1758,26 +1757,26 @@ vim_getenv(char_u *name, int *mustfree) } } # endif - /* remove "src/" from exe_name, if present */ + // remove "src/" from exe_name, if present if (p == exe_name) pend = remove_tail(p, pend, (char_u *)"src"); #endif - /* for $VIM, remove "runtime/" or "vim54/", if present */ + // for $VIM, remove "runtime/" or "vim54/", if present if (!vimruntime) { pend = remove_tail(p, pend, (char_u *)RUNTIME_DIRNAME); pend = remove_tail(p, pend, (char_u *)VIM_VERSION_NODOT); } - /* remove trailing path separator */ + // remove trailing path separator if (pend > p && after_pathsep(p, pend)) --pend; #ifdef MACOS_X if (p == exe_name || p == p_hf) #endif - /* check that the result is a directory name */ + // check that the result is a directory name p = vim_strnsave(p, (int)(pend - p)); if (p != NULL && !mch_isdir(p)) @@ -1785,7 +1784,7 @@ vim_getenv(char_u *name, int *mustfree) else { #ifdef USE_EXE_NAME - /* may add "/vim54" or "/runtime" if it exists */ + // may add "/vim54" or "/runtime" if it exists if (vimruntime && (pend = vim_version_dir(p)) != NULL) { vim_free(p); @@ -1798,11 +1797,11 @@ vim_getenv(char_u *name, int *mustfree) } #ifdef HAVE_PATHDEF - /* When there is a pathdef.c file we can use default_vim_dir and - * default_vimruntime_dir */ + // When there is a pathdef.c file we can use default_vim_dir and + // default_vimruntime_dir if (p == NULL) { - /* Only use default_vimruntime_dir when it is not empty */ + // Only use default_vimruntime_dir when it is not empty if (vimruntime && *default_vimruntime_dir != NUL) { p = default_vimruntime_dir; @@ -1909,7 +1908,7 @@ get_env_name( return NULL; # else # ifndef __WIN32__ - /* Borland C++ 5.2 has this in a header file. */ + // Borland C++ 5.2 has this in a header file. extern char **environ; # endif # define ENVNAMELEN 100 @@ -2053,9 +2052,9 @@ match_user(char_u *name) for (i = 0; i < ga_users.ga_len; i++) { if (STRCMP(((char_u **)ga_users.ga_data)[i], name) == 0) - return 2; /* full match */ + return 2; // full match if (STRNCMP(((char_u **)ga_users.ga_data)[i], name, n) == 0) - result = 1; /* partial match */ + result = 1; // partial match } return result; } @@ -2083,9 +2082,9 @@ concat_str(char_u *str1, char_u *str2) prepare_to_exit(void) { #if defined(SIGHUP) && defined(SIG_IGN) - /* Ignore SIGHUP, because a dropped connection causes a read error, which - * makes Vim exit and then handling SIGHUP causes various reentrance - * problems. */ + // Ignore SIGHUP, because a dropped connection causes a read error, which + // makes Vim exit and then handling SIGHUP causes various reentrance + // problems. signal(SIGHUP, SIG_IGN); #endif @@ -2093,7 +2092,7 @@ prepare_to_exit(void) if (gui.in_use) { gui.dying = TRUE; - out_trash(); /* trash any pending output */ + out_trash(); // trash any pending output } else #endif @@ -2123,29 +2122,29 @@ preserve_exit(void) prepare_to_exit(); - /* Setting this will prevent free() calls. That avoids calling free() - * recursively when free() was invoked with a bad pointer. */ + // Setting this will prevent free() calls. That avoids calling free() + // recursively when free() was invoked with a bad pointer. really_exiting = TRUE; out_str(IObuff); - screen_start(); /* don't know where cursor is now */ + screen_start(); // don't know where cursor is now out_flush(); - ml_close_notmod(); /* close all not-modified buffers */ + ml_close_notmod(); // close all not-modified buffers FOR_ALL_BUFFERS(buf) { if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL) { OUT_STR("Vim: preserving files...\n"); - screen_start(); /* don't know where cursor is now */ + screen_start(); // don't know where cursor is now out_flush(); - ml_sync_all(FALSE, FALSE); /* preserve all swap files */ + ml_sync_all(FALSE, FALSE); // preserve all swap files break; } } - ml_close_all(FALSE); /* close all memfiles, without deleting */ + ml_close_all(FALSE); // close all memfiles, without deleting OUT_STR("Vim: Finished.\n"); @@ -2208,8 +2207,8 @@ fast_breakcheck(void) char_u * get_cmd_output( char_u *cmd, - char_u *infile, /* optional input file name */ - int flags, /* can be SHELL_SILENT */ + char_u *infile, // optional input file name + int flags, // can be SHELL_SILENT int *ret_len) { char_u *tempname; @@ -2222,14 +2221,14 @@ get_cmd_output( if (check_restricted() || check_secure()) return NULL; - /* get a name for the temp file */ + // get a name for the temp file if ((tempname = vim_tempname('o', FALSE)) == NULL) { emsg(_(e_notmp)); return NULL; } - /* Add the redirection stuff */ + // Add the redirection stuff command = make_filter_cmd(cmd, infile, tempname); if (command == NULL) goto done; @@ -2248,7 +2247,7 @@ get_cmd_output( * read the names from the file into memory */ # ifdef VMS - /* created temporary file is not always readable as binary */ + // created temporary file is not always readable as binary fd = mch_fopen((char *)tempname, "r"); # else fd = mch_fopen((char *)tempname, READBIN); @@ -2261,7 +2260,7 @@ get_cmd_output( } fseek(fd, 0L, SEEK_END); - len = ftell(fd); /* get size of temp file */ + len = ftell(fd); // get size of temp file fseek(fd, 0L, SEEK_SET); buffer = alloc(len + 1); @@ -2272,7 +2271,7 @@ get_cmd_output( if (buffer == NULL) goto done; #ifdef VMS - len = i; /* VMS doesn't give us what we asked for... */ + len = i; // VMS doesn't give us what we asked for... #endif if (i != len) { @@ -2281,12 +2280,12 @@ get_cmd_output( } else if (ret_len == NULL) { - /* Change NUL into SOH, otherwise the string is truncated. */ + // Change NUL into SOH, otherwise the string is truncated. for (i = 0; i < len; ++i) if (buffer[i] == NUL) buffer[i] = 1; - buffer[len] = NUL; /* make sure the buffer is terminated */ + buffer[len] = NUL; // make sure the buffer is terminated } else *ret_len = len; @@ -2377,7 +2376,7 @@ get_cmd_output_as_rettv( if (p == NULL) { fclose(fd); - goto errret; /* type error; errmsg already given */ + goto errret; // type error; errmsg already given } len = STRLEN(p); if (len > 0 && fwrite(p, len, 1, fd) != 1) @@ -2392,8 +2391,8 @@ get_cmd_output_as_rettv( } } - /* Omit SHELL_COOKED when invoked with ":silent". Avoids that the shell - * echoes typeahead, that messes up the display. */ + // Omit SHELL_COOKED when invoked with ":silent". Avoids that the shell + // echoes typeahead, that messes up the display. if (!msg_silent) flags += SHELL_COOKED; @@ -2448,7 +2447,7 @@ get_cmd_output_as_rettv( { res = get_cmd_output(tv_get_string(&argvars[0]), infile, flags, NULL); #ifdef USE_CRNL - /* translate <CR><NL> into <NL> */ + // translate <CR><NL> into <NL> if (res != NULL) { char_u *s, *d; @@ -2531,14 +2530,14 @@ get_isolated_shell_name(void) p = skiptowhite(p_sh); if (*p == NUL) { - /* No white space, use the tail. */ + // No white space, use the tail. p = vim_strsave(gettail(p_sh)); } else { char_u *p1, *p2; - /* Find the last path separator before the space. */ + // Find the last path separator before the space. p1 = p_sh; for (p2 = p_sh; p2 < p; MB_PTR_ADV(p2)) if (vim_ispathsep(*p2)) @@ -2593,10 +2592,10 @@ add_time(char_u *buf, size_t buflen, tim { curtime = vim_localtime(&tt, &tmval); if (vim_time() - tt < (60L * 60L * 12L)) - /* within 12 hours */ + // within 12 hours (void)strftime((char *)buf, buflen, "%H:%M:%S", curtime); else - /* longer ago */ + // longer ago (void)strftime((char *)buf, buflen, "%Y/%m/%d %H:%M:%S", curtime); } else
--- a/src/misc2.c +++ b/src/misc2.c @@ -12,7 +12,7 @@ */ #include "vim.h" -static char_u *username = NULL; /* cached result of mch_get_user_name() */ +static char_u *username = NULL; // cached result of mch_get_user_name() static int coladvance2(pos_T *pos, int addspaces, int finetune, colnr_T wcol); @@ -22,9 +22,9 @@ static int coladvance2(pos_T *pos, int a int virtual_active(void) { - /* While an operator is being executed we return "virtual_op", because - * VIsual_active has already been reset, thus we can't check for "block" - * being used. */ + // While an operator is being executed we return "virtual_op", because + // VIsual_active has already been reset, thus we can't check for "block" + // being used. if (virtual_op != MAYBE) return virtual_op; return (ve_flags == VE_ALL @@ -58,7 +58,7 @@ coladvance_force(colnr_T wcol) curwin->w_valid &= ~VALID_VIRTCOL; else { - /* Virtcol is valid */ + // Virtcol is valid curwin->w_valid |= VALID_VIRTCOL; curwin->w_virtcol = wcol; } @@ -99,7 +99,7 @@ coladvance(colnr_T wcol) curwin->w_valid &= ~VALID_VIRTCOL; else if (*ml_get_cursor() != TAB) { - /* Virtcol is valid when not on a TAB */ + // Virtcol is valid when not on a TAB curwin->w_valid |= VALID_VIRTCOL; curwin->w_virtcol = wcol; } @@ -168,10 +168,10 @@ coladvance2( if (wcol / width > (colnr_T)csize / width && ((State & INSERT) == 0 || (int)wcol > csize + 1)) { - /* In case of line wrapping don't move the cursor beyond the - * right screen edge. In Insert mode allow going just beyond - * the last character (like what happens when typing and - * reaching the right window edge). */ + // In case of line wrapping don't move the cursor beyond the + // right screen edge. In Insert mode allow going just beyond + // the last character (like what happens when typing and + // reaching the right window edge). wcol = (csize / width + 1) * width - 1; } } @@ -179,7 +179,7 @@ coladvance2( ptr = line; while (col <= wcol && *ptr != NUL) { - /* Count a tab for what it's worth (if list mode not on) */ + // Count a tab for what it's worth (if list mode not on) #ifdef FEAT_LINEBREAK csize = win_lbr_chartabsize(curwin, line, ptr, col, &head); MB_PTR_ADV(ptr); @@ -199,7 +199,7 @@ coladvance2( { idx -= 1; # ifdef FEAT_LINEBREAK - /* Don't count the chars from 'showbreak'. */ + // Don't count the chars from 'showbreak'. csize -= head; # endif col -= csize; @@ -210,12 +210,12 @@ coladvance2( && wcol >= 0 && ((col != wcol && col != wcol + 1) || csize > 1)) { - /* 'virtualedit' is set: The difference between wcol and col is - * filled with spaces. */ + // 'virtualedit' is set: The difference between wcol and col is + // filled with spaces. if (line[idx] == NUL) { - /* Append spaces */ + // Append spaces int correct = wcol - col; char_u *newline = alloc(idx + correct + 1); int t; @@ -238,9 +238,9 @@ coladvance2( } else { - /* Break a tab */ + // Break a tab int linelen = (int)STRLEN(line); - int correct = wcol - col - csize + 1; /* negative!! */ + int correct = wcol - col - csize + 1; // negative!! char_u *newline; int t, s = 0; int v; @@ -282,7 +282,7 @@ coladvance2( { if (wcol == MAXCOL) { - /* The width of the last character is used to set coladd. */ + // The width of the last character is used to set coladd. if (!one_more) { colnr_T scol, ecol; @@ -295,7 +295,7 @@ coladvance2( { int b = (int)wcol - (int)col; - /* The difference between wcol and col is used to set coladd. */ + // The difference between wcol and col is used to set coladd. if (b > 0 && b < (MAXCOL - 2 * curwin->w_width)) pos->coladd = b; @@ -303,7 +303,7 @@ coladvance2( } } - /* prevent from moving onto a trail byte */ + // prevent from moving onto a trail byte if (has_mbyte) mb_adjustpos(curbuf, pos); @@ -333,11 +333,11 @@ inc(pos_T *lp) { char_u *p; - /* when searching position may be set to end of a line */ + // when searching position may be set to end of a line if (lp->col != MAXCOL) { p = ml_get_pos(lp); - if (*p != NUL) /* still within line, move to next char (may be NUL) */ + if (*p != NUL) // still within line, move to next char (may be NUL) { if (has_mbyte) { @@ -351,7 +351,7 @@ inc(pos_T *lp) return ((p[1] != NUL) ? 0 : 2); } } - if (lp->lnum != curbuf->b_ml.ml_line_count) /* there is a next line */ + if (lp->lnum != curbuf->b_ml.ml_line_count) // there is a next line { lp->col = 0; lp->lnum++; @@ -394,7 +394,7 @@ dec(pos_T *lp) lp->coladd = 0; if (lp->col == MAXCOL) { - /* past end of line */ + // past end of line p = ml_get(lp->lnum); lp->col = (colnr_T)STRLEN(p); if (has_mbyte) @@ -404,7 +404,7 @@ dec(pos_T *lp) if (lp->col > 0) { - /* still within line */ + // still within line lp->col--; if (has_mbyte) { @@ -416,7 +416,7 @@ dec(pos_T *lp) if (lp->lnum > 1) { - /* there is a prior line */ + // there is a prior line lp->lnum--; p = ml_get(lp->lnum); lp->col = (colnr_T)STRLEN(p); @@ -425,7 +425,7 @@ dec(pos_T *lp) return 1; } - /* at start of file */ + // at start of file return -1; } @@ -450,7 +450,7 @@ decl(pos_T *lp) linenr_T get_cursor_rel_lnum( win_T *wp, - linenr_T lnum) /* line number to get the result for */ + linenr_T lnum) // line number to get the result for { linenr_T cursor = wp->w_cursor.lnum; linenr_T retval = 0; @@ -463,8 +463,8 @@ get_cursor_rel_lnum( while (lnum > cursor) { (void)hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL); - /* if lnum and cursor are in the same fold, - * now lnum <= cursor */ + // if lnum and cursor are in the same fold, + // now lnum <= cursor if (lnum > cursor) retval++; lnum--; @@ -475,16 +475,15 @@ get_cursor_rel_lnum( while (lnum < cursor) { (void)hasFoldingWin(wp, lnum, NULL, &lnum, TRUE, NULL); - /* if lnum and cursor are in the same fold, - * now lnum >= cursor */ + // if lnum and cursor are in the same fold, + // now lnum >= cursor if (lnum < cursor) retval--; lnum++; } } - /* else if (lnum == cursor) - * retval = 0; - */ + // else if (lnum == cursor) + // retval = 0; } else #endif @@ -524,8 +523,8 @@ check_cursor_lnum(void) if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) { #ifdef FEAT_FOLDING - /* If there is a closed fold at the end of the file, put the cursor in - * its first line. Otherwise in the last line. */ + // If there is a closed fold at the end of the file, put the cursor in + // its first line. Otherwise in the last line. if (!hasFolding(curbuf->b_ml.ml_line_count, &curwin->w_cursor.lnum, NULL)) #endif @@ -559,10 +558,10 @@ check_cursor_col_win(win_T *win) win->w_cursor.col = 0; else if (win->w_cursor.col >= len) { - /* Allow cursor past end-of-line when: - * - in Insert mode or restarting Insert mode - * - in Visual mode and 'selection' isn't "old" - * - 'virtualedit' is set */ + // Allow cursor past end-of-line when: + // - in Insert mode or restarting Insert mode + // - in Visual mode and 'selection' isn't "old" + // - 'virtualedit' is set if ((State & INSERT) || restart_edit || (VIsual_active && *p_sel != 'o') || (ve_flags & VE_ONEMORE) @@ -571,7 +570,7 @@ check_cursor_col_win(win_T *win) else { win->w_cursor.col = len - 1; - /* Move the cursor to the head byte. */ + // Move the cursor to the head byte. if (has_mbyte) mb_adjustpos(win->w_buffer, &win->w_cursor); } @@ -579,9 +578,9 @@ check_cursor_col_win(win_T *win) else if (win->w_cursor.col < 0) win->w_cursor.col = 0; - /* If virtual editing is on, we can leave the cursor on the old position, - * only we must set it to virtual. But don't do it when at the end of the - * line. */ + // If virtual editing is on, we can leave the cursor on the old position, + // only we must set it to virtual. But don't do it when at the end of the + // line. if (oldcol == MAXCOL) win->w_cursor.coladd = 0; else if (ve_flags == VE_ALL) @@ -590,9 +589,9 @@ check_cursor_col_win(win_T *win) { win->w_cursor.coladd = oldcoladd - win->w_cursor.col; - /* Make sure that coladd is not more than the char width. - * Not for the last character, coladd is then used when the cursor - * is actually after the last character. */ + // Make sure that coladd is not more than the char width. + // Not for the last character, coladd is then used when the cursor + // is actually after the last character. if (win->w_cursor.col + 1 < len && win->w_cursor.coladd > 0) { int cs, ce; @@ -603,7 +602,7 @@ check_cursor_col_win(win_T *win) } } else - /* avoid weird number when there is a miscalculation or overflow */ + // avoid weird number when there is a miscalculation or overflow win->w_cursor.coladd = 0; } } @@ -678,9 +677,9 @@ leftcol_changed(void) else if (s < curwin->w_leftcol) { retval = TRUE; - if (coladvance(e + 1) == FAIL) /* there isn't another character */ + if (coladvance(e + 1) == FAIL) // there isn't another character { - curwin->w_leftcol = s; /* adjust w_leftcol instead */ + curwin->w_leftcol = s; // adjust w_leftcol instead changed_cline_bef_curs(); } } @@ -794,7 +793,7 @@ vim_mem_profile_dump(void) num_alloc, num_freed); } -#endif /* MEM_PROFILE */ +#endif // MEM_PROFILE #ifdef FEAT_EVAL int @@ -890,11 +889,11 @@ lalloc_clear(size_t size, int message) void * lalloc(size_t size, int message) { - void *p; /* pointer to new storage space */ - static int releasing = FALSE; /* don't do mf_release_all() recursive */ + void *p; // pointer to new storage space + static int releasing = FALSE; // don't do mf_release_all() recursive int try_again; #if defined(HAVE_AVAIL_MEM) - static size_t allocated = 0; /* allocated since last avail check */ + static size_t allocated = 0; // allocated since last avail check #endif // Safety check for allocating zero bytes @@ -926,20 +925,20 @@ lalloc(size_t size, int message) if ((p = malloc(size)) != NULL) { #ifndef HAVE_AVAIL_MEM - /* 1. No check for available memory: Just return. */ + // 1. No check for available memory: Just return. goto theend; #else - /* 2. Slow check for available memory: call mch_avail_mem() after - * allocating (KEEP_ROOM / 2) amount of memory. */ + // 2. Slow check for available memory: call mch_avail_mem() after + // allocating (KEEP_ROOM / 2) amount of memory. allocated += size; if (allocated < KEEP_ROOM / 2) goto theend; allocated = 0; - /* 3. check for available memory: call mch_avail_mem() */ + // 3. check for available memory: call mch_avail_mem() if (mch_avail_mem(TRUE) < KEEP_ROOM_KB && !releasing) { - free(p); /* System is low... no go! */ + free(p); // System is low... no go! p = NULL; } else @@ -954,8 +953,8 @@ lalloc(size_t size, int message) break; releasing = TRUE; - clear_sb_text(TRUE); /* free any scrollback text */ - try_again = mf_release_all(); /* release as many blocks as possible */ + clear_sb_text(TRUE); // free any scrollback text + try_again = mf_release_all(); // release as many blocks as possible releasing = FALSE; if (!try_again) @@ -1046,16 +1045,16 @@ free_all_mem(void) { buf_T *buf, *nextbuf; - /* When we cause a crash here it is caught and Vim tries to exit cleanly. - * Don't try freeing everything again. */ + // When we cause a crash here it is caught and Vim tries to exit cleanly. + // Don't try freeing everything again. if (entered_free_all_mem) return; entered_free_all_mem = TRUE; - /* Don't want to trigger autocommands from here on. */ + // Don't want to trigger autocommands from here on. block_autocmds(); - /* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */ + // Close all tabs and windows. Reset 'equalalways' to avoid redraws. p_ea = FALSE; if (first_tabpage != NULL && first_tabpage->tp_next != NULL) do_cmdline_cmd((char_u *)"tabonly!"); @@ -1063,7 +1062,7 @@ free_all_mem(void) do_cmdline_cmd((char_u *)"only!"); # if defined(FEAT_SPELL) - /* Free all spell info. */ + // Free all spell info. spell_free_all(); # endif @@ -1109,7 +1108,7 @@ free_all_mem(void) free_findfile(); # endif - /* Obviously named calls. */ + // Obviously named calls. free_all_autocmds(); clear_termcodes(); free_all_marks(); @@ -1134,9 +1133,9 @@ free_all_mem(void) if (curtab != NULL) diff_clear(curtab); # endif - clear_sb_text(TRUE); /* free any scrollback text */ - - /* Free some global vars. */ + clear_sb_text(TRUE); // free any scrollback text + + // Free some global vars. vim_free(username); # ifdef FEAT_CLIPBOARD vim_regfree(clip_exclude_prog); @@ -1145,7 +1144,7 @@ free_all_mem(void) vim_free(new_last_cmdline); set_keep_msg(NULL, 0); - /* Clear cmdline history. */ + // Clear cmdline history. p_hi = 0; init_history(); # ifdef FEAT_PROP_POPUP @@ -1171,11 +1170,11 @@ free_all_mem(void) // Destroy all windows. Must come before freeing buffers. win_free_all(); - /* Free all option values. Must come after closing windows. */ + // Free all option values. Must come after closing windows. free_all_options(); - /* Free all buffers. Reset 'autochdir' to avoid accessing things that - * were freed already. */ + // Free all buffers. Reset 'autochdir' to avoid accessing things that + // were freed already. # ifdef FEAT_AUTOCHDIR p_acd = FALSE; # endif @@ -1187,7 +1186,7 @@ free_all_mem(void) nextbuf = buf->b_next; close_buffer(NULL, buf, DOBUF_WIPE, FALSE, FALSE); if (bufref_valid(&bufref)) - buf = nextbuf; /* didn't work, try next one */ + buf = nextbuf; // didn't work, try next one else buf = firstbuf; } @@ -1196,7 +1195,7 @@ free_all_mem(void) free_arshape_buf(); # endif - /* Clear registers. */ + // Clear registers. clear_registers(); ResetRedobuff(); ResetRedobuff(); @@ -1205,7 +1204,7 @@ free_all_mem(void) vim_free(serverDelayedStartName); # endif - /* highlight info */ + // highlight info free_highlight(); reset_last_sourcing(); @@ -1217,11 +1216,11 @@ free_all_mem(void) } # ifdef UNIX - /* Machine-specific free. */ + // Machine-specific free. mch_free_mem(); # endif - /* message history */ + // message history for (;;) if (delete_first_msg() == FAIL) break; @@ -1233,17 +1232,17 @@ free_all_mem(void) timer_free_all(); # endif # ifdef FEAT_EVAL - /* must be after channel_free_all() with unrefs partials */ + // must be after channel_free_all() with unrefs partials eval_clear(); # endif # ifdef FEAT_JOB_CHANNEL - /* must be after eval_clear() with unrefs jobs */ + // must be after eval_clear() with unrefs jobs job_free_all(); # endif free_termoptions(); - /* screenlines (can't display anything now!) */ + // screenlines (can't display anything now!) free_screenlines(); # if defined(FEAT_SOUND) @@ -1347,18 +1346,18 @@ vim_strsave_escaped_ext( * First count the number of backslashes required. * Then allocate the memory and insert them. */ - length = 1; /* count the trailing NUL */ + length = 1; // count the trailing NUL for (p = string; *p; p++) { if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) { - length += l; /* count a multibyte char */ + length += l; // count a multibyte char p += l - 1; continue; } if (vim_strchr(esc_chars, *p) != NULL || (bsl && rem_backslash(p))) - ++length; /* count a backslash */ - ++length; /* count an ordinary char */ + ++length; // count a backslash + ++length; // count an ordinary char } escaped_string = alloc(length); if (escaped_string != NULL) @@ -1370,7 +1369,7 @@ vim_strsave_escaped_ext( { mch_memmove(p2, p, (size_t)l); p2 += l; - p += l - 1; /* skip multibyte char */ + p += l - 1; // skip multibyte char continue; } if (vim_strchr(esc_chars, *p) != NULL || (bsl && rem_backslash(p))) @@ -1411,47 +1410,47 @@ vim_strsave_shellescape(char_u *string, int l; int csh_like; - /* Only csh and similar shells expand '!' within single quotes. For sh and - * the like we must not put a backslash before it, it will be taken - * literally. If do_special is set the '!' will be escaped twice. - * Csh also needs to have "\n" escaped twice when do_special is set. */ + // Only csh and similar shells expand '!' within single quotes. For sh and + // the like we must not put a backslash before it, it will be taken + // literally. If do_special is set the '!' will be escaped twice. + // Csh also needs to have "\n" escaped twice when do_special is set. csh_like = csh_like_shell(); - /* First count the number of extra bytes required. */ - length = (unsigned)STRLEN(string) + 3; /* two quotes and a trailing NUL */ + // First count the number of extra bytes required. + length = (unsigned)STRLEN(string) + 3; // two quotes and a trailing NUL for (p = string; *p != NUL; MB_PTR_ADV(p)) { # ifdef MSWIN if (!p_ssl) { if (*p == '"') - ++length; /* " -> "" */ + ++length; // " -> "" } else # endif if (*p == '\'') - length += 3; /* ' => '\'' */ + length += 3; // ' => '\'' if ((*p == '\n' && (csh_like || do_newline)) || (*p == '!' && (csh_like || do_special))) { - ++length; /* insert backslash */ + ++length; // insert backslash if (csh_like && do_special) - ++length; /* insert backslash */ + ++length; // insert backslash } if (do_special && find_cmdline_var(p, &l) >= 0) { - ++length; /* insert backslash */ + ++length; // insert backslash p += l - 1; } } - /* Allocate memory for the result and fill it. */ + // Allocate memory for the result and fill it. escaped_string = alloc(length); if (escaped_string != NULL) { d = escaped_string; - /* add opening quote */ + // add opening quote # ifdef MSWIN if (!p_ssl) *d++ = '"'; @@ -1494,8 +1493,8 @@ vim_strsave_shellescape(char_u *string, } if (do_special && find_cmdline_var(p, &l) >= 0) { - *d++ = '\\'; /* insert backslash */ - while (--l >= 0) /* copy the var */ + *d++ = '\\'; // insert backslash + while (--l >= 0) // copy the var *d++ = *p++; continue; } @@ -1503,7 +1502,7 @@ vim_strsave_shellescape(char_u *string, MB_COPY_CHAR(p, d); } - /* add terminating quote and finish with a NUL */ + // add terminating quote and finish with a NUL # ifdef MSWIN if (!p_ssl) *d++ = '"'; @@ -1595,14 +1594,14 @@ strup_save(char_u *orig) l = utf_ptr2len(p); if (c == 0) { - /* overlong sequence, use only the first byte */ + // overlong sequence, use only the first byte c = *p; l = 1; } uc = utf_toupper(c); - /* Reallocate string when byte count changes. This is rare, - * thus it's OK to do another malloc()/free(). */ + // Reallocate string when byte count changes. This is rare, + // thus it's OK to do another malloc()/free(). newl = utf_char2len(uc); if (newl != l) { @@ -1623,10 +1622,10 @@ strup_save(char_u *orig) p += newl; } else if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) - p += l; /* skip multi-byte character */ + p += l; // skip multi-byte character else { - *p = TOUPPER_LOC(*p); /* note that toupper() can be a macro */ + *p = TOUPPER_LOC(*p); // note that toupper() can be a macro p++; } } @@ -1662,14 +1661,14 @@ strlow_save(char_u *orig) l = utf_ptr2len(p); if (c == 0) { - /* overlong sequence, use only the first byte */ + // overlong sequence, use only the first byte c = *p; l = 1; } lc = utf_tolower(c); - /* Reallocate string when byte count changes. This is rare, - * thus it's OK to do another malloc()/free(). */ + // Reallocate string when byte count changes. This is rare, + // thus it's OK to do another malloc()/free(). newl = utf_char2len(lc); if (newl != l) { @@ -1690,10 +1689,10 @@ strlow_save(char_u *orig) p += newl; } else if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) - p += l; /* skip multi-byte character */ + p += l; // skip multi-byte character else { - *p = TOLOWER_LOC(*p); /* note that tolower() can be a macro */ + *p = TOLOWER_LOC(*p); // note that tolower() can be a macro p++; } } @@ -1762,7 +1761,7 @@ copy_option_part( int len = 0; char_u *p = *option; - /* skip '.' at start of option part, for 'suffixes' */ + // skip '.' at start of option part, for 'suffixes' if (*p == '.') buf[len++] = *p++; while (*p != NUL && vim_strchr((char_u *)sep_chars, *p) == NULL) @@ -1778,9 +1777,9 @@ copy_option_part( } buf[len] = NUL; - if (*p != NUL && *p != ',') /* skip non-standard separator */ + if (*p != NUL && *p != ',') // skip non-standard separator ++p; - p = skip_to_option_part(p); /* p points to next file name */ + p = skip_to_option_part(p); // p points to next file name *option = p; return len; @@ -1832,13 +1831,13 @@ vim_stricmp(char *s1, char *s2) { i = (int)TOLOWER_LOC(*s1) - (int)TOLOWER_LOC(*s2); if (i != 0) - return i; /* this character different */ + return i; // this character different if (*s1 == NUL) - break; /* strings match until NUL */ + break; // strings match until NUL ++s1; ++s2; } - return 0; /* strings match */ + return 0; // strings match } #endif @@ -1857,14 +1856,14 @@ vim_strnicmp(char *s1, char *s2, size_t { i = (int)TOLOWER_LOC(*s1) - (int)TOLOWER_LOC(*s2); if (i != 0) - return i; /* this character different */ + return i; // this character different if (*s1 == NUL) - break; /* strings match until NUL */ + break; // strings match until NUL ++s1; ++s2; --len; } - return 0; /* strings match */ + return 0; // strings match } #endif @@ -1886,7 +1885,7 @@ vim_strchr(char_u *string, int c) { int l = utfc_ptr2len(p); - /* Avoid matching an illegal byte here. */ + // Avoid matching an illegal byte here. if (utf_ptr2char(p) == c && l > 1) return p; p += l; @@ -2177,7 +2176,7 @@ ga_append(garray_T *gap, int c) void append_ga_line(garray_T *gap) { - /* Remove trailing CR. */ + // Remove trailing CR. if (gap->ga_len > 0 && !curbuf->b_p_bin && ((char_u *)gap->ga_data)[gap->ga_len - 1] == CAR) @@ -2199,9 +2198,9 @@ append_ga_line(garray_T *gap) static struct modmasktable { - short mod_mask; /* Bit-mask for particular key modifier */ - short mod_flag; /* Bit(s) for particular key modifier */ - char_u name; /* Single letter name of modifier */ + short mod_mask; // Bit-mask for particular key modifier + short mod_flag; // Bit(s) for particular key modifier + char_u name; // Single letter name of modifier } mod_mask_table[] = { {MOD_MASK_ALT, MOD_MASK_ALT, (char_u)'M'}, @@ -2214,10 +2213,10 @@ static struct modmasktable #ifdef MACOS_X {MOD_MASK_CMD, MOD_MASK_CMD, (char_u)'D'}, #endif - /* 'A' must be the last one */ + // 'A' must be the last one {MOD_MASK_ALT, MOD_MASK_ALT, (char_u)'A'}, {0, 0, NUL} - /* NOTE: when adding an entry, update MAX_KEY_NAME_LEN! */ + // NOTE: when adding an entry, update MAX_KEY_NAME_LEN! }; /* @@ -2228,48 +2227,48 @@ static struct modmasktable static char_u modifier_keys_table[] = { -/* mod mask with modifier without modifier */ - MOD_MASK_SHIFT, '&', '9', '@', '1', /* begin */ - MOD_MASK_SHIFT, '&', '0', '@', '2', /* cancel */ - MOD_MASK_SHIFT, '*', '1', '@', '4', /* command */ - MOD_MASK_SHIFT, '*', '2', '@', '5', /* copy */ - MOD_MASK_SHIFT, '*', '3', '@', '6', /* create */ - MOD_MASK_SHIFT, '*', '4', 'k', 'D', /* delete char */ - MOD_MASK_SHIFT, '*', '5', 'k', 'L', /* delete line */ - MOD_MASK_SHIFT, '*', '7', '@', '7', /* end */ - MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_END, '@', '7', /* end */ - MOD_MASK_SHIFT, '*', '9', '@', '9', /* exit */ - MOD_MASK_SHIFT, '*', '0', '@', '0', /* find */ - MOD_MASK_SHIFT, '#', '1', '%', '1', /* help */ - MOD_MASK_SHIFT, '#', '2', 'k', 'h', /* home */ - MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_HOME, 'k', 'h', /* home */ - MOD_MASK_SHIFT, '#', '3', 'k', 'I', /* insert */ - MOD_MASK_SHIFT, '#', '4', 'k', 'l', /* left arrow */ - MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_LEFT, 'k', 'l', /* left arrow */ - MOD_MASK_SHIFT, '%', 'a', '%', '3', /* message */ - MOD_MASK_SHIFT, '%', 'b', '%', '4', /* move */ - MOD_MASK_SHIFT, '%', 'c', '%', '5', /* next */ - MOD_MASK_SHIFT, '%', 'd', '%', '7', /* options */ - MOD_MASK_SHIFT, '%', 'e', '%', '8', /* previous */ - MOD_MASK_SHIFT, '%', 'f', '%', '9', /* print */ - MOD_MASK_SHIFT, '%', 'g', '%', '0', /* redo */ - MOD_MASK_SHIFT, '%', 'h', '&', '3', /* replace */ - MOD_MASK_SHIFT, '%', 'i', 'k', 'r', /* right arr. */ - MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_RIGHT, 'k', 'r', /* right arr. */ - MOD_MASK_SHIFT, '%', 'j', '&', '5', /* resume */ - MOD_MASK_SHIFT, '!', '1', '&', '6', /* save */ - MOD_MASK_SHIFT, '!', '2', '&', '7', /* suspend */ - MOD_MASK_SHIFT, '!', '3', '&', '8', /* undo */ - MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_UP, 'k', 'u', /* up arrow */ - MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_DOWN, 'k', 'd', /* down arrow */ - - /* vt100 F1 */ +// mod mask with modifier without modifier + MOD_MASK_SHIFT, '&', '9', '@', '1', // begin + MOD_MASK_SHIFT, '&', '0', '@', '2', // cancel + MOD_MASK_SHIFT, '*', '1', '@', '4', // command + MOD_MASK_SHIFT, '*', '2', '@', '5', // copy + MOD_MASK_SHIFT, '*', '3', '@', '6', // create + MOD_MASK_SHIFT, '*', '4', 'k', 'D', // delete char + MOD_MASK_SHIFT, '*', '5', 'k', 'L', // delete line + MOD_MASK_SHIFT, '*', '7', '@', '7', // end + MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_END, '@', '7', // end + MOD_MASK_SHIFT, '*', '9', '@', '9', // exit + MOD_MASK_SHIFT, '*', '0', '@', '0', // find + MOD_MASK_SHIFT, '#', '1', '%', '1', // help + MOD_MASK_SHIFT, '#', '2', 'k', 'h', // home + MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_HOME, 'k', 'h', // home + MOD_MASK_SHIFT, '#', '3', 'k', 'I', // insert + MOD_MASK_SHIFT, '#', '4', 'k', 'l', // left arrow + MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_LEFT, 'k', 'l', // left arrow + MOD_MASK_SHIFT, '%', 'a', '%', '3', // message + MOD_MASK_SHIFT, '%', 'b', '%', '4', // move + MOD_MASK_SHIFT, '%', 'c', '%', '5', // next + MOD_MASK_SHIFT, '%', 'd', '%', '7', // options + MOD_MASK_SHIFT, '%', 'e', '%', '8', // previous + MOD_MASK_SHIFT, '%', 'f', '%', '9', // print + MOD_MASK_SHIFT, '%', 'g', '%', '0', // redo + MOD_MASK_SHIFT, '%', 'h', '&', '3', // replace + MOD_MASK_SHIFT, '%', 'i', 'k', 'r', // right arr. + MOD_MASK_CTRL, KS_EXTRA, (int)KE_C_RIGHT, 'k', 'r', // right arr. + MOD_MASK_SHIFT, '%', 'j', '&', '5', // resume + MOD_MASK_SHIFT, '!', '1', '&', '6', // save + MOD_MASK_SHIFT, '!', '2', '&', '7', // suspend + MOD_MASK_SHIFT, '!', '3', '&', '8', // undo + MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_UP, 'k', 'u', // up arrow + MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_DOWN, 'k', 'd', // down arrow + + // vt100 F1 MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_XF1, KS_EXTRA, (int)KE_XF1, MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_XF2, KS_EXTRA, (int)KE_XF2, MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_XF3, KS_EXTRA, (int)KE_XF3, MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_XF4, KS_EXTRA, (int)KE_XF4, - MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F1, 'k', '1', /* F1 */ + MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F1, 'k', '1', // F1 MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F2, 'k', '2', MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F3, 'k', '3', MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F4, 'k', '4', @@ -2278,7 +2277,7 @@ static char_u modifier_keys_table[] = MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F7, 'k', '7', MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F8, 'k', '8', MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F9, 'k', '9', - MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F10, 'k', ';', /* F10 */ + MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F10, 'k', ';', // F10 MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F11, 'F', '1', MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F12, 'F', '2', @@ -2310,7 +2309,7 @@ static char_u modifier_keys_table[] = MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F36, 'F', 'Q', MOD_MASK_SHIFT, KS_EXTRA, (int)KE_S_F37, 'F', 'R', - /* TAB pseudo code*/ + // TAB pseudo code MOD_MASK_SHIFT, 'k', 'B', KS_EXTRA, (int)KE_TAB, NUL @@ -2318,29 +2317,29 @@ static char_u modifier_keys_table[] = static struct key_name_entry { - int key; /* Special key code or ascii value */ - char_u *name; /* Name of key */ + int key; // Special key code or ascii value + char_u *name; // Name of key } key_names_table[] = { {' ', (char_u *)"Space"}, {TAB, (char_u *)"Tab"}, {K_TAB, (char_u *)"Tab"}, {NL, (char_u *)"NL"}, - {NL, (char_u *)"NewLine"}, /* Alternative name */ - {NL, (char_u *)"LineFeed"}, /* Alternative name */ - {NL, (char_u *)"LF"}, /* Alternative name */ + {NL, (char_u *)"NewLine"}, // Alternative name + {NL, (char_u *)"LineFeed"}, // Alternative name + {NL, (char_u *)"LF"}, // Alternative name {CAR, (char_u *)"CR"}, - {CAR, (char_u *)"Return"}, /* Alternative name */ - {CAR, (char_u *)"Enter"}, /* Alternative name */ + {CAR, (char_u *)"Return"}, // Alternative name + {CAR, (char_u *)"Enter"}, // Alternative name {K_BS, (char_u *)"BS"}, - {K_BS, (char_u *)"BackSpace"}, /* Alternative name */ + {K_BS, (char_u *)"BackSpace"}, // Alternative name {ESC, (char_u *)"Esc"}, {CSI, (char_u *)"CSI"}, {K_CSI, (char_u *)"xCSI"}, {'|', (char_u *)"Bar"}, {'\\', (char_u *)"Bslash"}, {K_DEL, (char_u *)"Del"}, - {K_DEL, (char_u *)"Delete"}, /* Alternative name */ + {K_DEL, (char_u *)"Delete"}, // Alternative name {K_KDEL, (char_u *)"kDel"}, {K_UP, (char_u *)"Up"}, {K_DOWN, (char_u *)"Down"}, @@ -2402,7 +2401,7 @@ static struct key_name_entry {K_HELP, (char_u *)"Help"}, {K_UNDO, (char_u *)"Undo"}, {K_INS, (char_u *)"Insert"}, - {K_INS, (char_u *)"Ins"}, /* Alternative name */ + {K_INS, (char_u *)"Ins"}, // Alternative name {K_KINS, (char_u *)"kInsert"}, {K_HOME, (char_u *)"Home"}, {K_KHOME, (char_u *)"kHome"}, @@ -2471,8 +2470,8 @@ static struct key_name_entry {K_MOUSEUP, (char_u *)"ScrollWheelDown"}, {K_MOUSELEFT, (char_u *)"ScrollWheelRight"}, {K_MOUSERIGHT, (char_u *)"ScrollWheelLeft"}, - {K_MOUSEDOWN, (char_u *)"MouseDown"}, /* OBSOLETE: Use */ - {K_MOUSEUP, (char_u *)"MouseUp"}, /* ScrollWheelXXX instead */ + {K_MOUSEDOWN, (char_u *)"MouseDown"}, // OBSOLETE: Use + {K_MOUSEUP, (char_u *)"MouseUp"}, // ScrollWheelXXX instead {K_X1MOUSE, (char_u *)"X1Mouse"}, {K_X1DRAG, (char_u *)"X1Drag"}, {K_X1RELEASE, (char_u *)"X1Release"}, @@ -2488,7 +2487,7 @@ static struct key_name_entry {K_CURSORHOLD, (char_u *)"CursorHold"}, {K_IGNORE, (char_u *)"Ignore"}, {0, NULL} - /* NOTE: When adding a long name update MAX_KEY_NAME_LEN. */ + // NOTE: When adding a long name update MAX_KEY_NAME_LEN. }; #define KEY_NAMES_TABLE_LEN (sizeof(key_names_table) / sizeof(struct key_name_entry)) @@ -2522,7 +2521,7 @@ simplify_key(int key, int *modifiers) if (*modifiers & (MOD_MASK_SHIFT | MOD_MASK_CTRL | MOD_MASK_ALT)) { - /* TAB is a special case */ + // TAB is a special case if (key == TAB && (*modifiers & MOD_MASK_SHIFT)) { *modifiers &= ~MOD_MASK_SHIFT; @@ -2587,7 +2586,7 @@ get_special_key_name(int c, int modifier string[0] = '<'; idx = 1; - /* Key that stands for a normal character. */ + // Key that stands for a normal character. if (IS_SPECIAL(c) && KEY2TERMCAP0(c) == KS_KEY) c = KEY2TERMCAP1(c); @@ -2608,7 +2607,7 @@ get_special_key_name(int c, int modifier } } - /* try to find the key in the special key table */ + // try to find the key in the special key table table_idx = find_special_key_in_table(c); /* @@ -2623,7 +2622,7 @@ get_special_key_name(int c, int modifier { c &= 0x7f; modifiers |= MOD_MASK_ALT; - /* try again, to find the un-alted key in the special key table */ + // try again, to find the un-alted key in the special key table table_idx = find_special_key_in_table(c); } if (table_idx < 0 && !vim_isprintc(c) && c < ' ') @@ -2637,7 +2636,7 @@ get_special_key_name(int c, int modifier } } - /* translate the modifier into a string */ + // translate the modifier into a string for (i = 0; mod_mask_table[i].name != 'A'; i++) if ((modifiers & mod_mask_table[i].mod_mask) == mod_mask_table[i].mod_flag) @@ -2646,7 +2645,7 @@ get_special_key_name(int c, int modifier string[idx++] = (char_u)'-'; } - if (table_idx < 0) /* unknown special key, may output t_xx */ + if (table_idx < 0) // unknown special key, may output t_xx { if (IS_SPECIAL(c)) { @@ -2655,7 +2654,7 @@ get_special_key_name(int c, int modifier string[idx++] = KEY2TERMCAP0(c); string[idx++] = KEY2TERMCAP1(c); } - /* Not a special key, only modifiers, output directly */ + // Not a special key, only modifiers, output directly else { if (has_mbyte && (*mb_char2len)(c) > 1) @@ -2670,7 +2669,7 @@ get_special_key_name(int c, int modifier } } } - else /* use name of special key */ + else // use name of special key { size_t len = STRLEN(key_names_table[table_idx].name); @@ -2723,7 +2722,7 @@ special_to_buf(int key, int modifiers, i { int dlen = 0; - /* Put the appropriate modifier in a string */ + // Put the appropriate modifier in a string if (modifiers != 0) { dst[dlen++] = K_SPECIAL; @@ -2776,7 +2775,7 @@ find_special_key( if (src[0] != '<') return 0; - /* Find end of modifier list */ + // Find end of modifier list last_dash = src; for (bp = src + 1; *bp == '-' || vim_isIDc(*bp); bp++) { @@ -2800,7 +2799,7 @@ find_special_key( } } if (bp[0] == 't' && bp[1] == '_' && bp[2] && bp[3]) - bp += 3; /* skip t_xx, xx may be '-' or '>' */ + bp += 3; // skip t_xx, xx may be '-' or '>' else if (STRNICMP(bp, "char-", 5) == 0) { vim_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0, TRUE); @@ -2814,11 +2813,11 @@ find_special_key( } } - if (*bp == '>') /* found matching '>' */ + if (*bp == '>') // found matching '>' { end_of_name = bp + 1; - /* Which modifiers are given? */ + // Which modifiers are given? modifiers = 0x0; for (bp = src + 1; bp < last_dash; bp++) { @@ -2826,7 +2825,7 @@ find_special_key( { bit = name_to_mod_mask(*bp); if (bit == 0x0) - break; /* Illegal modifier name */ + break; // Illegal modifier name modifiers |= bit; } } @@ -2839,7 +2838,7 @@ find_special_key( if (STRNICMP(last_dash + 1, "char-", 5) == 0 && VIM_ISDIGIT(last_dash[6])) { - /* <Char-123> or <Char-033> or <Char-0x33> */ + // <Char-123> or <Char-033> or <Char-0x33> vim_str2nr(last_dash + 6, NULL, &l, STR2NR_ALL, NULL, &n, 0, TRUE); if (l == 0) @@ -2853,7 +2852,7 @@ find_special_key( { int off = 1; - /* Modifier with single letter, or special key name. */ + // Modifier with single letter, or special key name. if (in_string && last_dash[1] == '\\' && last_dash[2] == '"') off = 2; if (has_mbyte) @@ -2884,7 +2883,7 @@ find_special_key( if (!keycode) { - /* don't want keycode, use single byte code */ + // don't want keycode, use single byte code if (key == K_BS) key = BS; else if (key == K_DEL || key == K_KDEL) @@ -2948,7 +2947,7 @@ extract_modifiers(int key, int *modp, in { key = Ctrl_chr(key); modifiers &= ~MOD_MASK_CTRL; - /* <C-@> is <Nul> */ + // <C-@> is <Nul> if (key == 0) key = K_ZERO; if (did_simplify != NULL) @@ -2956,14 +2955,14 @@ extract_modifiers(int key, int *modp, in } #ifdef MACOS_X - /* Command-key really special, no fancynest */ + // Command-key really special, no fancynest if (!(modifiers & MOD_MASK_CMD)) #endif if (simplify && (modifiers & MOD_MASK_ALT) && key < 0x80 && !enc_dbcs) // avoid creating a lead byte { key |= 0x80; - modifiers &= ~MOD_MASK_ALT; /* remove the META modifier */ + modifiers &= ~MOD_MASK_ALT; // remove the META modifier if (did_simplify != NULL) *did_simplify = TRUE; } @@ -3057,7 +3056,7 @@ get_fileformat(buf_T *buf) int get_fileformat_force( buf_T *buf, - exarg_T *eap) /* can be NULL! */ + exarg_T *eap) // can be NULL! { int c; @@ -3085,7 +3084,7 @@ get_fileformat_force( void set_fileformat( int t, - int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ + int opt_flags) // OPT_LOCAL and/or OPT_GLOBAL { char *p = NULL; @@ -3108,11 +3107,11 @@ set_fileformat( set_string_option_direct((char_u *)"ff", -1, (char_u *)p, OPT_FREE | opt_flags, 0); - /* This may cause the buffer to become (un)modified. */ + // This may cause the buffer to become (un)modified. check_status(curbuf); redraw_tabline = TRUE; #ifdef FEAT_TITLE - need_maketitle = TRUE; /* set window title later */ + need_maketitle = TRUE; // set window title later #endif } @@ -3165,13 +3164,13 @@ call_shell(char_u *cmd, int opt) else { #ifdef FEAT_GUI_MSWIN - /* Don't hide the pointer while executing a shell command. */ + // Don't hide the pointer while executing a shell command. gui_mch_mousehide(FALSE); #endif #ifdef FEAT_GUI ++hold_gui_events; #endif - /* The external command may update a tags file, clear cached tags. */ + // The external command may update a tags file, clear cached tags. tag_freematch(); if (cmd == NULL || *p_sxq == NUL) @@ -3269,7 +3268,7 @@ same_directory(char_u *f1, char_u *f2) char_u *t1; char_u *t2; - /* safety check */ + // safety check if (f1 == NULL || f2 == NULL) return FALSE; @@ -3327,11 +3326,11 @@ vim_chdirfile(char_u *fname, char *trigg illegal_slash(const char *name) { if (name[0] == NUL) - return FALSE; /* no file name is not illegal */ + return FALSE; // no file name is not illegal if (name[strlen(name) - 1] != '/') - return FALSE; /* no trailing slash */ + return FALSE; // no trailing slash if (mch_isdir((char_u *)name)) - return FALSE; /* trailing slash for a directory */ + return FALSE; // trailing slash for a directory return TRUE; } @@ -3341,8 +3340,8 @@ illegal_slash(const char *name) int vim_stat(const char *name, stat_T *stp) { - /* On Solaris stat() accepts "file/" as if it was "file". Return -1 if - * the name ends in "/" and it's not a directory. */ + // On Solaris stat() accepts "file/" as if it was "file". Return -1 if + // the name ends in "/" and it's not a directory. return illegal_slash(name) ? -1 : stat(name, stp); } #endif @@ -3355,9 +3354,9 @@ vim_stat(const char *name, stat_T *stp) cursorentry_T shape_table[SHAPE_IDX_COUNT] = { - /* The values will be filled in from the 'guicursor' and 'mouseshape' - * defaults when Vim starts. - * Adjust the SHAPE_IDX_ defines when making changes! */ + // The values will be filled in from the 'guicursor' and 'mouseshape' + // defaults when Vim starts. + // Adjust the SHAPE_IDX_ defines when making changes! {0, 0, 0, 700L, 400L, 250L, 0, 0, "n", SHAPE_CURSOR+SHAPE_MOUSE}, {0, 0, 0, 700L, 400L, 250L, 0, 0, "v", SHAPE_CURSOR+SHAPE_MOUSE}, {0, 0, 0, 700L, 400L, 250L, 0, 0, "i", SHAPE_CURSOR+SHAPE_MOUSE}, @@ -3384,8 +3383,8 @@ cursorentry_T shape_table[SHAPE_IDX_COUN */ static char * mshape_names[] = { - "arrow", /* default, must be the first one */ - "blank", /* hidden */ + "arrow", // default, must be the first one + "blank", // hidden "beam", "updown", "udsizing", @@ -3417,12 +3416,12 @@ parse_shape_opt(int what) char_u *commap; char_u *slashp; char_u *p, *endp; - int idx = 0; /* init for GCC */ + int idx = 0; // init for GCC int all_idx; int len; int i; long n; - int found_ve = FALSE; /* found "ve" flag */ + int found_ve = FALSE; // found "ve" flag int round; /* @@ -3458,7 +3457,7 @@ parse_shape_opt(int what) { if (all_idx < 0) { - /* Find the mode. */ + // Find the mode. if (modep[1] == '-' || modep[1] == ':') len = 1; else @@ -3487,13 +3486,13 @@ parse_shape_opt(int what) #ifdef FEAT_MOUSESHAPE if (what == SHAPE_MOUSE) { - /* Set the default, for the missing parts */ + // Set the default, for the missing parts shape_table[idx].mshape = 0; } else #endif { - /* Set the defaults, for the missing parts */ + // Set the defaults, for the missing parts shape_table[idx].shape = SHAPE_BLOCK; shape_table[idx].blinkwait = 700L; shape_table[idx].blinkon = 400L; @@ -3501,7 +3500,7 @@ parse_shape_opt(int what) } } - /* Parse the part after the colon */ + // Parse the part after the colon for (p = colonp + 1; *p && *p != ','; ) { #ifdef FEAT_MOUSESHAPE @@ -3530,7 +3529,7 @@ parse_shape_opt(int what) } } } - else /* if (what == SHAPE_MOUSE) */ + else // if (what == SHAPE_MOUSE) #endif { /* @@ -3554,7 +3553,7 @@ parse_shape_opt(int what) if (!VIM_ISDIGIT(*p)) return N_("E548: digit expected"); n = getdigits(&p); - if (len == 3) /* "ver" or "hor" */ + if (len == 3) // "ver" or "hor" { if (n == 0) return N_("E549: Illegal percentage"); @@ -3583,20 +3582,20 @@ parse_shape_opt(int what) shape_table[idx].shape = SHAPE_BLOCK; p += 5; } - else /* must be a highlight group name then */ + else // must be a highlight group name then { endp = vim_strchr(p, '-'); - if (commap == NULL) /* last part */ + if (commap == NULL) // last part { if (endp == NULL) - endp = p + STRLEN(p); /* find end of part */ + endp = p + STRLEN(p); // find end of part } else if (endp > commap || endp == NULL) endp = commap; slashp = vim_strchr(p, '/'); if (slashp != NULL && slashp < endp) { - /* "group/langmap_group" */ + // "group/langmap_group" i = syn_check_group(p, (int)(slashp - p)); p = slashp + 1; } @@ -3610,7 +3609,7 @@ parse_shape_opt(int what) } p = endp; } - } /* if (what != SHAPE_MOUSE) */ + } // if (what != SHAPE_MOUSE) if (*p == '-') ++p; @@ -3622,7 +3621,7 @@ parse_shape_opt(int what) } } - /* If the 's' flag is not given, use the 'v' cursor for 's' */ + // If the 's' flag is not given, use the 'v' cursor for 's' if (!found_ve) { #ifdef FEAT_MOUSESHAPE @@ -3719,19 +3718,19 @@ update_mouseshape(int shape_idx) { int new_mouse_shape; - /* Only works in GUI mode. */ + // Only works in GUI mode. if (!gui.in_use || gui.starting) return; - /* Postpone the updating when more is to come. Speeds up executing of - * mappings. */ + // Postpone the updating when more is to come. Speeds up executing of + // mappings. if (shape_idx == -1 && char_avail()) { postponed_mouseshape = TRUE; return; } - /* When ignoring the mouse don't change shape on the statusline. */ + // When ignoring the mouse don't change shape on the statusline. if (*p_mouse == NUL && (shape_idx == SHAPE_IDX_CLINE || shape_idx == SHAPE_IDX_STATUS @@ -3756,7 +3755,7 @@ update_mouseshape(int shape_idx) } # endif -#endif /* CURSOR_SHAPE */ +#endif // CURSOR_SHAPE /* @@ -3829,12 +3828,12 @@ qsort( for (i = gap; i < elm_count; ++i) for (j = i - gap; j >= 0; j -= gap) { - /* Compare the elements. */ + // Compare the elements. p1 = (char_u *)base + j * elm_size; p2 = (char_u *)base + (j + gap) * elm_size; if ((*cmp)((void *)p1, (void *)p2) <= 0) break; - /* Exchange the elements. */ + // Exchange the elements. mch_memmove(buf, p1, elm_size); mch_memmove(p1, p2, elm_size); mch_memmove(p2, buf, elm_size); @@ -3891,14 +3890,14 @@ sort_strings( #if !defined(HAVE_SETENV) && !defined(HAVE_PUTENV) -#define EXTRASIZE 5 /* increment to add to env. size */ - -static int envsize = -1; /* current size of environment */ -extern char **environ; /* the global which is your env. */ - -static int findenv(char *name); /* look for a name in the env. */ -static int newenv(void); /* copy env. from stack to heap */ -static int moreenv(void); /* incr. size of env. */ +#define EXTRASIZE 5 // increment to add to env. size + +static int envsize = -1; // current size of environment +extern char **environ; // the global which is your env. + +static int findenv(char *name); // look for a name in the env. +static int newenv(void); // copy env. from stack to heap +static int moreenv(void); // incr. size of env. int putenv(const char *string) @@ -3907,33 +3906,33 @@ putenv(const char *string) char *p; if (envsize < 0) - { /* first time putenv called */ - if (newenv() < 0) /* copy env. to heap */ + { // first time putenv called + if (newenv() < 0) // copy env. to heap return -1; } - i = findenv((char *)string); /* look for name in environment */ + i = findenv((char *)string); // look for name in environment if (i < 0) - { /* name must be added */ + { // name must be added for (i = 0; environ[i]; i++); if (i >= (envsize - 1)) - { /* need new slot */ + { // need new slot if (moreenv() < 0) return -1; } p = alloc(strlen(string) + 1); - if (p == NULL) /* not enough core */ + if (p == NULL) // not enough core return -1; - environ[i + 1] = 0; /* new end of env. */ + environ[i + 1] = 0; // new end of env. } else - { /* name already in env. */ + { // name already in env. p = vim_realloc(environ[i], strlen(string) + 1); if (p == NULL) return -1; } - sprintf(p, "%s", string); /* copy into env. */ + sprintf(p, "%s", string); // copy into env. environ[i] = p; return 0; @@ -4027,7 +4026,7 @@ vimpty_getenv(const char_u *string) } # endif -#endif /* !defined(HAVE_SETENV) && !defined(HAVE_PUTENV) */ +#endif // !defined(HAVE_SETENV) && !defined(HAVE_PUTENV) #if defined(FEAT_EVAL) || defined(FEAT_SPELL) || defined(PROTO) /* @@ -4108,8 +4107,8 @@ get3c(FILE *fd) get4c(FILE *fd) { int c; - /* Use unsigned rather than int otherwise result is undefined - * when left-shift sets the MSB. */ + // Use unsigned rather than int otherwise result is undefined + // when left-shift sets the MSB. unsigned n; c = getc(fd); @@ -4158,11 +4157,11 @@ read_string(FILE *fd, int cnt) int i; int c; - /* allocate memory */ + // allocate memory str = alloc(cnt + 1); if (str != NULL) { - /* Read the string. Quit when running into the EOF. */ + // Read the string. Quit when running into the EOF. for (i = 0; i < cnt; ++i) { c = getc(fd); @@ -4194,8 +4193,8 @@ put_bytes(FILE *fd, long_u nr, int len) #ifdef _MSC_VER # if (_MSC_VER <= 1200) -/* This line is required for VC6 without the service pack. Also see the - * matching #pragma below. */ +// This line is required for VC6 without the service pack. Also see the +// matching #pragma below. # pragma optimize("", off) # endif #endif @@ -4224,17 +4223,17 @@ time_to_bytes(time_T the_time, char_u *b int bi = 0; time_T wtime = the_time; - /* time_T can be up to 8 bytes in size, more than long_u, thus we - * can't use put_bytes() here. - * Another problem is that ">>" may do an arithmetic shift that keeps the - * sign. This happens for large values of wtime. A cast to long_u may - * truncate if time_T is 8 bytes. So only use a cast when it is 4 bytes, - * it's safe to assume that long_u is 4 bytes or more and when using 8 - * bytes the top bit won't be set. */ + // time_T can be up to 8 bytes in size, more than long_u, thus we + // can't use put_bytes() here. + // Another problem is that ">>" may do an arithmetic shift that keeps the + // sign. This happens for large values of wtime. A cast to long_u may + // truncate if time_T is 8 bytes. So only use a cast when it is 4 bytes, + // it's safe to assume that long_u is 4 bytes or more and when using 8 + // bytes the top bit won't be set. for (i = 7; i >= 0; --i) { if (i + 1 > (int)sizeof(time_T)) - /* ">>" doesn't work well when shifting more bits than avail */ + // ">>" doesn't work well when shifting more bits than avail buf[bi++] = 0; else { @@ -4274,7 +4273,7 @@ has_non_ascii(char_u *s) } #endif -#ifndef PROTO /* proto is defined in vim.h */ +#ifndef PROTO // proto is defined in vim.h # ifdef ELAPSED_TIMEVAL /* * Return time in msec since "start_tv". @@ -4368,7 +4367,7 @@ mch_parse_cmd(char_u *cmd, int use_shcf, { if (use_shcf) { - /* Account for possible multiple args in p_shcf. */ + // Account for possible multiple args in p_shcf. p = p_shcf; for (;;) { @@ -4381,7 +4380,7 @@ mch_parse_cmd(char_u *cmd, int use_shcf, } *argv = ALLOC_MULT(char *, *argc + 4); - if (*argv == NULL) /* out of memory */ + if (*argv == NULL) // out of memory return FAIL; } } @@ -4400,7 +4399,7 @@ build_argv_from_string(char_u *cmd, char char_u *cmd_copy; int i; - /* Make a copy, parsing will modify "cmd". */ + // Make a copy, parsing will modify "cmd". cmd_copy = vim_strsave(cmd); if (cmd_copy == NULL || mch_parse_cmd(cmd_copy, FALSE, argv, argc) == FAIL) @@ -4426,7 +4425,7 @@ build_argv_from_list(list_T *l, char *** listitem_T *li; char_u *s; - /* Pass argv[] to mch_call_shell(). */ + // Pass argv[] to mch_call_shell(). *argv = ALLOC_MULT(char *, l->lv_len + 1); if (*argv == NULL) return FAIL;
--- a/src/move.c +++ b/src/move.c @@ -25,11 +25,11 @@ static void curs_rows(win_T *wp); typedef struct { - linenr_T lnum; /* line number */ + linenr_T lnum; // line number #ifdef FEAT_DIFF - int fill; /* filler lines */ + int fill; // filler lines #endif - int height; /* height of added line */ + int height; // height of added line } lineoff_T; static void topline_back(lineoff_T *lp); @@ -108,7 +108,7 @@ comp_botline(win_T *wp) #endif } - /* wp->w_botline is the line that is just below the window */ + // wp->w_botline is the line that is just below the window wp->w_botline = lnum; wp->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP; @@ -192,8 +192,8 @@ update_topline(void) long *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so; int save_so = *so_ptr; - /* If there is no valid screen and when the window height is zero just use - * the cursor line. */ + // If there is no valid screen and when the window height is zero just use + // the cursor line. if (!screen_valid(TRUE) || curwin->w_height == 0) { curwin->w_topline = curwin->w_cursor.lnum; @@ -207,7 +207,7 @@ update_topline(void) if (curwin->w_valid & VALID_TOPLINE) return; - /* When dragging with the mouse, don't scroll that quickly */ + // When dragging with the mouse, don't scroll that quickly if (mouse_dragging > 0) *so_ptr = mouse_dragging - 1; @@ -219,7 +219,7 @@ update_topline(void) /* * If the buffer is empty, always set topline to 1. */ - if (BUFEMPTY()) /* special case - file is empty */ + if (BUFEMPTY()) // special case - file is empty { if (curwin->w_topline != 1) redraw_later(NOT_VALID); @@ -237,16 +237,16 @@ update_topline(void) { if (curwin->w_topline > 1) { - /* If the cursor is above topline, scrolling is always needed. - * If the cursor is far below topline and there is no folding, - * scrolling down is never needed. */ + // If the cursor is above topline, scrolling is always needed. + // If the cursor is far below topline and there is no folding, + // scrolling down is never needed. if (curwin->w_cursor.lnum < curwin->w_topline) check_topline = TRUE; else if (check_top_offset()) check_topline = TRUE; } #ifdef FEAT_DIFF - /* Check if there are more filler lines than allowed. */ + // Check if there are more filler lines than allowed. if (!check_topline && curwin->w_topfill > diff_check_fill(curwin, curwin->w_topline)) check_topline = TRUE; @@ -261,15 +261,15 @@ update_topline(void) #ifdef FEAT_FOLDING if (hasAnyFolding(curwin)) { - /* Count the number of logical lines between the cursor and - * topline + scrolloff (approximation of how much will be - * scrolled). */ + // Count the number of logical lines between the cursor and + // topline + scrolloff (approximation of how much will be + // scrolled). n = 0; for (lnum = curwin->w_cursor.lnum; - lnum < curwin->w_topline + *so_ptr; ++lnum) + lnum < curwin->w_topline + *so_ptr; ++lnum) { ++n; - /* stop at end of file or when we know we are far off */ + // stop at end of file or when we know we are far off if (lnum >= curbuf->b_ml.ml_line_count || n >= halfheight) break; (void)hasFolding(lnum, NULL, &lnum); @@ -279,9 +279,9 @@ update_topline(void) #endif n = curwin->w_topline + *so_ptr - curwin->w_cursor.lnum; - /* If we weren't very close to begin with, we scroll to put the - * cursor in the middle of the window. Otherwise put the cursor - * near the top of the window. */ + // If we weren't very close to begin with, we scroll to put the + // cursor in the middle of the window. Otherwise put the cursor + // near the top of the window. if (n >= halfheight) scroll_cursor_halfway(FALSE); else @@ -294,7 +294,7 @@ update_topline(void) else { #ifdef FEAT_FOLDING - /* Make sure topline is the first line of a fold. */ + // Make sure topline is the first line of a fold. (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); #endif check_botline = TRUE; @@ -327,13 +327,13 @@ update_topline(void) { lineoff_T loff; - /* Cursor is (a few lines) above botline, check if there are - * 'scrolloff' window lines below the cursor. If not, need to - * scroll. */ + // Cursor is (a few lines) above botline, check if there are + // 'scrolloff' window lines below the cursor. If not, need to + // scroll. n = curwin->w_empty_rows; loff.lnum = curwin->w_cursor.lnum; #ifdef FEAT_FOLDING - /* In a fold go to its last line. */ + // In a fold go to its last line. (void)hasFolding(loff.lnum, NULL, &loff.lnum); #endif #ifdef FEAT_DIFF @@ -353,11 +353,11 @@ update_topline(void) botline_forw(&loff); } if (n >= *so_ptr) - /* sufficient context, no need to scroll */ + // sufficient context, no need to scroll check_botline = FALSE; } else - /* sufficient context, no need to scroll */ + // sufficient context, no need to scroll check_botline = FALSE; } if (check_botline) @@ -365,15 +365,15 @@ update_topline(void) #ifdef FEAT_FOLDING if (hasAnyFolding(curwin)) { - /* Count the number of logical lines between the cursor and - * botline - scrolloff (approximation of how much will be - * scrolled). */ + // Count the number of logical lines between the cursor and + // botline - scrolloff (approximation of how much will be + // scrolled). line_count = 0; for (lnum = curwin->w_cursor.lnum; - lnum >= curwin->w_botline - *so_ptr; --lnum) + lnum >= curwin->w_botline - *so_ptr; --lnum) { ++line_count; - /* stop at end of file or when we know we are far off */ + // stop at end of file or when we know we are far off if (lnum <= 0 || line_count > curwin->w_height + 1) break; (void)hasFolding(lnum, &lnum, NULL); @@ -409,7 +409,7 @@ update_topline(void) } else redraw_later(VALID); - /* May need to set w_skipcol when cursor in w_topline. */ + // May need to set w_skipcol when cursor in w_topline. if (curwin->w_cursor.lnum == curwin->w_topline) validate_cursor(); } @@ -450,15 +450,15 @@ check_top_offset(void) loff.lnum = curwin->w_cursor.lnum; #ifdef FEAT_DIFF loff.fill = 0; - n = curwin->w_topfill; /* always have this context */ + n = curwin->w_topfill; // always have this context #else n = 0; #endif - /* Count the visible screen lines above the cursor line. */ + // Count the visible screen lines above the cursor line. while (n < so) { topline_back(&loff); - /* Stop when included a line above the window. */ + // Stop when included a line above the window. if (loff.lnum < curwin->w_topline #ifdef FEAT_DIFF || (loff.lnum == curwin->w_topline && loff.fill > 0) @@ -535,10 +535,10 @@ changed_window_setting_win(win_T *wp) set_topline(win_T *wp, linenr_T lnum) { #ifdef FEAT_FOLDING - /* go to first of folded lines */ + // go to first of folded lines (void)hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL); #endif - /* Approximate the value of w_botline */ + // Approximate the value of w_botline wp->w_botline += lnum - wp->w_topline; wp->w_topline = lnum; wp->w_topline_was_set = TRUE; @@ -546,7 +546,7 @@ set_topline(win_T *wp, linenr_T lnum) wp->w_topfill = 0; #endif wp->w_valid &= ~(VALID_WROW|VALID_CROW|VALID_BOTLINE|VALID_TOPLINE); - /* Don't set VALID_TOPLINE here, 'scrolloff' needs to be checked. */ + // Don't set VALID_TOPLINE here, 'scrolloff' needs to be checked. redraw_later(VALID); } @@ -675,7 +675,7 @@ curs_rows(win_T *wp) long fold_count; #endif - /* Check if wp->w_lines[].wl_size is invalid */ + // Check if wp->w_lines[].wl_size is invalid all_invalid = (!redrawing() || wp->w_lines_valid == 0 || wp->w_lines[0].wl_lnum > wp->w_topline); @@ -687,12 +687,12 @@ curs_rows(win_T *wp) if (!all_invalid && i < wp->w_lines_valid) { if (wp->w_lines[i].wl_lnum < lnum || !wp->w_lines[i].wl_valid) - continue; /* skip changed or deleted lines */ + continue; // skip changed or deleted lines if (wp->w_lines[i].wl_lnum == lnum) { #ifdef FEAT_FOLDING - /* Check for newly inserted lines below this row, in which - * case we need to check for folded lines. */ + // Check for newly inserted lines below this row, in which + // case we need to check for folded lines. if (!wp->w_buffer->b_mod_set || wp->w_lines[i].wl_lastlnum < wp->w_cursor.lnum || wp->w_buffer->b_mod_top @@ -701,7 +701,7 @@ curs_rows(win_T *wp) valid = TRUE; } else if (wp->w_lines[i].wl_lnum > lnum) - --i; /* hold at inserted lines */ + --i; // hold at inserted lines } if (valid #ifdef FEAT_DIFF @@ -711,7 +711,7 @@ curs_rows(win_T *wp) { #ifdef FEAT_FOLDING lnum = wp->w_lines[i].wl_lastlnum + 1; - /* Cursor inside folded lines, don't count this row */ + // Cursor inside folded lines, don't count this row if (lnum > wp->w_cursor.lnum) break; #else @@ -765,7 +765,7 @@ curs_rows(win_T *wp) } else if (i > wp->w_lines_valid) { - /* a line that is too long to fit on the last screen line */ + // a line that is too long to fit on the last screen line wp->w_cline_height = 0; #ifdef FEAT_FOLDING wp->w_cline_folded = hasFoldingWin(wp, wp->w_cursor.lnum, @@ -854,11 +854,11 @@ validate_cursor_col(void) col += off; width = curwin->w_width - off + curwin_col_off2(); - /* long line wrapping, adjust curwin->w_wrow */ + // long line wrapping, adjust curwin->w_wrow if (curwin->w_p_wrap && col >= (colnr_T)curwin->w_width && width > 0) - /* use same formula as what is used in curs_columns() */ + // use same formula as what is used in curs_columns() col -= ((col - curwin->w_width) / width + 1) * width; if (col > (int)curwin->w_leftcol) col -= curwin->w_leftcol; @@ -922,10 +922,10 @@ curwin_col_off2(void) */ void curs_columns( - int may_scroll) /* when TRUE, may scroll horizontally */ + int may_scroll) // when TRUE, may scroll horizontally { int diff; - int extra; /* offset for first screen line */ + int extra; // offset for first screen line int off_left, off_right; int n; int p_lines; @@ -954,14 +954,14 @@ curs_columns( */ #ifdef FEAT_FOLDING if (curwin->w_cline_folded) - /* In a folded line the cursor is always in the first column */ + // In a folded line the cursor is always in the first column startcol = curwin->w_virtcol = endcol = curwin->w_leftcol; else #endif getvvcol(curwin, &curwin->w_cursor, &startcol, &(curwin->w_virtcol), &endcol); - /* remove '$' from change command when cursor moves onto it */ + // remove '$' from change command when cursor moves onto it if (startcol > dollar_vcol) dollar_vcol = -1; @@ -977,7 +977,7 @@ curs_columns( textwidth = curwin->w_width - extra; if (textwidth <= 0) { - /* No room for text, put cursor in last char of window. */ + // No room for text, put cursor in last char of window. curwin->w_wcol = curwin->w_width - 1; curwin->w_wrow = curwin->w_height - 1; } @@ -985,22 +985,22 @@ curs_columns( { width = textwidth + curwin_col_off2(); - /* long line wrapping, adjust curwin->w_wrow */ + // long line wrapping, adjust curwin->w_wrow if (curwin->w_wcol >= curwin->w_width) { #ifdef FEAT_LINEBREAK char_u *sbr; #endif - /* this same formula is used in validate_cursor_col() */ + // this same formula is used in validate_cursor_col() n = (curwin->w_wcol - curwin->w_width) / width + 1; curwin->w_wcol -= n * width; curwin->w_wrow += n; #ifdef FEAT_LINEBREAK - /* When cursor wraps to first char of next line in Insert - * mode, the 'showbreak' string isn't shown, backup to first - * column */ + // When cursor wraps to first char of next line in Insert + // mode, the 'showbreak' string isn't shown, backup to first + // column sbr = get_showbreak_value(curwin); if (*sbr && *ml_get_cursor() == NUL && curwin->w_wcol == (int)vim_strsize(sbr)) @@ -1009,9 +1009,9 @@ curs_columns( } } - /* No line wrapping: compute curwin->w_leftcol if scrolling is on and line - * is not folded. - * If scrolling is off, curwin->w_leftcol is assumed to be 0 */ + // No line wrapping: compute curwin->w_leftcol if scrolling is on and line + // is not folded. + // If scrolling is off, curwin->w_leftcol is assumed to be 0 else if (may_scroll #ifdef FEAT_FOLDING && !curwin->w_cline_folded @@ -1034,8 +1034,8 @@ curs_columns( else diff = off_right; - /* When far off or not enough room on either side, put cursor in - * middle of window. */ + // When far off or not enough room on either side, put cursor in + // middle of window. if (p_ss == 0 || diff >= textwidth / 2 || off_right >= off_left) new_leftcol = curwin->w_wcol - extra - textwidth / 2; else @@ -1052,7 +1052,7 @@ curs_columns( if (new_leftcol != (int)curwin->w_leftcol) { curwin->w_leftcol = new_leftcol; - /* screen has to be redrawn with new curwin->w_leftcol */ + // screen has to be redrawn with new curwin->w_leftcol redraw_later(NOT_VALID); } } @@ -1064,8 +1064,8 @@ curs_columns( curwin->w_wcol = 0; #ifdef FEAT_DIFF - /* Skip over filler lines. At the top use w_topfill, there - * may be some filler lines above the window. */ + // Skip over filler lines. At the top use w_topfill, there + // may be some filler lines above the window. if (curwin->w_cursor.lnum == curwin->w_topline) curwin->w_wrow += curwin->w_topfill; else @@ -1092,17 +1092,17 @@ curs_columns( && width > 0 && curwin->w_width != 0) { - /* Cursor past end of screen. Happens with a single line that does - * not fit on screen. Find a skipcol to show the text around the - * cursor. Avoid scrolling all the time. compute value of "extra": - * 1: Less than 'scrolloff' lines above - * 2: Less than 'scrolloff' lines below - * 3: both of them */ + // Cursor past end of screen. Happens with a single line that does + // not fit on screen. Find a skipcol to show the text around the + // cursor. Avoid scrolling all the time. compute value of "extra": + // 1: Less than 'scrolloff' lines above + // 2: Less than 'scrolloff' lines below + // 3: both of them extra = 0; if (curwin->w_skipcol + so * width > curwin->w_virtcol) extra = 1; - /* Compute last display line of the buffer line that we want at the - * bottom of the window. */ + // Compute last display line of the buffer line that we want at the + // bottom of the window. if (p_lines == 0) p_lines = plines_win(curwin, curwin->w_cursor.lnum, FALSE); --p_lines; @@ -1115,20 +1115,20 @@ curs_columns( if (extra == 3 || p_lines < so * 2) { - /* not enough room for 'scrolloff', put cursor in the middle */ + // not enough room for 'scrolloff', put cursor in the middle n = curwin->w_virtcol / width; if (n > curwin->w_height / 2) n -= curwin->w_height / 2; else n = 0; - /* don't skip more than necessary */ + // don't skip more than necessary if (n > p_lines - curwin->w_height + 1) n = p_lines - curwin->w_height + 1; curwin->w_skipcol = n * width; } else if (extra == 1) { - /* less then 'scrolloff' lines above, decrease skipcol */ + // less then 'scrolloff' lines above, decrease skipcol extra = (curwin->w_skipcol + so * width - curwin->w_virtcol + width - 1) / width; if (extra > 0) @@ -1140,7 +1140,7 @@ curs_columns( } else if (extra == 2) { - /* less then 'scrolloff' lines below, increase skipcol */ + // less then 'scrolloff' lines below, increase skipcol endcol = (n - curwin->w_height + 1) * width; while (endcol > curwin->w_virtcol) endcol -= width; @@ -1151,7 +1151,7 @@ curs_columns( curwin->w_wrow -= curwin->w_skipcol / width; if (curwin->w_wrow >= curwin->w_height) { - /* small window, make sure cursor is in it */ + // small window, make sure cursor is in it extra = curwin->w_wrow - curwin->w_height + 1; curwin->w_skipcol += extra * width; curwin->w_wrow -= extra; @@ -1169,7 +1169,7 @@ curs_columns( redraw_later(NOT_VALID); #ifdef FEAT_SYN_HL - /* Redraw when w_virtcol changes and 'cursorcolumn' is set */ + // Redraw when w_virtcol changes and 'cursorcolumn' is set if (curwin->w_p_cuc && (curwin->w_valid & VALID_VIRTCOL) == 0 && !pum_visible()) redraw_later(SOME_VALID); @@ -1279,19 +1279,19 @@ f_screenpos(typval_T *argvars UNUSED, ty void scrolldown( long line_count, - int byfold UNUSED) /* TRUE: count a closed fold as one line */ + int byfold UNUSED) // TRUE: count a closed fold as one line { - long done = 0; /* total # of physical lines done */ + long done = 0; // total # of physical lines done int wrow; int moved = FALSE; #ifdef FEAT_FOLDING linenr_T first; - /* Make sure w_topline is at the first of a sequence of folded lines. */ + // Make sure w_topline is at the first of a sequence of folded lines. (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); #endif - validate_cursor(); /* w_wrow needs to be valid */ + validate_cursor(); // w_wrow needs to be valid while (line_count-- > 0) { #ifdef FEAT_DIFF @@ -1311,7 +1311,7 @@ scrolldown( curwin->w_topfill = 0; #endif #ifdef FEAT_FOLDING - /* A sequence of folded lines only counts for one logical line */ + // A sequence of folded lines only counts for one logical line if (hasFolding(curwin->w_topline, &first, NULL)) { ++done; @@ -1324,11 +1324,11 @@ scrolldown( #endif done += PLINES_NOFILL(curwin->w_topline); } - --curwin->w_botline; /* approximate w_botline */ + --curwin->w_botline; // approximate w_botline invalidate_botline(); } - curwin->w_wrow += done; /* keep w_wrow updated */ - curwin->w_cline_row += done; /* keep w_cline_row updated */ + curwin->w_wrow += done; // keep w_wrow updated + curwin->w_cline_row += done; // keep w_cline_row updated #ifdef FEAT_DIFF if (curwin->w_cursor.lnum == curwin->w_topline) @@ -1369,7 +1369,7 @@ scrolldown( if (moved) { #ifdef FEAT_FOLDING - /* Move cursor to first line of closed fold. */ + // Move cursor to first line of closed fold. foldAdjustCursor(); #endif coladvance(curwin->w_curswant); @@ -1382,7 +1382,7 @@ scrolldown( void scrollup( long line_count, - int byfold UNUSED) /* TRUE: count a closed fold as one line */ + int byfold UNUSED) // TRUE: count a closed fold as one line { #if defined(FEAT_FOLDING) || defined(FEAT_DIFF) linenr_T lnum; @@ -1399,7 +1399,7 @@ scrollup( # endif ) { - /* count each sequence of folded lines as one logical line */ + // count each sequence of folded lines as one logical line lnum = curwin->w_topline; while (line_count--) { @@ -1421,7 +1421,7 @@ scrollup( # endif } } - /* approximate w_botline */ + // approximate w_botline curwin->w_botline += lnum - curwin->w_topline; curwin->w_topline = lnum; } @@ -1429,7 +1429,7 @@ scrollup( #endif { curwin->w_topline += line_count; - curwin->w_botline += line_count; /* approximate w_botline */ + curwin->w_botline += line_count; // approximate w_botline } if (curwin->w_topline > curbuf->b_ml.ml_line_count) @@ -1443,7 +1443,7 @@ scrollup( #ifdef FEAT_FOLDING if (hasAnyFolding(curwin)) - /* Make sure w_topline is at the first of a sequence of folded lines. */ + // Make sure w_topline is at the first of a sequence of folded lines. (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); #endif @@ -1464,7 +1464,7 @@ scrollup( void check_topfill( win_T *wp, - int down) /* when TRUE scroll down when not enough space */ + int down) // when TRUE scroll down when not enough space { int n; @@ -1529,7 +1529,7 @@ scrolldown_clamp(void) ) return; - validate_cursor(); /* w_wrow needs to be valid */ + validate_cursor(); // w_wrow needs to be valid /* * Compute the row number of the last row of the cursor line @@ -1571,7 +1571,7 @@ scrolldown_clamp(void) #ifdef FEAT_FOLDING (void)hasFolding(curwin->w_topline, &curwin->w_topline, NULL); #endif - --curwin->w_botline; /* approximate w_botline */ + --curwin->w_botline; // approximate w_botline curwin->w_valid &= ~(VALID_WROW|VALID_CROW|VALID_BOTLINE); } } @@ -1592,7 +1592,7 @@ scrollup_clamp(void) ) return; - validate_cursor(); /* w_wrow needs to be valid */ + validate_cursor(); // w_wrow needs to be valid /* * Compute the row number of the first row of the cursor line @@ -1623,7 +1623,7 @@ scrollup_clamp(void) #endif ++curwin->w_topline; } - ++curwin->w_botline; /* approximate w_botline */ + ++curwin->w_botline; // approximate w_botline curwin->w_valid &= ~(VALID_WROW|VALID_CROW|VALID_BOTLINE); } } @@ -1640,7 +1640,7 @@ topline_back(lineoff_T *lp) #ifdef FEAT_DIFF if (lp->fill < diff_check_fill(curwin, lp->lnum)) { - /* Add a filler line. */ + // Add a filler line. ++lp->fill; lp->height = 1; } @@ -1656,7 +1656,7 @@ topline_back(lineoff_T *lp) else #ifdef FEAT_FOLDING if (hasFolding(lp->lnum, &lp->lnum, NULL)) - /* Add a closed fold */ + // Add a closed fold lp->height = 1; else #endif @@ -1676,7 +1676,7 @@ botline_forw(lineoff_T *lp) #ifdef FEAT_DIFF if (lp->fill < diff_check_fill(curwin, lp->lnum + 1)) { - /* Add a filler line. */ + // Add a filler line. ++lp->fill; lp->height = 1; } @@ -1692,7 +1692,7 @@ botline_forw(lineoff_T *lp) else #ifdef FEAT_FOLDING if (hasFolding(lp->lnum, NULL, &lp->lnum)) - /* Add a closed fold */ + // Add a closed fold lp->height = 1; else #endif @@ -1744,8 +1744,8 @@ scroll_cursor_top(int min_scroll, int al int extra = 0; int used; int i; - linenr_T top; /* just above displayed lines */ - linenr_T bot; /* just below displayed lines */ + linenr_T top; // just above displayed lines + linenr_T bot; // just below displayed lines linenr_T old_topline = curwin->w_topline; #ifdef FEAT_DIFF linenr_T old_topfill = curwin->w_topfill; @@ -1764,7 +1764,7 @@ scroll_cursor_top(int min_scroll, int al * - at least 'scrolloff' lines above and below the cursor */ validate_cheight(); - used = curwin->w_cline_height; /* includes filler lines above */ + used = curwin->w_cline_height; // includes filler lines above if (curwin->w_cursor.lnum < curwin->w_topline) scrolled = used; @@ -1783,9 +1783,9 @@ scroll_cursor_top(int min_scroll, int al new_topline = top + 1; #ifdef FEAT_DIFF - /* "used" already contains the number of filler lines above, don't add it - * again. - * Hide filler lines above cursor line by adding them to "extra". */ + // "used" already contains the number of filler lines above, don't add it + // again. + // Hide filler lines above cursor line by adding them to "extra". extra += diff_check_fill(curwin, curwin->w_cursor.lnum); #endif @@ -1797,7 +1797,7 @@ scroll_cursor_top(int min_scroll, int al { #ifdef FEAT_FOLDING if (hasFolding(top, &top, NULL)) - /* count one logical line for a sequence of folded lines */ + // count one logical line for a sequence of folded lines i = 1; else #endif @@ -1807,7 +1807,7 @@ scroll_cursor_top(int min_scroll, int al { #ifdef FEAT_FOLDING if (hasFolding(bot, NULL, &bot)) - /* count one logical line for a sequence of folded lines */ + // count one logical line for a sequence of folded lines ++used; else #endif @@ -1880,7 +1880,7 @@ set_empty_rows(win_T *wp, int used) wp->w_filler_rows = 0; #endif if (used == 0) - wp->w_empty_rows = 0; /* single line that doesn't fit */ + wp->w_empty_rows = 0; // single line that doesn't fit else { wp->w_empty_rows = wp->w_height - used; @@ -1924,7 +1924,7 @@ scroll_cursor_bot(int min_scroll, int se linenr_T old_botline = curwin->w_botline; linenr_T old_valid = curwin->w_valid; int old_empty_rows = curwin->w_empty_rows; - linenr_T cln; /* Cursor Line Number */ + linenr_T cln; // Cursor Line Number long so = get_scrolloff_value(); cln = curwin->w_cursor.lnum; @@ -1960,7 +1960,7 @@ scroll_cursor_bot(int min_scroll, int se else validate_botline(); - /* The lines of the cursor line itself are always used. */ + // The lines of the cursor line itself are always used. #ifdef FEAT_DIFF used = plines_nofill(cln); #else @@ -1968,9 +1968,9 @@ scroll_cursor_bot(int min_scroll, int se used = curwin->w_cline_height; #endif - /* If the cursor is below botline, we will at least scroll by the height - * of the cursor line. Correct for empty lines, which are really part of - * botline. */ + // If the cursor is below botline, we will at least scroll by the height + // of the cursor line. Correct for empty lines, which are really part of + // botline. if (cln >= curwin->w_botline) { scrolled = used; @@ -2001,8 +2001,8 @@ scroll_cursor_bot(int min_scroll, int se while (loff.lnum > 1) { - /* Stop when scrolled nothing or at least "min_scroll", found "extra" - * context for 'scrolloff' and counted all lines below the window. */ + // Stop when scrolled nothing or at least "min_scroll", found "extra" + // context for 'scrolloff' and counted all lines below the window. if ((((scrolled <= 0 || scrolled >= min_scroll) && extra >= (mouse_dragging > 0 ? mouse_dragging - 1 : so)) || boff.lnum + 1 > curbuf->b_ml.ml_line_count) @@ -2014,7 +2014,7 @@ scroll_cursor_bot(int min_scroll, int se ) break; - /* Add one line above */ + // Add one line above topline_back(&loff); if (loff.height == MAXCOL) used = MAXCOL; @@ -2029,7 +2029,7 @@ scroll_cursor_bot(int min_scroll, int se #endif ) { - /* Count screen lines that are below the window. */ + // Count screen lines that are below the window. scrolled += loff.height; if (loff.lnum == curwin->w_botline #ifdef FEAT_DIFF @@ -2041,7 +2041,7 @@ scroll_cursor_bot(int min_scroll, int se if (boff.lnum < curbuf->b_ml.ml_line_count) { - /* Add one line below */ + // Add one line below botline_forw(&boff); used += boff.height; if (used > curwin->w_height) @@ -2057,7 +2057,7 @@ scroll_cursor_bot(int min_scroll, int se #endif ) { - /* Count screen lines that are below the window. */ + // Count screen lines that are below the window. scrolled += boff.height; if (boff.lnum == curwin->w_botline #ifdef FEAT_DIFF @@ -2070,13 +2070,13 @@ scroll_cursor_bot(int min_scroll, int se } } - /* curwin->w_empty_rows is larger, no need to scroll */ + // curwin->w_empty_rows is larger, no need to scroll if (scrolled <= 0) line_count = 0; - /* more than a screenfull, don't scroll but redraw */ + // more than a screenfull, don't scroll but redraw else if (used > curwin->w_height) line_count = used; - /* scroll minimal number of lines */ + // scroll minimal number of lines else { line_count = 0; @@ -2090,7 +2090,7 @@ scroll_cursor_bot(int min_scroll, int se i += boff.height; ++line_count; } - if (i < scrolled) /* below curwin->w_botline, don't scroll */ + if (i < scrolled) // below curwin->w_botline, don't scroll line_count = 9999; } @@ -2151,7 +2151,7 @@ scroll_cursor_halfway(int atend) topline = loff.lnum; while (topline > 1) { - if (below <= above) /* add a line below the cursor first */ + if (below <= above) // add a line below the cursor first { if (boff.lnum < curbuf->b_ml.ml_line_count) { @@ -2163,13 +2163,13 @@ scroll_cursor_halfway(int atend) } else { - ++below; /* count a "~" line */ + ++below; // count a "~" line if (atend) ++used; } } - if (below > above) /* add a line above the cursor */ + if (below > above) // add a line above the cursor { topline_back(&loff); if (loff.height == MAXCOL) @@ -2208,12 +2208,12 @@ scroll_cursor_halfway(int atend) void cursor_correct(void) { - int above = 0; /* screen lines above topline */ + int above = 0; // screen lines above topline linenr_T topline; - int below = 0; /* screen lines below botline */ + int below = 0; // screen lines below botline linenr_T botline; int above_wanted, below_wanted; - linenr_T cln; /* Cursor Line Number */ + linenr_T cln; // Cursor Line Number int max_off; long so = get_scrolloff_value(); @@ -2267,7 +2267,7 @@ cursor_correct(void) topline = curwin->w_topline; botline = curwin->w_botline - 1; #ifdef FEAT_DIFF - /* count filler lines as context */ + // count filler lines as context above = curwin->w_topfill; below = curwin->w_filler_rows; #endif @@ -2292,7 +2292,7 @@ cursor_correct(void) #endif above += PLINES_NOFILL(topline); #ifdef FEAT_DIFF - /* Count filler lines below this line as context. */ + // Count filler lines below this line as context. if (topline < botline) above += diff_check_fill(curwin, topline + 1); #endif @@ -2337,7 +2337,7 @@ onepage(int dir, long count) linenr_T old_topline = curwin->w_topline; long so = get_scrolloff_value(); - if (curbuf->b_ml.ml_line_count == 1) /* nothing to do */ + if (curbuf->b_ml.ml_line_count == 1) // nothing to do { beep_flush(); return FAIL; @@ -2374,7 +2374,7 @@ onepage(int dir, long count) { if (ONE_WINDOW && p_window > 0 && p_window < Rows - 1) { - /* Vi compatible scrolling */ + // Vi compatible scrolling if (p_window <= 2) ++curwin->w_topline; else @@ -2385,7 +2385,7 @@ onepage(int dir, long count) } else if (curwin->w_botline > curbuf->b_ml.ml_line_count) { - /* at end of file */ + // at end of file curwin->w_topline = curbuf->b_ml.ml_line_count; #ifdef FEAT_DIFF curwin->w_topfill = 0; @@ -2394,8 +2394,8 @@ onepage(int dir, long count) } else { - /* For the overlap, start with the line just below the window - * and go upwards. */ + // For the overlap, start with the line just below the window + // and go upwards. loff.lnum = curwin->w_botline; #ifdef FEAT_DIFF loff.fill = diff_check_fill(curwin, loff.lnum) @@ -2412,19 +2412,19 @@ onepage(int dir, long count) VALID_CROW|VALID_BOTLINE|VALID_BOTLINE_AP); } } - else /* dir == BACKWARDS */ + else // dir == BACKWARDS { #ifdef FEAT_DIFF if (curwin->w_topline == 1) { - /* Include max number of filler lines */ + // Include max number of filler lines max_topfill(); continue; } #endif if (ONE_WINDOW && p_window > 0 && p_window < Rows - 1) { - /* Vi compatible scrolling (sort of) */ + // Vi compatible scrolling (sort of) if (p_window <= 2) --curwin->w_topline; else @@ -2437,9 +2437,9 @@ onepage(int dir, long count) continue; } - /* Find the line at the top of the window that is going to be the - * line at the bottom of the window. Make sure this results in - * the same line as before doing CTRL-F. */ + // Find the line at the top of the window that is going to be the + // line at the bottom of the window. Make sure this results in + // the same line as before doing CTRL-F. loff.lnum = curwin->w_topline - 1; #ifdef FEAT_DIFF loff.fill = diff_check_fill(curwin, loff.lnum + 1) @@ -2460,8 +2460,8 @@ onepage(int dir, long count) } curwin->w_cursor.lnum = loff.lnum; - /* Find the line just above the new topline to get the right line - * at the bottom of the window. */ + // Find the line just above the new topline to get the right line + // at the bottom of the window. n = 0; while (n <= curwin->w_height && loff.lnum >= 1) { @@ -2471,7 +2471,7 @@ onepage(int dir, long count) else n += loff.height; } - if (loff.lnum < 1) /* at begin of file */ + if (loff.lnum < 1) // at begin of file { curwin->w_topline = 1; #ifdef FEAT_DIFF @@ -2481,7 +2481,7 @@ onepage(int dir, long count) } else { - /* Go two lines forward again. */ + // Go two lines forward again. #ifdef FEAT_DIFF topline_botline(&loff); #endif @@ -2491,12 +2491,12 @@ onepage(int dir, long count) botline_topline(&loff); #endif #ifdef FEAT_FOLDING - /* We're at the wrong end of a fold now. */ + // We're at the wrong end of a fold now. (void)hasFolding(loff.lnum, &loff.lnum, NULL); #endif - /* Always scroll at least one line. Avoid getting stuck on - * very long lines. */ + // Always scroll at least one line. Avoid getting stuck on + // very long lines. if (loff.lnum >= curwin->w_topline #ifdef FEAT_DIFF && (loff.lnum > curwin->w_topline @@ -2505,8 +2505,8 @@ onepage(int dir, long count) ) { #ifdef FEAT_DIFF - /* First try using the maximum number of filler lines. If - * that's not enough, backup one line. */ + // First try using the maximum number of filler lines. If + // that's not enough, backup one line. loff.fill = curwin->w_topfill; if (curwin->w_topfill < diff_check_fill(curwin, curwin->w_topline)) @@ -2601,7 +2601,7 @@ get_scroll_overlap(lineoff_T *lp, int di #endif h1 = lp->height; if (h1 > min_height) - return; /* no overlap */ + return; // no overlap loff0 = *lp; if (dir > 0) @@ -2611,7 +2611,7 @@ get_scroll_overlap(lineoff_T *lp, int di h2 = lp->height; if (h2 == MAXCOL || h2 + h1 > min_height) { - *lp = loff0; /* no overlap */ + *lp = loff0; // no overlap return; } @@ -2623,7 +2623,7 @@ get_scroll_overlap(lineoff_T *lp, int di h3 = lp->height; if (h3 == MAXCOL || h3 + h2 > min_height) { - *lp = loff0; /* no overlap */ + *lp = loff0; // no overlap return; } @@ -2634,9 +2634,9 @@ get_scroll_overlap(lineoff_T *lp, int di topline_back(lp); h4 = lp->height; if (h4 == MAXCOL || h4 + h3 + h2 > min_height || h3 + h2 + h1 > min_height) - *lp = loff1; /* 1 line overlap */ + *lp = loff1; // 1 line overlap else - *lp = loff2; /* 2 lines overlap */ + *lp = loff2; // 2 lines overlap return; } @@ -2814,7 +2814,7 @@ halfpage(int flag, linenr_T Prenum) } } # ifdef FEAT_FOLDING - /* Move cursor to first line of closed fold. */ + // Move cursor to first line of closed fold. foldAdjustCursor(); # endif #ifdef FEAT_DIFF @@ -2846,7 +2846,7 @@ do_check_cursorbind(void) FOR_ALL_WINDOWS(curwin) { curbuf = curwin->w_buffer; - /* skip original window and windows with 'noscrollbind' */ + // skip original window and windows with 'noscrollbind' if (curwin != old_curwin && curwin->w_p_crb) { # ifdef FEAT_DIFF @@ -2861,8 +2861,8 @@ do_check_cursorbind(void) curwin->w_curswant = curswant; curwin->w_set_curswant = set_curswant; - /* Make sure the cursor is in a valid position. Temporarily set - * "restart_edit" to allow the cursor to be beyond the EOL. */ + // Make sure the cursor is in a valid position. Temporarily set + // "restart_edit" to allow the cursor to be beyond the EOL. restart_edit_save = restart_edit; restart_edit = TRUE; check_cursor(); @@ -2871,12 +2871,12 @@ do_check_cursorbind(void) validate_cursor(); # endif restart_edit = restart_edit_save; - /* Correct cursor for multi-byte character. */ + // Correct cursor for multi-byte character. if (has_mbyte) mb_adjust_cursor(); redraw_later(VALID); - /* Only scroll when 'scrollbind' hasn't done this. */ + // Only scroll when 'scrollbind' hasn't done this. if (!curwin->w_p_scb) update_topline(); curwin->w_redr_status = TRUE;