diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-12-05 20:12:41 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-12-05 20:12:41 +0100 |
commit | 6e0ce171e19d0118ecd7c2b16e2a1bd50aa76013 (patch) | |
tree | 5446531fc72732454fef2eb38b5f86532c1b9340 /src | |
parent | c95e8d649045add4e77b423bc159dc0d845af559 (diff) | |
download | vim-git-6e0ce171e19d0118ecd7c2b16e2a1bd50aa76013.tar.gz |
patch 8.1.2392: using old C style commentsv8.1.2392
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
Diffstat (limited to 'src')
-rw-r--r-- | src/nbdebug.c | 54 | ||||
-rw-r--r-- | src/netbeans.c | 527 | ||||
-rw-r--r-- | src/normal.c | 1222 | ||||
-rw-r--r-- | src/ops.c | 709 | ||||
-rw-r--r-- | src/option.c | 961 | ||||
-rw-r--r-- | src/version.c | 2 |
6 files changed, 1727 insertions, 1748 deletions
diff --git a/src/nbdebug.c b/src/nbdebug.c index 2af0288ce..43bee8d8f 100644 --- a/src/nbdebug.c +++ b/src/nbdebug.c @@ -30,7 +30,7 @@ #include "vim.h" FILE *nb_debug = NULL; -u_int nb_dlevel = 0; /* nb_debug verbosity level */ +u_int nb_dlevel = 0; // nb_debug verbosity level void nbdb(char *, ...); @@ -46,19 +46,19 @@ static int errorHandler(Display *, XErrorEvent *); * from a background process this is the only way to debug * startup problems. */ - -void nbdebug_wait( - u_int wait_flags, /* tells what to do */ - char *wait_var, /* wait environment variable */ - u_int wait_secs) /* how many seconds to wait */ + void +nbdebug_wait( + u_int wait_flags, // tells what to do + char *wait_var, // wait environment variable + u_int wait_secs) // how many seconds to wait { - init_homedir(); /* not inited yet */ + init_homedir(); // not inited yet #ifdef USE_WDDUMP WDDump(0, 0, 0); #endif - /* for debugging purposes only */ + // for debugging purposes only if (wait_flags & WT_ENV && wait_var && getenv(wait_var) != NULL) { sleep(atoi(getenv(wait_var))); } else if (wait_flags & WT_WAIT && lookup("~/.gvimwait")) { @@ -69,16 +69,15 @@ void nbdebug_wait( ; } } -} /* end nbdebug_wait */ - +} -void + void nbdebug_log_init( - char *log_var, /* env var with log file */ - char *level_var) /* env var with nb_debug level */ + char *log_var, // env var with log file + char *level_var) // env var with nb_debug level { - char *file; /* possible nb_debug output file */ - char *cp; /* nb_dlevel pointer */ + char *file; // possible nb_debug output file + char *cp; // nb_dlevel pointer if (log_var && (file = getenv(log_var)) != NULL) { @@ -90,20 +89,17 @@ nbdebug_log_init( if (level_var && (cp = getenv(level_var)) != NULL) { nb_dlevel = strtoul(cp, NULL, 0); } else { - nb_dlevel = NB_TRACE; /* default level */ + nb_dlevel = NB_TRACE; // default level } #ifdef USE_NB_ERRORHANDLER XSetErrorHandler(errorHandler); #endif } -} /* end nbdebug_log_init */ - +} -void -nbdbg( - char *fmt, - ...) + void +nbdbg(char *fmt, ...) { va_list ap; @@ -114,12 +110,10 @@ nbdbg( fflush(nb_debug); } -} /* end nbdbg */ - +} -static int -lookup( - char *file) + static int +lookup(char *file) { char buf[BUFSIZ]; @@ -131,10 +125,10 @@ lookup( (access(buf, 0) == 0); #endif -} /* end lookup */ +} #ifdef USE_NB_ERRORHANDLER -static int + static int errorHandler( Display *dpy, XErrorEvent *err) @@ -160,4 +154,4 @@ errorHandler( #endif -#endif /* NBDEBUG */ +#endif // NBDEBUG diff --git a/src/netbeans.c b/src/netbeans.c index 98714d399..f55f388e8 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -36,12 +36,12 @@ #include "version.h" -#define GUARDED 10000 /* typenr for "guarded" annotation */ -#define GUARDEDOFFSET 1000000 /* base for "guarded" sign id's */ -#define MAX_COLOR_LENGTH 32 /* max length of color name in defineAnnoType */ +#define GUARDED 10000 // typenr for "guarded" annotation +#define GUARDEDOFFSET 1000000 // base for "guarded" sign id's +#define MAX_COLOR_LENGTH 32 // max length of color name in defineAnnoType -/* The first implementation (working only with Netbeans) returned "1.1". The - * protocol implemented here also supports A-A-P. */ +// The first implementation (working only with Netbeans) returned "1.1". The +// protocol implemented here also supports A-A-P. static char *ExtEdProtocolVersion = "2.5"; static long pos2off(buf_T *, pos_T *); @@ -64,7 +64,7 @@ static void nb_free(void); #define NETBEANS_OPEN (channel_can_write_to(nb_channel)) static channel_T *nb_channel = NULL; -static int r_cmdno; /* current command number for reply */ +static int r_cmdno; // current command number for reply static int dosetvisible = FALSE; /* @@ -98,7 +98,7 @@ netbeans_close(void) netbeans_send_disconnect(); if (nb_channel != NULL) { - /* Close the socket and remove the input handlers. */ + // Close the socket and remove the input handlers. channel_close(nb_channel, TRUE); channel_clear(nb_channel); } @@ -113,7 +113,7 @@ netbeans_close(void) inAtomic = 0; nb_free(); - /* remove all signs and update the screen after gutter removal */ + // remove all signs and update the screen after gutter removal coloncmd(":sign unplace *"); changed_window_setting(); update_screen(CLEAR); @@ -139,18 +139,18 @@ netbeans_connect(char *params, int doabort) if (*params == '=') { - /* "=fname": Read info from specified file. */ + // "=fname": Read info from specified file. if (getConnInfo(params + 1, &hostname, &address, &password) == FAIL) return FAIL; } else { if (*params == ':') - /* ":<host>:<addr>:<password>": get info from argument */ + // ":<host>:<addr>:<password>": get info from argument arg = params + 1; if (arg == NULL && (fname = getenv("__NETBEANS_CONINFO")) != NULL) { - /* "": get info from file specified in environment */ + // "": get info from file specified in environment if (getConnInfo(fname, &hostname, &address, &password) == FAIL) return FAIL; } @@ -158,7 +158,7 @@ netbeans_connect(char *params, int doabort) { if (arg != NULL) { - /* ":<host>:<addr>:<password>": get info from argument */ + // ":<host>:<addr>:<password>": get info from argument hostname = arg; address = strchr(hostname, ':'); if (address != NULL) @@ -170,7 +170,7 @@ netbeans_connect(char *params, int doabort) } } - /* Get the missing values from the environment. */ + // Get the missing values from the environment. if (hostname == NULL || *hostname == '\0') hostname = getenv("__NETBEANS_HOST"); if (address == NULL) @@ -178,7 +178,7 @@ netbeans_connect(char *params, int doabort) if (password == NULL) password = getenv("__NETBEANS_VIM_PASSWORD"); - /* Move values to allocated memory. */ + // Move values to allocated memory. if (hostname != NULL) hostname = (char *)vim_strsave((char_u *)hostname); if (address != NULL) @@ -188,7 +188,7 @@ netbeans_connect(char *params, int doabort) } } - /* Use the default when a value is missing. */ + // Use the default when a value is missing. if (hostname == NULL || *hostname == '\0') { vim_free(hostname); @@ -210,12 +210,12 @@ netbeans_connect(char *params, int doabort) nb_channel = channel_open(hostname, port, 3000, nb_channel_closed); if (nb_channel != NULL) { - /* success */ + // success # ifdef FEAT_BEVAL_GUI bevalServers |= BEVAL_NETBEANS; # endif - /* success, login */ + // success, login vim_snprintf(buf, sizeof(buf), "AUTH %s\n", password); nb_send(buf, "netbeans_connect"); @@ -271,11 +271,11 @@ getConnInfo(char *file, char **host, char **port, char **auth) return FAIL; } - /* Read the file. There should be one of each parameter */ + // Read the file. There should be one of each parameter while ((lp = (char_u *)fgets((char *)buf, BUFSIZ, fp)) != NULL) { if ((nlp = vim_strchr(lp, '\n')) != NULL) - *nlp = 0; /* strip off the trailing newline */ + *nlp = 0; // strip off the trailing newline if (STRNCMP(lp, "host=", 5) == 0) { @@ -308,7 +308,7 @@ struct keyqueue typedef struct keyqueue keyQ_T; -static keyQ_T keyHead; /* dummy node, header for circular queue */ +static keyQ_T keyHead; // dummy node, header for circular queue /* @@ -323,15 +323,15 @@ postpone_keycommand(char_u *keystr) node = ALLOC_ONE(keyQ_T); if (node == NULL) - return; /* out of memory, drop the key */ + return; // out of memory, drop the key - if (keyHead.next == NULL) /* initialize circular queue */ + if (keyHead.next == NULL) // initialize circular queue { keyHead.next = &keyHead; keyHead.prev = &keyHead; } - /* insert node at tail of queue */ + // insert node at tail of queue node->next = &keyHead; node->prev = keyHead.prev; keyHead.prev->next = node; @@ -350,18 +350,18 @@ handle_key_queue(void) while (!postponed && keyHead.next && keyHead.next != &keyHead) { - /* first, unlink the node */ + // first, unlink the node keyQ_T *node = keyHead.next; keyHead.next = node->next; node->next->prev = node->prev; - /* Now, send the keycommand. This may cause it to be postponed again - * and change keyHead. */ + // Now, send the keycommand. This may cause it to be postponed again + // and change keyHead. if (node->keystr != NULL) postponed = !netbeans_keystring(node->keystr); vim_free(node->keystr); - /* Finally, dispose of the node */ + // Finally, dispose of the node vim_free(node); } } @@ -382,30 +382,30 @@ netbeans_parse_messages(void) { node = channel_peek(nb_channel, PART_SOCK); if (node == NULL) - break; /* nothing to read */ + break; // nothing to read - /* Locate the end of the first line in the first buffer. */ + // Locate the end of the first line in the first buffer. p = channel_first_nl(node); if (p == NULL) { - /* Command isn't complete. If there is no following buffer, - * return (wait for more). If there is another buffer following, - * prepend the text to that buffer and delete this one. */ + // Command isn't complete. If there is no following buffer, + // return (wait for more). If there is another buffer following, + // prepend the text to that buffer and delete this one. if (channel_collapse(nb_channel, PART_SOCK, TRUE) == FAIL) return; continue; } - /* There is a complete command at the start of the buffer. - * Terminate it with a NUL. When no more text is following unlink - * the buffer. Do this before executing, because new buffers can - * be added while busy handling the command. */ + // There is a complete command at the start of the buffer. + // Terminate it with a NUL. When no more text is following unlink + // the buffer. Do this before executing, because new buffers can + // be added while busy handling the command. *p++ = NUL; if (*p == NUL) { own_node = TRUE; buffer = channel_get(nb_channel, PART_SOCK, NULL); - /* "node" is now invalid! */ + // "node" is now invalid! } else { @@ -413,15 +413,15 @@ netbeans_parse_messages(void) buffer = node->rq_buffer; } - /* Now, parse and execute the commands. This may set nb_channel to - * NULL if the channel is closed. */ + // Now, parse and execute the commands. This may set nb_channel to + // NULL if the channel is closed. nb_parse_cmd(buffer); if (own_node) - /* buffer finished, dispose of it */ + // buffer finished, dispose of it vim_free(buffer); else if (nb_channel != NULL) - /* more follows, move it to the start */ + // more follows, move it to the start channel_consume(nb_channel, PART_SOCK, (int)(p - buffer)); } } @@ -452,12 +452,12 @@ nb_parse_cmd(char_u *cmd) if (STRCMP(cmd, "DISCONNECT") == 0) { - /* We assume the server knows that we can safely exit! */ - /* Disconnect before exiting, Motif hangs in a Select error - * message otherwise. */ + // We assume the server knows that we can safely exit! + // Disconnect before exiting, Motif hangs in a Select error + // message otherwise. netbeans_close(); getout(0); - /* NOTREACHED */ + // NOTREACHED } if (STRCMP(cmd, "DETACH") == 0) @@ -467,7 +467,7 @@ nb_parse_cmd(char_u *cmd) FOR_ALL_BUFFERS(buf) buf->b_has_sign_column = FALSE; - /* The IDE is breaking the connection. */ + // The IDE is breaking the connection. netbeans_close(); return; } @@ -480,7 +480,7 @@ nb_parse_cmd(char_u *cmd) semsg("E627: missing colon: %s", cmd); return; } - ++verb; /* skip colon */ + ++verb; // skip colon for (q = verb; *q; q++) { @@ -540,8 +540,8 @@ struct nbbuf_struct typedef struct nbbuf_struct nbbuf_T; static nbbuf_T *buf_list = NULL; -static int buf_list_size = 0; /* size of buf_list */ -static int buf_list_used = 0; /* nr of entries in buf_list actually in use */ +static int buf_list_size = 0; // size of buf_list +static int buf_list_used = 0; // nr of entries in buf_list actually in use static char **globalsignmap = NULL; static int globalsignmaplen = 0; @@ -566,7 +566,7 @@ nb_free(void) nbbuf_T buf; int i; - /* free the netbeans buffer list */ + // free the netbeans buffer list for (i = 0; i < buf_list_used; i++) { buf = buf_list[i]; @@ -582,7 +582,7 @@ nb_free(void) buf_list_size = 0; buf_list_used = 0; - /* free the queued key commands */ + // free the queued key commands while (key_node != NULL && key_node != &keyHead) { keyQ_T *next = key_node->next; @@ -597,7 +597,7 @@ nb_free(void) key_node = next; } - /* free the queued netbeans commands */ + // free the queued netbeans commands if (nb_channel != NULL) channel_clear(nb_channel); } @@ -658,7 +658,7 @@ isNetbeansModified(buf_T *bufp) static nbbuf_T * nb_get_buf(int bufno) { - /* find or create a buffer with the given number */ + // find or create a buffer with the given number int incr; if (bufno <= 0) @@ -666,13 +666,13 @@ nb_get_buf(int bufno) if (!buf_list) { - /* initialize */ + // initialize buf_list = alloc_clear(100 * sizeof(nbbuf_T)); buf_list_size = 100; } - if (bufno >= buf_list_used) /* new */ + if (bufno >= buf_list_used) // new { - if (bufno >= buf_list_size) /* grow list */ + if (bufno >= buf_list_size) // grow list { nbbuf_T *t_buf_list = buf_list; @@ -691,7 +691,7 @@ nb_get_buf(int bufno) while (buf_list_used <= bufno) { - /* Default is to fire text changes. */ + // Default is to fire text changes. buf_list[buf_list_used].fireChanges = 1; ++buf_list_used; } @@ -734,14 +734,14 @@ netbeans_end(void) continue; if (netbeansForcedQuit) { - /* mark as unmodified so NetBeans won't put up dialog on "killed" */ + // mark as unmodified so NetBeans won't put up dialog on "killed" sprintf(buf, "%d:unmodified=%d\n", i, r_cmdno); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_end"); } sprintf(buf, "%d:killed=%d\n", i, r_cmdno); nbdebug(("EVT: %s", buf)); - /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */ + // nb_send(buf, "netbeans_end"); avoid "write failed" messages nb_send(buf, NULL); } } @@ -769,7 +769,7 @@ nb_reply_nil(int cmdno) nbdebug(("REP %d: <none>\n", cmdno)); - /* Avoid printing an annoying error message. */ + // Avoid printing an annoying error message. if (!NETBEANS_OPEN) return; @@ -831,8 +831,8 @@ nb_quote(char_u *txt) case '\"': case '\\': *q++ = '\\'; *q++ = *p; break; - /* case '\t': */ - /* *q++ = '\\'; *q++ = 't'; break; */ + // case '\t': + // *q++ = '\\'; *q++ = 't'; break; case '\n': *q++ = '\\'; *q++ = 'n'; break; case '\r': @@ -861,7 +861,7 @@ nb_unquote(char_u *p, char_u **endp) char *q; int done = 0; - /* result is never longer than input */ + // result is never longer than input result = alloc_clear(STRLEN(p) + 1); if (result == NULL) return NULL; @@ -895,7 +895,7 @@ nb_unquote(char_u *p, char_u **endp) case 'r': *q++ = '\r'; break; case '"': *q++ = '"'; break; case NUL: --p; break; - /* default: skip over illegal chars */ + // default: skip over illegal chars } ++p; break; @@ -924,7 +924,7 @@ nb_partialremove(linenr_T lnum, colnr_T first, colnr_T last) oldtext = ml_get(lnum); oldlen = (int)STRLEN(oldtext); - if (first >= (colnr_T)oldlen || oldlen == 0) /* just in case */ + if (first >= (colnr_T)oldlen || oldlen == 0) // just in case return; if (lastbyte >= oldlen) lastbyte = oldlen - 1; @@ -974,55 +974,55 @@ nb_do_cmd( char_u *cmd, int func, int cmdno, - char_u *args) /* points to space before arguments or NUL */ + char_u *args) // points to space before arguments or NUL { int do_update = 0; long off = 0; nbbuf_T *buf = nb_get_buf(bufno); static int skip = 0; int retval = OK; - char *cp; /* for when a char pointer is needed */ + char *cp; // for when a char pointer is needed nbdebug(("%s %d: (%d) %s %s\n", (func) ? "FUN" : "CMD", cmdno, bufno, cmd, STRCMP(cmd, "insert") == 0 ? "<text>" : (char *)args)); if (func) { -/* =====================================================================*/ +// ===================================================================== if (streq((char *)cmd, "getModified")) { if (buf == NULL || buf->bufp == NULL) - /* Return the number of buffers that are modified. */ + // Return the number of buffers that are modified. nb_reply_nr(cmdno, (long)count_changed_buffers()); else - /* Return whether the buffer is modified. */ + // Return whether the buffer is modified. nb_reply_nr(cmdno, (long)(buf->bufp->b_changed || isNetbeansModified(buf->bufp))); -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "saveAndExit")) { - /* Note: this will exit Vim if successful. */ + // Note: this will exit Vim if successful. coloncmd(":confirm qall"); - /* We didn't exit: return the number of changed buffers. */ + // We didn't exit: return the number of changed buffers. nb_reply_nr(cmdno, (long)count_changed_buffers()); -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "getCursor")) { char_u text[200]; - /* Note: nb_getbufno() may return -1. This indicates the IDE - * didn't assign a number to the current buffer in response to a - * fileOpened event. */ + // Note: nb_getbufno() may return -1. This indicates the IDE + // didn't assign a number to the current buffer in response to a + // fileOpened event. sprintf((char *)text, "%d %ld %d %ld", nb_getbufno(curbuf), (long)curwin->w_cursor.lnum, (int)curwin->w_cursor.col, pos2off(curbuf, &curwin->w_cursor)); nb_reply_text(cmdno, text); -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "getAnno")) { @@ -1040,12 +1040,12 @@ nb_do_cmd( cp = (char *)args; serNum = strtol(cp, &cp, 10); - /* If the sign isn't found linenum will be zero. */ + // If the sign isn't found linenum will be zero. linenum = (long)buf_findsign(buf->bufp, serNum, NULL); } #endif nb_reply_nr(cmdno, linenum); -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "getLength")) { @@ -1062,7 +1062,7 @@ nb_do_cmd( len = get_buf_size(buf->bufp); } nb_reply_nr(cmdno, len); -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "getText")) { @@ -1116,7 +1116,7 @@ nb_do_cmd( nb_reply_text(cmdno, text); vim_free(text); } -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "remove")) { @@ -1124,7 +1124,7 @@ nb_do_cmd( pos_T first, last; pos_T *pos; pos_T *next; - linenr_T del_from_lnum, del_to_lnum; /* lines to be deleted as a whole */ + linenr_T del_from_lnum, del_to_lnum; // lines to be deleted as a whole int oldFire = netbeansFireChanges; int oldSuppress = netbeansSuppressNoLines; int wasChanged; @@ -1153,7 +1153,7 @@ nb_do_cmd( off = strtol(cp, &cp, 10); count = strtol(cp, &cp, 10); args = (char_u *)cp; - /* delete "count" chars, starting at "off" */ + // delete "count" chars, starting at "off" pos = off2pos(buf->bufp, off); if (!pos) { @@ -1182,58 +1182,58 @@ nb_do_cmd( del_to_lnum = last.lnum; do_update = 1; - /* Get the position of the first byte after the deleted - * section. "next" is NULL when deleting to the end of the - * file. */ + // Get the position of the first byte after the deleted + // section. "next" is NULL when deleting to the end of the + // file. next = off2pos(buf->bufp, off + count); - /* Remove part of the first line. */ + // Remove part of the first line. if (first.col != 0 || (next != NULL && first.lnum == next->lnum)) { if (first.lnum != last.lnum || (next != NULL && first.lnum != next->lnum)) { - /* remove to the end of the first line */ + // remove to the end of the first line nb_partialremove(first.lnum, first.col, (colnr_T)MAXCOL); if (first.lnum == last.lnum) { - /* Partial line to remove includes the end of - * line. Join the line with the next one, have - * the next line deleted below. */ + // Partial line to remove includes the end of + // line. Join the line with the next one, have + // the next line deleted below. nb_joinlines(first.lnum, next->lnum); del_to_lnum = next->lnum; } } else { - /* remove within one line */ + // remove within one line nb_partialremove(first.lnum, first.col, last.col); } - ++del_from_lnum; /* don't delete the first line */ + ++del_from_lnum; // don't delete the first line } - /* Remove part of the last line. */ + // Remove part of the last line. if (first.lnum != last.lnum && next != NULL && next->col != 0 && last.lnum == next->lnum) { nb_partialremove(last.lnum, 0, last.col); if (del_from_lnum > first.lnum) { - /* Join end of last line to start of first line; last - * line is deleted below. */ + // Join end of last line to start of first line; last + // line is deleted below. nb_joinlines(first.lnum, last.lnum); } else - /* First line is deleted as a whole, keep the last - * line. */ + // First line is deleted as a whole, keep the last + // line. --del_to_lnum; } - /* First is partial line; last line to remove includes - * the end of line; join first line to line following last - * line; line following last line is deleted below. */ + // First is partial line; last line to remove includes + // the end of line; join first line to line following last + // line; line following last line is deleted below. if (first.lnum != last.lnum && del_from_lnum > first.lnum && next != NULL && last.lnum != next->lnum) { @@ -1241,12 +1241,12 @@ nb_do_cmd( del_to_lnum = next->lnum; } - /* Delete whole lines if there are any. */ + // Delete whole lines if there are any. if (del_to_lnum >= del_from_lnum) { int i; - /* delete signs from the lines being deleted */ + // delete signs from the lines being deleted for (i = del_from_lnum; i <= del_to_lnum; i++) { int id = buf_findsign_id(buf->bufp, (linenr_T)i, NULL); @@ -1269,10 +1269,10 @@ nb_do_cmd( del_lines(del_to_lnum - del_from_lnum + 1, FALSE); } - /* Leave cursor at first deleted byte. */ + // Leave cursor at first deleted byte. curwin->w_cursor = first; check_cursor_lnum(); - buf->bufp->b_changed = wasChanged; /* logically unchanged */ + buf->bufp->b_changed = wasChanged; // logically unchanged netbeansFireChanges = oldFire; netbeansSuppressNoLines = oldSuppress; @@ -1280,7 +1280,7 @@ nb_do_cmd( u_clearall(buf->bufp); } nb_reply_nil(cmdno); -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "insert")) { @@ -1293,12 +1293,12 @@ nb_do_cmd( return OK; } - /* get offset */ + // get offset cp = (char *)args; off = strtol(cp, &cp, 10); args = (char_u *)cp; - /* get text to be inserted */ + // get text to be inserted args = skipwhite(args); args = to_free = (char_u *)nb_unquote(args, NULL); /* @@ -1327,13 +1327,13 @@ nb_do_cmd( netbeansFireChanges = 0; - /* Jump to the buffer where we insert. After this "curbuf" - * can be used. */ + // Jump to the buffer where we insert. After this "curbuf" + // can be used. nb_set_curbuf(buf->bufp); old_b_changed = curbuf->b_changed; - /* Convert the specified character offset into a lnum/col - * position. */ + // Convert the specified character offset into a lnum/col + // position. pos = off2pos(curbuf, off); if (pos != NULL) { @@ -1344,27 +1344,27 @@ nb_do_cmd( } else { - /* If the given position is not found, assume we want - * the end of the file. See setLocAndSize HACK. */ + // If the given position is not found, assume we want + // the end of the file. See setLocAndSize HACK. if (buf_was_empty) - lnum_start = 1; /* above empty line */ + lnum_start = 1; // above empty line else lnum_start = curbuf->b_ml.ml_line_count + 1; } - /* "lnum" is the line where we insert: either append to it or - * insert a new line above it. */ + // "lnum" is the line where we insert: either append to it or + // insert a new line above it. lnum = lnum_start; - /* Loop over the "\n" separated lines of the argument. */ + // Loop over the "\n" separated lines of the argument. do_update = 1; while (*args != NUL) { nlp = vim_strchr(args, '\n'); if (nlp == NULL) { - /* Incomplete line, probably truncated. Next "insert" - * command should append to this one. */ + // Incomplete line, probably truncated. Next "insert" + // command should append to this one. len = STRLEN(args); } else @@ -1393,7 +1393,7 @@ nb_do_cmd( char_u *newline; int col = pos == NULL ? 0 : pos->col; - /* Insert halfway a line. */ + // Insert halfway a line. newline = alloc(STRLEN(oldline) + len + 1); if (newline != NULL) { @@ -1406,8 +1406,8 @@ nb_do_cmd( } else { - /* Append a new line. Not that we always do this, - * also when the text doesn't end in a "\n". */ + // Append a new line. Not that we always do this, + // also when the text doesn't end in a "\n". ml_append((linenr_T)(lnum - 1), args, (colnr_T)(len + 1), FALSE); ++added; @@ -1419,7 +1419,7 @@ nb_do_cmd( args = nlp + 1; } - /* Adjust the marks below the inserted lines. */ + // Adjust the marks below the inserted lines. appended_lines_mark(lnum_start - 1, (long)added); /* @@ -1443,15 +1443,15 @@ nb_do_cmd( * text the buffer has been updated but not written. Will * netbeans guarantee to write it? Even if I do a :q! ? */ - curbuf->b_changed = old_b_changed; /* logically unchanged */ + curbuf->b_changed = old_b_changed; // logically unchanged netbeansFireChanges = oldFire; - /* Undo info is invalid now... */ + // Undo info is invalid now... u_blockfree(curbuf); u_clearall(curbuf); } vim_free(to_free); - nb_reply_nil(cmdno); /* or !error */ + nb_reply_nil(cmdno); // or !error } else { @@ -1460,12 +1460,12 @@ nb_do_cmd( retval = FAIL; } } - else /* Not a function; no reply required. */ + else // Not a function; no reply required. { -/* =====================================================================*/ +// ===================================================================== if (streq((char *)cmd, "create")) { - /* Create a buffer without a name. */ + // Create a buffer without a name. if (buf == NULL) { nbdebug((" invalid buffer identifier in create\n")); @@ -1474,7 +1474,7 @@ nb_do_cmd( } VIM_CLEAR(buf->displayname); - netbeansReadFile = 0; /* don't try to open disk file */ + netbeansReadFile = 0; // don't try to open disk file do_ecmd(0, NULL, 0, 0, ECMD_ONE, ECMD_HIDE + ECMD_OLDBUF, curwin); netbeansReadFile = 1; buf->bufp = curbuf; @@ -1484,7 +1484,7 @@ nb_do_cmd( if (gui.in_use) gui_update_menus(0); #endif -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "insertDone")) { @@ -1500,7 +1500,7 @@ nb_do_cmd( buf->bufp->b_p_ro = *args == 'T'; print_read_msg(buf); } -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "saveDone")) { @@ -1510,7 +1510,7 @@ nb_do_cmd( nbdebug((" invalid buffer identifier in saveDone\n")); else print_save_msg(buf, savedChars); -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "startDocumentListen")) { @@ -1521,7 +1521,7 @@ nb_do_cmd( return FAIL; } buf->fireChanges = 1; -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "stopDocumentListen")) { @@ -1542,15 +1542,15 @@ nb_do_cmd( } else { - /* NetBeans uses stopDocumentListen when it stops editing - * a file. It then expects the buffer in Vim to - * disappear. */ + // NetBeans uses stopDocumentListen when it stops editing + // a file. It then expects the buffer in Vim to + // disappear. do_bufdel(DOBUF_DEL, (char_u *)"", 1, buf->bufp->b_fnum, buf->bufp->b_fnum, TRUE); vim_memset(buf, 0, sizeof(nbbuf_T)); } } -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "setTitle")) { @@ -1562,7 +1562,7 @@ nb_do_cmd( } vim_free(buf->displayname); buf->displayname = nb_unquote(args, NULL); -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "initDone")) { @@ -1577,9 +1577,9 @@ nb_do_cmd( nb_set_curbuf(buf->bufp); apply_autocmds(EVENT_BUFREADPOST, 0, 0, FALSE, buf->bufp); - /* handle any postponed key commands */ + // handle any postponed key commands handle_key_queue(); -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "setBufferNumber") || streq((char *)cmd, "putBufferNumber")) @@ -1607,19 +1607,19 @@ nb_do_cmd( buf->bufp = bufp; buf->nbbuf_number = bufp->b_fnum; - /* "setBufferNumber" has the side effect of jumping to the buffer - * (don't know why!). Don't do that for "putBufferNumber". */ + // "setBufferNumber" has the side effect of jumping to the buffer + // (don't know why!). Don't do that for "putBufferNumber". if (*cmd != 'p') coloncmd(":buffer %d", bufp->b_fnum); else { buf->initDone = TRUE; - /* handle any postponed key commands */ + // handle any postponed key commands handle_key_queue(); } -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "setFullName")) { @@ -1632,7 +1632,7 @@ nb_do_cmd( vim_free(buf->displayname); buf->displayname = nb_unquote(args, NULL); - netbeansReadFile = 0; /* don't try to open disk file */ + netbeansReadFile = 0; // don't try to open disk file do_ecmd(0, (char_u *)buf->displayname, 0, 0, ECMD_ONE, ECMD_HIDE + ECMD_OLDBUF, curwin); netbeansReadFile = 1; @@ -1642,7 +1642,7 @@ nb_do_cmd( if (gui.in_use) gui_update_menus(0); #endif -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "editFile")) { @@ -1652,7 +1652,7 @@ nb_do_cmd( emsg("E644: invalid buffer identifier in editFile"); return FAIL; } - /* Edit a file: like create + setFullName + read the file. */ + // Edit a file: like create + setFullName + read the file. vim_free(buf->displayname); buf->displayname = nb_unquote(args, NULL); do_ecmd(0, (char_u *)buf->displayname, NULL, NULL, ECMD_ONE, @@ -1667,15 +1667,15 @@ nb_do_cmd( if (gui.in_use) gui_update_menus(0); #endif -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "setVisible")) { if (buf == NULL || buf->bufp == NULL) { nbdebug((" invalid buffer identifier in setVisible\n")); - /* This message was commented out, probably because it can - * happen when shutting down. */ + // This message was commented out, probably because it can + // happen when shutting down. if (p_verbose > 0) emsg("E645: invalid buffer identifier in setVisible"); return FAIL; @@ -1691,21 +1691,21 @@ nb_do_cmd( dosetvisible = FALSE; #ifdef FEAT_GUI - /* Side effect!!!. */ + // Side effect!!!. if (gui.in_use) gui_mch_set_foreground(); #endif } -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "raise")) { #ifdef FEAT_GUI - /* Bring gvim to the foreground. */ + // Bring gvim to the foreground. if (gui.in_use) gui_mch_set_foreground(); #endif -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "setModified")) { @@ -1714,8 +1714,8 @@ nb_do_cmd( if (buf == NULL || buf->bufp == NULL) { nbdebug((" invalid buffer identifier in setModified\n")); - /* This message was commented out, probably because it can - * happen when shutting down. */ + // This message was commented out, probably because it can + // happen when shutting down. if (p_verbose > 0) emsg("E646: invalid buffer identifier in setModified"); return FAIL; @@ -1727,8 +1727,8 @@ nb_do_cmd( { stat_T st; - /* Assume NetBeans stored the file. Reset the timestamp to - * avoid "file changed" warnings. */ + // Assume NetBeans stored the file. Reset the timestamp to + // avoid "file changed" warnings. if (buf->bufp->b_ffname != NULL && mch_stat((char *)buf->bufp->b_ffname, &st) >= 0) buf_store_time(buf->bufp, &st, buf->bufp->b_ffname); @@ -1744,7 +1744,7 @@ nb_do_cmd( #endif update_screen(0); } -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "setModtime")) { @@ -1752,7 +1752,7 @@ nb_do_cmd( nbdebug((" invalid buffer identifier in setModtime\n")); else buf->bufp->b_mtime = atoi((char *)args); -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "setReadOnly")) { @@ -1762,12 +1762,12 @@ nb_do_cmd( buf->bufp->b_p_ro = TRUE; else buf->bufp->b_p_ro = FALSE; -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "setMark")) { - /* not yet */ -/* =====================================================================*/ + // not yet +// ===================================================================== } else if (streq((char *)cmd, "showBalloon")) { @@ -1787,7 +1787,7 @@ nb_do_cmd( gui_mch_post_balloon(balloonEval, (char_u *)text); } #endif -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "setDot")) { @@ -1805,7 +1805,7 @@ nb_do_cmd( nb_set_curbuf(buf->bufp); - /* Don't want Visual mode now. */ + // Don't want Visual mode now. if (VIsual_active) end_visual_mode(); #ifdef NBDEBUG @@ -1825,15 +1825,15 @@ nb_do_cmd( nbdebug((" BAD POSITION in setDot: %s\n", s)); } - /* gui_update_cursor(TRUE, FALSE); */ - /* update_curbuf(NOT_VALID); */ - update_topline(); /* scroll to show the line */ + // gui_update_cursor(TRUE, FALSE); + // update_curbuf(NOT_VALID); + update_topline(); // scroll to show the line update_screen(VALID); setcursor(); cursor_on(); out_flush_cursor(TRUE, FALSE); - /* Quit a hit-return or more prompt. */ + // Quit a hit-return or more prompt. if (State == HITRETURN || State == ASKMORE) { #ifdef FEAT_GUI_GTK @@ -1841,7 +1841,7 @@ nb_do_cmd( gtk_main_quit(); #endif } -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "close")) { @@ -1863,8 +1863,8 @@ nb_do_cmd( if (buf->bufp == NULL) { nbdebug((" invalid buffer identifier in close\n")); - /* This message was commented out, probably because it can - * happen when shutting down. */ + // This message was commented out, probably because it can + // happen when shutting down. if (p_verbose > 0) emsg("E649: invalid buffer identifier in close"); } @@ -1878,17 +1878,17 @@ nb_do_cmd( buf->bufp = NULL; buf->initDone = FALSE; do_update = 1; -/* =====================================================================*/ +// ===================================================================== } - else if (streq((char *)cmd, "setStyle")) /* obsolete... */ + else if (streq((char *)cmd, "setStyle")) // obsolete... { nbdebug((" setStyle is obsolete!\n")); -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "setExitDelay")) { - /* Only used in version 2.1. */ -/* =====================================================================*/ + // Only used in version 2.1. +// ===================================================================== } else if (streq((char *)cmd, "defineAnnoType")) { @@ -1942,7 +1942,7 @@ nb_do_cmd( else vim_free(typeName); - /* don't free typeName; it's used directly in addsigntype() */ + // don't free typeName; it's used directly in addsigntype() vim_free(fg); vim_free(bg); vim_free(tooltip); @@ -1951,7 +1951,7 @@ nb_do_cmd( return FAIL; #endif -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "addAnno")) { @@ -1973,8 +1973,8 @@ nb_do_cmd( cp = (char *)args; serNum = strtol(cp, &cp, 10); - /* Get the typenr specific for this buffer and convert it to - * the global typenumber, as used for the sign name. */ + // Get the typenr specific for this buffer and convert it to + // the global typenumber, as used for the sign name. localTypeNum = strtol(cp, &cp, 10); args = (char_u *)cp; typeNum = mapsigntype(buf, localTypeNum); @@ -2002,7 +2002,7 @@ nb_do_cmd( buf->bufp->b_fnum); } #endif -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "removeAnno")) { @@ -2022,14 +2022,14 @@ nb_do_cmd( serNum, buf->bufp->b_fnum); redraw_buf_later(buf->bufp, NOT_VALID); #endif -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "moveAnnoToFront")) { #ifdef FEAT_SIGNS nbdebug((" moveAnnoToFront: Not Yet Implemented!\n")); #endif -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "guard") || streq((char *)cmd, "unguard")) { @@ -2082,7 +2082,7 @@ nb_do_cmd( { long lnum; last = *pos; - /* set highlight for region */ + // set highlight for region nbdebug((" %sGUARD %ld,%d to %ld,%d\n", (un) ? "UN" : "", first.lnum, first.col, last.lnum, last.col)); @@ -2091,7 +2091,7 @@ nb_do_cmd( { if (un) { - /* never used */ + // never used } else { @@ -2109,12 +2109,12 @@ nb_do_cmd( redraw_buf_later(buf->bufp, NOT_VALID); } } -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "startAtomic")) { inAtomic = 1; -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "endAtomic")) { @@ -2124,7 +2124,7 @@ nb_do_cmd( do_update = 1; needupdate = 0; } -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "save")) { @@ -2138,10 +2138,10 @@ nb_do_cmd( return FAIL; } - /* the following is taken from ex_cmds.c (do_wqall function) */ + // the following is taken from ex_cmds.c (do_wqall function) if (bufIsChanged(buf->bufp)) { - /* Only write if the buffer can be written. */ + // Only write if the buffer can be written. if (p_write && !buf->bufp->b_p_ro && buf->bufp->b_ffname != NULL @@ -2154,7 +2154,7 @@ nb_do_cmd( set_bufref(&bufref, buf->bufp); buf_write_all(buf->bufp, FALSE); - /* an autocommand may have deleted the buffer */ + // an autocommand may have deleted the buffer if (!bufref_valid(&bufref)) buf->bufp = NULL; } @@ -2163,7 +2163,7 @@ nb_do_cmd( { nbdebug((" Buffer has no changes!\n")); } -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "netbeansBuffer")) { @@ -2179,21 +2179,21 @@ nb_do_cmd( } else buf->bufp->b_netbeans_file = FALSE; -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "specialKeys")) { special_keys(args); -/* =====================================================================*/ +// ===================================================================== } else if (streq((char *)cmd, "actionMenuItem")) { - /* not used yet */ -/* =====================================================================*/ + // not used yet +// ===================================================================== } else if (streq((char *)cmd, "version")) { - /* not used yet */ + // not used yet } else { @@ -2221,7 +2221,7 @@ nb_do_cmd( cursor_on(); out_flush_cursor(TRUE, FALSE); - /* Quit a hit-return or more prompt. */ + // Quit a hit-return or more prompt. if (State == HITRETURN || State == ASKMORE) { #ifdef FEAT_GUI_GTK @@ -2269,7 +2269,7 @@ coloncmd(char *cmd, ...) do_cmdline((char_u *)buf, NULL, NULL, DOCMD_NOWAIT | DOCMD_KEYTYPED); - setcursor(); /* restore the cursor position */ + setcursor(); // restore the cursor position out_flush_cursor(TRUE, FALSE); } @@ -2419,7 +2419,7 @@ netbeans_keyname(int key, char *buf) default: if (key >= ' ' && key <= '~') { - /* Allow ASCII characters. */ + // Allow ASCII characters. name = namebuf; namebuf[0] = key; namebuf[1] = NUL; @@ -2435,7 +2435,7 @@ netbeans_keyname(int key, char *buf) if (shift) strcat(buf, "S"); if (alt) - strcat(buf, "M"); /* META */ + strcat(buf, "M"); // META if (ctrl || shift || alt) strcat(buf, "-"); strcat(buf, name); @@ -2459,15 +2459,15 @@ netbeans_beval_cb( char *buf; char_u *p; - /* Don't do anything when 'ballooneval' is off, messages scrolled the - * windows up or we have no connection. */ + // Don't do anything when 'ballooneval' is off, messages scrolled the + // windows up or we have no connection. if (!can_use_beval() || !NETBEANS_OPEN) return; if (get_beval_info(beval, TRUE, &wp, &lnum, &text, &col) == OK) { - /* Send debugger request. Only when the text is of reasonable - * length. */ + // Send debugger request. Only when the text is of reasonable + // length. if (text != NULL && text[0] != NUL && STRLEN(text) < MAXPATHL) { buf = alloc(MAXPATHL * 2 + 25); @@ -2519,7 +2519,7 @@ netbeans_open(char *params, int doabort) nbdebug(("EVT: %s", cmd)); nb_send(cmd, "netbeans_startup_done"); - /* update the screen after having added the gutter */ + // update the screen after having added the gutter changed_window_setting(); update_screen(CLEAR); setcursor(); @@ -2575,7 +2575,7 @@ netbeans_frame_moved(int new_x, int new_y) sprintf(buf, "0:geometry=%d %d %d %d %d\n", r_cmdno, (int)Columns, (int)Rows, new_x, new_y); - /*nbdebug(("EVT: %s", buf)); happens too many times during a move */ + // nbdebug(("EVT: %s", buf)); happens too many times during a move nb_send(buf, "netbeans_frame_moved"); } #endif @@ -2602,8 +2602,8 @@ netbeans_file_activated(buf_T *bufp) bufno, bufno, (char *)q, - "T", /* open in NetBeans */ - "F"); /* modified */ + "T", // open in NetBeans + "F"); // modified vim_free(q); nbdebug(("EVT: %s", buffer)); @@ -2638,8 +2638,8 @@ netbeans_file_opened(buf_T *bufp) bnum, 0, (char *)q, - "T", /* open in NetBeans */ - "F"); /* modified */ + "T", // open in NetBeans + "F"); // modified vim_free(q); nbdebug(("EVT: %s", buffer)); @@ -2687,15 +2687,15 @@ nb_bufp2nbbuf_fire(buf_T *bufp, int *bufnop) nbbuf_T *nbbuf; if (!NETBEANS_OPEN || !netbeansFireChanges) - return NULL; /* changes are not reported at all */ + return NULL; // changes are not reported at all bufno = nb_getbufno(bufp); if (bufno <= 0) - return NULL; /* file is not known to NetBeans */ + return NULL; // file is not known to NetBeans nbbuf = nb_get_buf(bufno); if (nbbuf != NULL && !nbbuf->fireChanges) - return NULL; /* changes in this buffer are not reported */ + return NULL; // changes in this buffer are not reported *bufnop = bufno; return nbbuf; @@ -2727,7 +2727,7 @@ netbeans_inserted( if (nbbuf == NULL) return; - /* Don't mark as modified for initial read */ + // Don't mark as modified for initial read if (nbbuf->insertDone) nbbuf->modified = 1; @@ -2735,7 +2735,7 @@ netbeans_inserted( pos.col = col; off = pos2off(bufp, &pos); - /* send the "insert" EVT */ + // send the "insert" EVT newtxt = alloc(newlen + 1); vim_strncpy(newtxt, txt, newlen); p = nb_quote(newtxt); @@ -2799,8 +2799,8 @@ netbeans_removed( void netbeans_unmodified(buf_T *bufp UNUSED) { - /* This is a no-op, because NetBeans considers a buffer modified - * even when all changes have been undone. */ + // This is a no-op, because NetBeans considers a buffer modified + // even when all changes have been undone. } /* @@ -2824,7 +2824,7 @@ netbeans_button_release(int button) - ((curwin->w_p_nu || curwin->w_p_rnu) ? 9 : 1); long off = pos2off(curbuf, &curwin->w_cursor); - /* sync the cursor position */ + // sync the cursor position sprintf(buf, "%d:newDotAndMark=%d %ld %ld\n", bufno, r_cmdno, off, off); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_button_release[newDotAndMark]"); @@ -2879,8 +2879,8 @@ netbeans_keystring(char_u *keyName) return TRUE; vim_snprintf(buf, sizeof(buf), "0:fileOpened=%d \"%s\" %s %s\n", 0, q, - "T", /* open in NetBeans */ - "F"); /* modified */ + "T", // open in NetBeans + "F"); // modified if (curbuf->b_ffname != NULL) vim_free(q); nbdebug(("EVT: %s", buf)); @@ -2890,24 +2890,23 @@ netbeans_keystring(char_u *keyName) return FALSE; } - /* sync the cursor position */ + // sync the cursor position off = pos2off(curbuf, &curwin->w_cursor); sprintf(buf, "%d:newDotAndMark=%d %ld %ld\n", bufno, r_cmdno, off, off); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_keycommand"); - /* To work on Win32 you must apply patch to ExtEditor module - * from ExtEdCaret.java.diff - make EVT_newDotAndMark handler - * more synchronous - */ + // To work on Win32 you must apply patch to ExtEditor module + // from ExtEdCaret.java.diff - make EVT_newDotAndMark handler + // more synchronous - /* now send keyCommand event */ + // now send keyCommand event vim_snprintf(buf, sizeof(buf), "%d:keyCommand=%d \"%s\"\n", bufno, r_cmdno, keyName); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_keycommand"); - /* New: do both at once and include the lnum/col. */ + // New: do both at once and include the lnum/col. vim_snprintf(buf, sizeof(buf), "%d:keyAtPos=%d \"%s\" %ld %ld/%ld\n", bufno, r_cmdno, keyName, off, (long)curwin->w_cursor.lnum, (long)curwin->w_cursor.col); @@ -2959,13 +2958,13 @@ netbeans_deleted_all_lines(buf_T *bufp) if (nbbuf == NULL) return; - /* Don't mark as modified for initial read */ + // Don't mark as modified for initial read if (nbbuf->insertDone) nbbuf->modified = 1; sprintf((char *)buf, "%d:remove=%d 0 -1\n", bufno, r_cmdno); nbdebug(("EVT(suppressed): %s", buf)); -/* nb_send(buf, "netbeans_deleted_all_lines"); */ +// nb_send(buf, "netbeans_deleted_all_lines"); } @@ -3021,7 +3020,7 @@ netbeans_draw_multisign_indicator(int row) XDrawPoint(gui.dpy, gui.wid, gui.text_gc, x+3, y++); XDrawPoint(gui.dpy, gui.wid, gui.text_gc, x+2, y); } -#endif /* FEAT_GUI_X11 */ +#endif // FEAT_GUI_X11 #if defined(FEAT_GUI_GTK) && !defined(PROTO) /* @@ -3082,7 +3081,7 @@ netbeans_draw_multisign_indicator(int row) cairo_destroy(cr); #endif } -#endif /* FEAT_GUI_GTK */ +#endif // FEAT_GUI_GTK /* * If the mouse is clicked in the gutter of a line with multiple @@ -3102,20 +3101,20 @@ netbeans_gutter_click(linenr_T lnum) { sign_entry_T *tail; - /* remove "p" from list, reinsert it at the tail of the sublist */ + // remove "p" from list, reinsert it at the tail of the sublist if (p->se_prev) p->se_prev->se_next = p->se_next; else curbuf->b_signlist = p->se_next; p->se_next->se_prev = p->se_prev; - /* now find end of sublist and insert p */ + // now find end of sublist and insert p for (tail = p->se_next; tail->se_next && tail->se_next->se_lnum == lnum && tail->se_next->se_id < GUARDEDOFFSET; tail = tail->se_next) ; - /* tail now points to last entry with same lnum (except - * that "guarded" annotations are always last) */ + // tail now points to last entry with same lnum (except + // that "guarded" annotations are always last) p->se_next = tail->se_next; if (tail->se_next) tail->se_next->se_prev = p; @@ -3160,7 +3159,7 @@ addsigntype( if (STRCMP(typeName, globalsignmap[i]) == 0) break; - if (i == globalsignmapused) /* not found; add it to global map */ + if (i == globalsignmapused) // not found; add it to global map { nbdebug(("DEFINEANNOTYPE(%d,%s,%s,%s,%s,%s)\n", typeNum, typeName, tooltip, glyphFile, fg, bg)); @@ -3186,20 +3185,20 @@ addsigntype( coloncmd(":highlight NB_%s %s %s", typeName, (use_fg) ? fgbuf : "", (use_bg) ? bgbuf : ""); if (*glyphFile == NUL) - /* no glyph, line highlighting only */ + // no glyph, line highlighting only coloncmd(":sign define %d linehl=NB_%s", i + 1, typeName); else if (vim_strsize(glyphFile) <= 2) - /* one- or two-character glyph name, use as text glyph with - * texthl */ + // one- or two-character glyph name, use as text glyph with + // texthl coloncmd(":sign define %d text=%s texthl=NB_%s", i + 1, glyphFile, typeName); else - /* glyph, line highlighting */ + // glyph, line highlighting coloncmd(":sign define %d icon=%s linehl=NB_%s", i + 1, glyphFile, typeName); } else - /* glyph, no line highlighting */ + // glyph, no line highlighting coloncmd(":sign define %d icon=%s", i + 1, glyphFile); if (STRCMP(typeName,"CurrentPC") == 0) @@ -3207,12 +3206,12 @@ addsigntype( if (globalsignmapused == globalsignmaplen) { - if (globalsignmaplen == 0) /* first allocation */ + if (globalsignmaplen == 0) // first allocation { globalsignmaplen = 20; globalsignmap = ALLOC_CLEAR_MULT(char *, globalsignmaplen); } - else /* grow it */ + else // grow it { int incr; int oldlen = globalsignmaplen; @@ -3236,20 +3235,20 @@ addsigntype( globalsignmapused = i + 1; } - /* check local map; should *not* be found! */ + // check local map; should *not* be found! for (j = 0; j < buf->signmapused; j++) if (buf->signmap[j] == i + 1) return; - /* add to local map */ + // add to local map if (buf->signmapused == buf->signmaplen) { - if (buf->signmaplen == 0) /* first allocation */ + if (buf->signmaplen == 0) // first allocation { buf->signmaplen = 5; buf->signmap = ALLOC_CLEAR_MULT(int, buf->signmaplen); } - else /* grow it */ + else // grow it { int incr; int oldlen = buf->signmaplen; @@ -3310,7 +3309,7 @@ get_buf_size(buf_T *bufp) { char_count += (long)STRLEN(ml_get_buf(bufp, lnum, FALSE)) + eol_size; - /* Check for a CTRL-C every 100000 characters */ + // Check for a CTRL-C every 100000 characters if (char_count > last_check) { ui_breakcheck(); @@ -3319,7 +3318,7 @@ get_buf_size(buf_T *bufp) last_check = char_count + 100000L; } } - /* Correction for when last line doesn't have an EOL. */ + // Correction for when last line doesn't have an EOL. if (!bufp->b_p_eol && (bufp->b_p_bin || !bufp->b_p_fixeol)) char_count -= eol_size; } @@ -3424,7 +3423,7 @@ print_read_msg(nbbuf_T *buf) } msg_add_lines(c, (long)lnum, nchars); - /* Now display it */ + // Now display it VIM_CLEAR(keep_msg); msg_scrolled_ign = TRUE; msg_trunc_attr((char *)IObuff, FALSE, 0); @@ -3445,7 +3444,7 @@ print_save_msg(nbbuf_T *buf, off_T nchars) if (nchars >= 0) { - /* put fname in IObuff with quotes */ + // put fname in IObuff with quotes msg_add_fname(buf->bufp, buf->bufp->b_ffname); c = FALSE; @@ -3457,16 +3456,16 @@ print_save_msg(nbbuf_T *buf, off_T nchars) p = (char_u *)msg_trunc_attr((char *)IObuff, FALSE, 0); if ((msg_scrolled && !need_wait_return) || !buf->initDone) { - /* Need to repeat the message after redrawing when: - * - When reading from stdin (the screen will be cleared next). - * - When restart_edit is set (otherwise there will be a delay - * before redrawing). - * - When the screen was scrolled but there is no wait-return - * prompt. */ + // Need to repeat the message after redrawing when: + // - When reading from stdin (the screen will be cleared next). + // - When restart_edit is set (otherwise there will be a delay + // before redrawing). + // - When the screen was scrolled but there is no wait-return + // prompt. set_keep_msg(p, 0); } msg_scrolled_ign = FALSE; - /* add_to_input_buf((char_u *)"\f", 1); */ + // add_to_input_buf((char_u *)"\f", 1); } else { @@ -3479,4 +3478,4 @@ print_save_msg(nbbuf_T *buf, off_T nchars) } } -#endif /* defined(FEAT_NETBEANS_INTG) */ +#endif // defined(FEAT_NETBEANS_INTG) diff --git a/src/normal.c b/src/normal.c index ca2a48c08..c4963e621 100644 --- a/src/normal.c +++ b/src/normal.c @@ -137,18 +137,18 @@ static char *e_noident = N_("E349: No identifier under cursor"); */ typedef void (*nv_func_T)(cmdarg_T *cap); -/* Values for cmd_flags. */ -#define NV_NCH 0x01 /* may need to get a second char */ -#define NV_NCH_NOP (0x02|NV_NCH) /* get second char when no operator pending */ -#define NV_NCH_ALW (0x04|NV_NCH) /* always get a second char */ -#define NV_LANG 0x08 /* second char needs language adjustment */ +// Values for cmd_flags. +#define NV_NCH 0x01 // may need to get a second char +#define NV_NCH_NOP (0x02|NV_NCH) // get second char when no operator pending +#define NV_NCH_ALW (0x04|NV_NCH) // always get a second char +#define NV_LANG 0x08 // second char needs language adjustment -#define NV_SS 0x10 /* may start selection */ -#define NV_SSS 0x20 /* may start selection with shift modifier */ -#define NV_STS 0x40 /* may stop selection without shift modif. */ -#define NV_RL 0x80 /* 'rightleft' modifies command */ -#define NV_KEEPREG 0x100 /* don't clear regname */ -#define NV_NCW 0x200 /* not allowed in command-line window */ +#define NV_SS 0x10 // may start selection +#define NV_SSS 0x20 // may start selection with shift modifier +#define NV_STS 0x40 // may stop selection without shift modif. +#define NV_RL 0x80 // 'rightleft' modifies command +#define NV_KEEPREG 0x100 // don't clear regname +#define NV_NCW 0x200 // not allowed in command-line window /* * Generally speaking, every Normal mode command should either clear any @@ -167,10 +167,10 @@ typedef void (*nv_func_T)(cmdarg_T *cap); */ static const struct nv_cmd { - int cmd_char; /* (first) command character */ - nv_func_T cmd_func; /* function for this command */ - short_u cmd_flags; /* NV_ flags */ - short cmd_arg; /* value for ca.arg */ + int cmd_char; // (first) command character + nv_func_T cmd_func; // function for this command + short_u cmd_flags; // NV_ flags + short cmd_arg; // value for ca.arg } nv_cmds[] = { {NUL, nv_error, 0, 0}, @@ -301,7 +301,7 @@ static const struct nv_cmd {'}', nv_findpar, 0, FORWARD}, {'~', nv_tilde, 0, 0}, - /* pound sign */ + // pound sign {POUND, nv_ident, 0, 0}, {K_MOUSEUP, nv_mousescroll, 0, MSCR_UP}, {K_MOUSEDOWN, nv_mousescroll, 0, MSCR_DOWN}, @@ -377,14 +377,14 @@ static const struct nv_cmd {K_PS, nv_edit, 0, 0}, }; -/* Number of commands in nv_cmds[]. */ +// Number of commands in nv_cmds[]. #define NV_CMDS_SIZE (sizeof(nv_cmds) / sizeof(struct nv_cmd)) -/* Sorted index of commands in nv_cmds[]. */ +// Sorted index of commands in nv_cmds[]. static short nv_cmd_idx[NV_CMDS_SIZE]; -/* The highest index for which - * nv_cmds[idx].cmd_char == nv_cmd_idx[nv_cmds[idx].cmd_char] */ +// The highest index for which +// nv_cmds[idx].cmd_char == nv_cmd_idx[nv_cmds[idx].cmd_char] static int nv_max_linear; /* @@ -396,7 +396,7 @@ nv_compare(const void *s1, const void *s2) { int c1, c2; - /* The commands are sorted on absolute value. */ + // The commands are sorted on absolute value. c1 = nv_cmds[*(const short *)s1].cmd_char; c2 = nv_cmds[*(const short *)s2].cmd_char; if (c1 < 0) @@ -414,14 +414,14 @@ init_normal_cmds(void) { int i; - /* Fill the index table with a one to one relation. */ + // Fill the index table with a one to one relation. for (i = 0; i < (int)NV_CMDS_SIZE; ++i) nv_cmd_idx[i] = i; - /* Sort the commands by the command character. */ + // Sort the commands by the command character. qsort((void *)&nv_cmd_idx, (size_t)NV_CMDS_SIZE, sizeof(short), nv_compare); - /* Find the first entry that can't be indexed by the command character. */ + // Find the first entry that can't be indexed by the command character. for (i = 0; i < (int)NV_CMDS_SIZE; ++i) if (i != nv_cmds[nv_cmd_idx[i]].cmd_char) break; @@ -440,21 +440,21 @@ find_command(int cmdchar) int top, bot; int c; - /* A multi-byte character is never a command. */ + // A multi-byte character is never a command. if (cmdchar >= 0x100) return -1; - /* We use the absolute value of the character. Special keys have a - * negative value, but are sorted on their absolute value. */ + // We use the absolute value of the character. Special keys have a + // negative value, but are sorted on their absolute value. if (cmdchar < 0) cmdchar = -cmdchar; - /* If the character is in the first part: The character is the index into - * nv_cmd_idx[]. */ + // If the character is in the first part: The character is the index into + // nv_cmd_idx[]. if (cmdchar <= nv_max_linear) return nv_cmd_idx[cmdchar]; - /* Perform a binary search. */ + // Perform a binary search. bot = nv_max_linear + 1; top = NV_CMDS_SIZE - 1; idx = -1; @@ -483,16 +483,16 @@ find_command(int cmdchar) void normal_cmd( oparg_T *oap, - int toplevel UNUSED) /* TRUE when called from main() */ + int toplevel UNUSED) // TRUE when called from main() { - cmdarg_T ca; /* command arguments */ + cmdarg_T ca; // command arguments int c; - int ctrl_w = FALSE; /* got CTRL-W command */ + int ctrl_w = FALSE; // got CTRL-W command int old_col = curwin->w_curswant; #ifdef FEAT_CMDL_INFO - int need_flushbuf; /* need to call out_flush() */ + int need_flushbuf; // need to call out_flush() #endif - pos_T old_pos; /* cursor position before command */ + pos_T old_pos; // cursor position before command int mapped_len; static int old_mapped_len = 0; int idx; @@ -500,12 +500,12 @@ normal_cmd( int set_prevcount = FALSE; #endif - vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */ + vim_memset(&ca, 0, sizeof(ca)); // also resets ca.retval ca.oap = oap; - /* Use a count remembered from before entering an operator. After typing - * "3d" we return from normal_cmd() and come back here, the "3" is - * remembered in "opcount". */ + // Use a count remembered from before entering an operator. After typing + // "3d" we return from normal_cmd() and come back here, the "3" is + // remembered in "opcount". ca.opcount = opcount; /* @@ -520,15 +520,15 @@ normal_cmd( #ifdef CURSOR_SHAPE if (finish_op != c) { - ui_cursor_shape(); /* may show different cursor shape */ + ui_cursor_shape(); // may show different cursor shape # ifdef FEAT_MOUSESHAPE update_mouseshape(-1); # endif } #endif - /* When not finishing an operator and no register name typed, reset the - * count. */ + // When not finishing an operator and no register name typed, reset the + // count. if (!finish_op && !oap->regname) { ca.opcount = 0; @@ -537,9 +537,9 @@ normal_cmd( #endif } - /* Restore counts from before receiving K_CURSORHOLD. This means after - * typing "3", handling K_CURSORHOLD and then typing "2" we get "32", not - * "3 * 2". */ + // Restore counts from before receiving K_CURSORHOLD. This means after + // typing "3", handling K_CURSORHOLD and then typing "2" we get "32", not + // "3 * 2". if (oap->prev_opcount > 0 || oap->prev_count0 > 0) { ca.opcount = oap->prev_opcount; @@ -552,13 +552,13 @@ normal_cmd( State = NORMAL_BUSY; #ifdef USE_ON_FLY_SCROLL - dont_scroll = FALSE; /* allow scrolling here */ + dont_scroll = FALSE; // allow scrolling here #endif #ifdef FEAT_EVAL - /* Set v:count here, when called from main() and not a stuffed - * command, so that v:count can be used in an expression mapping - * when there is no count. Do set it for redo. */ + // Set v:count here, when called from main() and not a stuffed + // command, so that v:count can be used in an expression mapping + // when there is no count. Do set it for redo. if (toplevel && readbuf1_empty()) set_vcount_ca(&ca, &set_prevcount); #endif @@ -590,18 +590,18 @@ normal_cmd( && VIsual_select && (vim_isprintc(c) || c == NL || c == CAR || c == K_KENTER)) { - /* Fake a "c"hange command. When "restart_edit" is set (e.g., because - * 'insertmode' is set) fake a "d"elete command, Insert mode will - * restart automatically. - * Insert the typed character in the typeahead buffer, so that it can - * be mapped in Insert mode. Required for ":lmap" to work. */ + // Fake a "c"hange command. When "restart_edit" is set (e.g., because + // 'insertmode' is set) fake a "d"elete command, Insert mode will + // restart automatically. + // Insert the typed character in the typeahead buffer, so that it can + // be mapped in Insert mode. Required for ":lmap" to work. ins_char_typebuf(c); if (restart_edit != 0) c = 'd'; else c = 'c'; - msg_nowait = TRUE; /* don't delay going to insert mode */ - old_mapped_len = 0; /* do go to Insert mode */ + msg_nowait = TRUE; // don't delay going to insert mode + old_mapped_len = 0; // do go to Insert mode } #ifdef FEAT_CMDL_INFO @@ -623,26 +623,26 @@ getcount: { ca.count0 /= 10; #ifdef FEAT_CMDL_INFO - del_from_showcmd(4); /* delete the digit and ~@% */ + del_from_showcmd(4); // delete the digit and ~@% #endif } else ca.count0 = ca.count0 * 10 + (c - '0'); - if (ca.count0 < 0) /* got too large! */ + if (ca.count0 < 0) // got too large! ca.count0 = 999999999L; #ifdef FEAT_EVAL - /* Set v:count here, when called from main() and not a stuffed - * command, so that v:count can be used in an expression mapping - * right after the count. Do set it for redo. */ + // Set v:count here, when called from main() and not a stuffed + // command, so that v:count can be used in an expression mapping + // right after the count. Do set it for redo. if (toplevel && readbuf1_empty()) set_vcount_ca(&ca, &set_prevcount); #endif if (ctrl_w) { ++no_mapping; - ++allow_keys; /* no mapping for nchar, but keys */ + ++allow_keys; // no mapping for nchar, but keys } - ++no_zero_mapping; /* don't map zero here */ + ++no_zero_mapping; // don't map zero here c = plain_vgetc(); LANGMAP_ADJUST(c, TRUE); --no_zero_mapping; @@ -662,25 +662,25 @@ getcount: if (c == Ctrl_W && !ctrl_w && oap->op_type == OP_NOP) { ctrl_w = TRUE; - ca.opcount = ca.count0; /* remember first count */ + ca.opcount = ca.count0; // remember first count ca.count0 = 0; ++no_mapping; - ++allow_keys; /* no mapping for nchar, but keys */ - c = plain_vgetc(); /* get next character */ + ++allow_keys; // no mapping for nchar, but keys + c = plain_vgetc(); // get next character LANGMAP_ADJUST(c, TRUE); --no_mapping; --allow_keys; #ifdef FEAT_CMDL_INFO need_flushbuf |= add_to_showcmd(c); #endif - goto getcount; /* jump back */ + goto getcount; // jump back } } if (c == K_CURSORHOLD) { - /* Save the count values so that ca.opcount and ca.count0 are exactly - * the same when coming back here after handling K_CURSORHOLD. */ + // Save the count values so that ca.opcount and ca.count0 are exactly + // the same when coming back here after handling K_CURSORHOLD. oap->prev_opcount = ca.opcount; oap->prev_count0 = ca.count0; } @@ -733,14 +733,14 @@ getcount: idx = find_command(ca.cmdchar); if (idx < 0) { - /* Not a known command: beep. */ + // Not a known command: beep. clearopbeep(oap); goto normal_end; } if (text_locked() && (nv_cmds[idx].cmd_flags & NV_NCW)) { - /* This command is not allowed while editing a cmdline: beep. */ + // This command is not allowed while editing a cmdline: beep. clearopbeep(oap); text_locked_msg(); goto normal_end; @@ -753,7 +753,7 @@ getcount: */ if (VIsual_active) { - /* when 'keymodel' contains "stopsel" may stop Select/Visual mode */ + // when 'keymodel' contains "stopsel" may stop Select/Visual mode if (km_stopsel && (nv_cmds[idx].cmd_flags & NV_STS) && !(mod_mask & MOD_MASK_SHIFT)) @@ -762,7 +762,7 @@ getcount: redraw_curbuf_later(INVERTED); } - /* Keys that work different when 'keymodel' contains "startsel" */ + // Keys that work different when 'keymodel' contains "startsel" if (km_startsel) { if (nv_cmds[idx].cmd_flags & NV_SS) @@ -771,7 +771,7 @@ getcount: idx = find_command(ca.cmdchar); if (idx < 0) { - /* Just in case */ + // Just in case clearopbeep(oap); goto normal_end; } @@ -786,9 +786,9 @@ getcount: if (curwin->w_p_rl && KeyTyped && !KeyStuffed && (nv_cmds[idx].cmd_flags & NV_RL)) { - /* Invert horizontal movements and operations. Only when typed by the - * user directly, not when the result of a mapping or "x" translated - * to "dl". */ + // Invert horizontal movements and operations. Only when typed by the + // user directly, not when the result of a mapping or "x" translated + // to "dl". switch (ca.cmdchar) { case 'l': ca.cmdchar = 'h'; break; @@ -821,18 +821,18 @@ getcount: && (oap->op_type != OP_NOP || VIsual_active)))) { int *cp; - int repl = FALSE; /* get character for replace mode */ - int lit = FALSE; /* get extra character literally */ - int langmap_active = FALSE; /* using :lmap mappings */ - int lang; /* getting a text character */ + int repl = FALSE; // get character for replace mode + int lit = FALSE; // get extra character literally + int langmap_active = FALSE; // using :lmap mappings + int lang; // getting a text character #ifdef HAVE_INPUT_METHOD - int save_smd; /* saved value of p_smd */ + int save_smd; // saved value of p_smd #endif ++no_mapping; - ++allow_keys; /* no mapping for nchar, but allow key codes */ - /* Don't generate a CursorHold event here, most commands can't handle - * it, e.g., nv_replace(), nv_csearch(). */ + ++allow_keys; // no mapping for nchar, but allow key codes + // Don't generate a CursorHold event here, most commands can't handle + // it, e.g., nv_replace(), nv_csearch(). did_cursorhold = TRUE; if (ca.cmdchar == 'g') { @@ -848,18 +848,18 @@ getcount: if (ca.nchar == 'r' || ca.nchar == '\'' || ca.nchar == '`' || ca.nchar == Ctrl_BSL) { - cp = &ca.extra_char; /* need to get a third character */ + cp = &ca.extra_char; // need to get a third character if (ca.nchar != 'r') - lit = TRUE; /* get it literally */ + lit = TRUE; // get it literally else - repl = TRUE; /* get it in replace mode */ + repl = TRUE; // get it in replace mode } else - cp = NULL; /* no third character needed */ + cp = NULL; // no third character needed } else { - if (ca.cmdchar == 'r') /* get it in replace mode */ + if (ca.cmdchar == 'r') // get it in replace mode repl = TRUE; cp = &ca.nchar; } @@ -872,14 +872,14 @@ getcount: { if (repl) { - State = REPLACE; /* pretend Replace mode */ + State = REPLACE; // pretend Replace mode #ifdef CURSOR_SHAPE - ui_cursor_shape(); /* show different cursor shape */ + ui_cursor_shape(); // show different cursor shape #endif } if (lang && curbuf->b_p_iminsert == B_IMODE_LMAP) { - /* Allow mappings defined with ":lmap". */ + // Allow mappings defined with ":lmap". --no_mapping; --allow_keys; if (repl) @@ -890,7 +890,7 @@ getcount: } #ifdef HAVE_INPUT_METHOD save_smd = p_smd; - p_smd = FALSE; /* Don't let the IM code show the mode here */ + p_smd = FALSE; // Don't let the IM code show the mode here if (lang && curbuf->b_p_iminsert == B_IMODE_IM) im_set_active(TRUE); #endif @@ -899,7 +899,7 @@ getcount: if (langmap_active) { - /* Undo the decrement done above */ + // Undo the decrement done above ++no_mapping; ++allow_keys; State = NORMAL_BUSY; @@ -921,7 +921,7 @@ getcount: if (!lit) { #ifdef FEAT_DIGRAPHS - /* Typing CTRL-K gets a digraph. */ + // Typing CTRL-K gets a digraph. if (*cp == Ctrl_K && ((nv_cmds[idx].cmd_flags & NV_LANG) || cp == &ca.extra_char) @@ -932,7 +932,7 @@ getcount: { *cp = c; # ifdef FEAT_CMDL_INFO - /* Guessing how to update showcmd here... */ + // Guessing how to update showcmd here... del_from_showcmd(3); need_flushbuf |= add_to_showcmd(*cp); # endif @@ -940,10 +940,10 @@ getcount: } #endif - /* adjust chars > 127, except after "tTfFr" commands */ + // adjust chars > 127, except after "tTfFr" commands LANGMAP_ADJUST(*cp, !lang); #ifdef FEAT_RIGHTLEFT - /* adjust Hebrew mapped char */ + // adjust Hebrew mapped char if (p_hkmap && lang && KeyTyped) *cp = hkmap(*cp); #endif @@ -967,8 +967,8 @@ getcount: { long towait = (p_ttm >= 0 ? p_ttm : p_tm); - /* There is a busy wait here when typing "f<C-\>" and then - * something different from CTRL-N. Can't be avoided. */ + // There is a busy wait here when typing "f<C-\>" and then + // something different from CTRL-N. Can't be avoided. while ((c = vpeekc()) <= 0 && towait > 0L) { do_sleep(towait > 50L ? 50L : towait); @@ -988,11 +988,11 @@ getcount: } } - /* When getting a text character and the next character is a - * multi-byte character, it could be a composing character. - * However, don't wait for it to arrive. Also, do enable mapping, - * because if it's put back with vungetc() it's too late to apply - * mapping. */ + // When getting a text character and the next character is a + // multi-byte character, it could be a composing character. + // However, don't wait for it to arrive. Also, do enable mapping, + // because if it's put back with vungetc() it's too late to apply + // mapping. --no_mapping; while (enc_utf8 && lang && (c = vpeekc()) > 0 && (c >= 0x100 || MB_BYTE2LEN(vpeekc()) > 1)) @@ -1000,7 +1000,7 @@ getcount: c = plain_vgetc(); if (!utf_iscomposing(c)) { - vungetc(c); /* it wasn't, put it back */ + vungetc(c); // it wasn't, put it back break; } else if (ca.ncharC1 == 0) @@ -1039,14 +1039,14 @@ getcount: if (ca.cmdchar != K_IGNORE) { - msg_didout = FALSE; /* don't scroll screen up for normal command */ + msg_didout = FALSE; // don't scroll screen up for normal command msg_col = 0; } - old_pos = curwin->w_cursor; /* remember where cursor was */ + old_pos = curwin->w_cursor; // remember where cursor was - /* When 'keymodel' contains "startsel" some keys start Select/Visual - * mode. */ + // When 'keymodel' contains "startsel" some keys start Select/Visual + // mode. if (!VIsual_active && km_startsel) { if (nv_cmds[idx].cmd_flags & NV_SS) @@ -1083,8 +1083,8 @@ getcount: { int regname = 0; - /* Adjust the register according to 'clipboard', so that when - * "unnamed" is present it becomes '*' or '+' instead of '"'. */ + // Adjust the register according to 'clipboard', so that when + // "unnamed" is present it becomes '*' or '+' instead of '"'. # ifdef FEAT_CLIPBOARD adjust_clip_reg(®name); # endif @@ -1093,8 +1093,8 @@ getcount: #endif } - /* Get the length of mapped chars again after typing a count, second - * character or "z333<cr>". */ + // Get the length of mapped chars again after typing a count, second + // character or "z333<cr>". if (old_mapped_len > 0) old_mapped_len = typebuf_maplen(); @@ -1142,12 +1142,12 @@ getcount: { int save_State = State; - /* Draw the cursor with the right shape here */ + // Draw the cursor with the right shape here if (restart_edit != 0) State = INSERT; - /* If need to redraw, and there is a "keep_msg", redraw before the - * delay */ + // If need to redraw, and there is a "keep_msg", redraw before the + // delay if (must_redraw && keep_msg != NULL && !emsg_on_display) { char_u *kmsg; @@ -1170,8 +1170,8 @@ getcount: cursor_on(); out_flush(); if (msg_scroll || emsg_on_display) - ui_delay(1003L, TRUE); /* wait at least one second */ - ui_delay(3003L, FALSE); /* wait up to three seconds */ + ui_delay(1003L, TRUE); // wait at least one second + ui_delay(3003L, FALSE); // wait up to three seconds State = save_State; msg_scroll = FALSE; @@ -1185,17 +1185,17 @@ normal_end: msg_nowait = FALSE; - /* Reset finish_op, in case it was set */ + // Reset finish_op, in case it was set #ifdef CURSOR_SHAPE c = finish_op; #endif finish_op = FALSE; #ifdef CURSOR_SHAPE - /* Redraw the cursor with another shape, if we were in Operator-pending - * mode or did a replace command. */ + // Redraw the cursor with another shape, if we were in Operator-pending + // mode or did a replace command. if (c || ca.cmdchar == 'r') { - ui_cursor_shape(); /* may show different cursor shape */ + ui_cursor_shape(); // may show different cursor shape # ifdef FEAT_MOUSESHAPE update_mouseshape(-1); # endif @@ -1208,7 +1208,7 @@ normal_end: clear_showcmd(); #endif - checkpcmark(); /* check if we moved since setting pcmark */ + checkpcmark(); // check if we moved since setting pcmark vim_free(ca.searchbuf); if (has_mbyte) @@ -1216,18 +1216,18 @@ normal_end: if (curwin->w_p_scb && toplevel) { - validate_cursor(); /* may need to update w_leftcol */ + validate_cursor(); // may need to update w_leftcol do_check_scrollbind(TRUE); } if (curwin->w_p_crb && toplevel) { - validate_cursor(); /* may need to update w_leftcol */ + validate_cursor(); // may need to update w_leftcol do_check_cursorbind(); } #ifdef FEAT_TERMINAL - /* don't go to Insert mode if a terminal has a running job */ + // don't go to Insert mode if a terminal has a running job if (term_job_running(curbuf->b_term)) restart_edit = 0; #endif @@ -1257,7 +1257,7 @@ normal_end: if (restart_VIsual_select == 2) restart_VIsual_select = 1; - /* Save count before an operator for next time. */ + // Save count before an operator for next time. opcount = ca.opcount; } @@ -1271,11 +1271,11 @@ set_vcount_ca(cmdarg_T *cap, int *set_prevcount) { long count = cap->count0; - /* multiply with cap->opcount the same way as above */ + // multiply with cap->opcount the same way as above if (cap->opcount != 0) count = cap->opcount * (count == 0 ? 1 : count); set_vcount(count, count == 0 ? 1 : count, *set_prevcount); - *set_prevcount = FALSE; /* only set v:prevcount once */ + *set_prevcount = FALSE; // only set v:prevcount once } #endif @@ -1319,7 +1319,7 @@ end_visual_mode(void) setmouse(); mouse_dragging = 0; - /* Save the current VIsual area for '< and '> marks, and "gv" */ + // Save the current VIsual area for '< and '> marks, and "gv" curbuf->b_visual.vi_mode = VIsual_mode; curbuf->b_visual.vi_start = VIsual; curbuf->b_visual.vi_end = curwin->w_cursor; @@ -1343,7 +1343,7 @@ reset_VIsual_and_resel(void) if (VIsual_active) { end_visual_mode(); - redraw_curbuf_later(INVERTED); /* delete the inversion later */ + redraw_curbuf_later(INVERTED); // delete the inversion later } VIsual_reselect = FALSE; } @@ -1357,7 +1357,7 @@ reset_VIsual(void) if (VIsual_active) { end_visual_mode(); - redraw_curbuf_later(INVERTED); /* delete the inversion later */ + redraw_curbuf_later(INVERTED); // delete the inversion later VIsual_reselect = FALSE; } } @@ -1387,7 +1387,7 @@ find_is_eval_item( int *bnp, int dir) { - /* Accept everything inside []. */ + // Accept everything inside []. if ((*ptr == ']' && dir == BACKWARD) || (*ptr == '[' && dir == FORWARD)) ++*bnp; if (*bnp > 0) @@ -1397,11 +1397,11 @@ find_is_eval_item( return TRUE; } - /* skip over "s.var" */ + // skip over "s.var" if (*ptr == '.') return TRUE; - /* two-character item: s->var */ + // two-character item: s->var if (ptr[dir == BACKWARD ? 0 : 1] == '>' && ptr[dir == BACKWARD ? -1 : 0] == '-') { @@ -1499,7 +1499,7 @@ find_ident_at_pos( */ if (has_mbyte) { - /* Remember class of character under cursor. */ + // Remember class of character under cursor. if ((find_type & FIND_EVAL) && ptr[col] == ']') this_class = mb_get_class((char_u *)"a"); else @@ -1624,7 +1624,7 @@ prep_redo( int cmd5) { ResetRedobuff(); - if (regname != 0) /* yank from specified buffer */ + if (regname != 0) // yank from specified buffer { AppendCharToRedobuff('"'); AppendCharToRedobuff(regname); @@ -1714,7 +1714,7 @@ unshift_special(cmdarg_T *cap) may_clear_cmdline(void) { if (mode_displayed) - clear_cmdline = TRUE; /* unshow visual mode later */ + clear_cmdline = TRUE; // unshow visual mode later #ifdef FEAT_CMDL_INFO else clear_showcmd(); @@ -1728,7 +1728,7 @@ may_clear_cmdline(void) #define SHOWCMD_BUFLEN SHOWCMD_COLS + 1 + 30 static char_u showcmd_buf[SHOWCMD_BUFLEN]; -static char_u old_showcmd_buf[SHOWCMD_BUFLEN]; /* For push_showcmd() */ +static char_u old_showcmd_buf[SHOWCMD_BUFLEN]; // For push_showcmd() static int showcmd_is_clear = TRUE; static int showcmd_visual = FALSE; @@ -1747,7 +1747,7 @@ clear_showcmd(void) colnr_T leftcol, rightcol; linenr_T top, bot; - /* Show the size of the Visual area. */ + // Show the size of the Visual area. if (cursor_bot) { top = VIsual.lnum; @@ -1759,7 +1759,7 @@ clear_showcmd(void) bot = VIsual.lnum; } # ifdef FEAT_FOLDING - /* Include closed folds as a whole. */ + // Include closed folds as a whole. (void)hasFolding(top, &top, NULL); (void)hasFolding(bot, NULL, &bot); # endif @@ -1771,7 +1771,7 @@ clear_showcmd(void) char_u *saved_sbr = p_sbr; char_u *saved_w_sbr = curwin->w_p_sbr; - /* Make 'sbr' empty for a moment to get the correct size. */ + // Make 'sbr' empty for a moment to get the correct size. p_sbr = empty_option; curwin->w_p_sbr = empty_option; # endif @@ -1809,7 +1809,7 @@ clear_showcmd(void) { ++bytes; ++chars; - break; /* end of line */ + break; // end of line } bytes += l; ++chars; @@ -1820,7 +1820,7 @@ clear_showcmd(void) else sprintf((char *)showcmd_buf, "%d-%d", chars, bytes); } - showcmd_buf[SHOWCMD_COLS] = NUL; /* truncate */ + showcmd_buf[SHOWCMD_COLS] = NUL; // truncate showcmd_visual = TRUE; } else @@ -1828,7 +1828,7 @@ clear_showcmd(void) showcmd_buf[0] = NUL; showcmd_visual = FALSE; - /* Don't actually display something if there is nothing to clear. */ + // Don't actually display something if there is nothing to clear. if (showcmd_is_clear) return; } @@ -1873,7 +1873,7 @@ add_to_showcmd(int c) showcmd_visual = FALSE; } - /* Ignore keys that are scrollbar updates and mouse clicks */ + // Ignore keys that are scrollbar updates and mouse clicks if (IS_SPECIAL(c)) for (i = 0; ignore[i] != 0; ++i) if (ignore[i] == c) @@ -1969,7 +1969,7 @@ display_showcmd(void) */ screen_puts((char_u *)" " + len, (int)Rows - 1, sc_col + len, 0); - setcursor(); /* put cursor back where it belongs */ + setcursor(); // put cursor back where it belongs } #endif @@ -1991,8 +1991,8 @@ do_check_scrollbind(int check) if (check && curwin->w_p_scb) { - /* If a ":syncbind" command was just used, don't scroll, only reset - * the values. */ + // If a ":syncbind" command was just used, don't scroll, only reset + // the values. if (did_syncbind) did_syncbind = FALSE; else if (curwin == old_curwin) @@ -2017,7 +2017,7 @@ do_check_scrollbind(int check) (long)(curwin->w_leftcol - old_leftcol)); } } - else if (vim_strchr(p_sbo, 'j')) /* jump flag set in 'scrollopt' */ + else if (vim_strchr(p_sbo, 'j')) // jump flag set in 'scrollopt' { /* * When switching between windows, make sure that the relative @@ -2077,7 +2077,7 @@ check_scrollbind(linenr_T topline_diff, long leftcol_diff) 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_scb) { /* @@ -2140,7 +2140,7 @@ check_scrollbind(linenr_T topline_diff, long leftcol_diff) static void nv_ignore(cmdarg_T *cap) { - cap->retval |= CA_COMMAND_BUSY; /* don't call edit() now */ + cap->retval |= CA_COMMAND_BUSY; // don't call edit() now } /* @@ -2205,7 +2205,7 @@ nv_page(cmdarg_T *cap) { if (mod_mask & MOD_MASK_CTRL) { - /* <C-PageUp>: tab page back; <C-PageDown>: tab page forward */ + // <C-PageUp>: tab page back; <C-PageDown>: tab page forward if (cap->arg == BACKWARD) goto_tabpage(-(int)cap->count1); else @@ -2223,7 +2223,7 @@ nv_page(cmdarg_T *cap) nv_gd( oparg_T *oap, int nchar, - int thisblock) /* 1 for "1gd" and "1gD" */ + int thisblock) // 1 for "1gd" and "1gD" { int len; char_u *ptr; @@ -2297,7 +2297,7 @@ find_decl( int len, int locally, int thisblock, - int flags_arg) /* flags passed to searchit() */ + int flags_arg) // flags passed to searchit() { char_u *pat; pos_T old_pos; @@ -2314,15 +2314,15 @@ find_decl( if ((pat = alloc(len + 7)) == NULL) return FAIL; - /* Put "\V" before the pattern to avoid that the special meaning of "." - * and "~" causes trouble. */ + // Put "\V" before the pattern to avoid that the special meaning of "." + // and "~" causes trouble. sprintf((char *)pat, vim_iswordp(ptr) ? "\\V\\<%.*s\\>" : "\\V%.*s", len, ptr); old_pos = curwin->w_cursor; save_p_ws = p_ws; save_p_scs = p_scs; - p_ws = FALSE; /* don't wrap around end of file now */ - p_scs = FALSE; /* don't switch ignorecase off now */ + p_ws = FALSE; // don't wrap around end of file now + p_scs = FALSE; // don't switch ignorecase off now /* * With "gD" go to line 1. @@ -2331,7 +2331,7 @@ find_decl( */ if (!locally || !findpar(&incll, BACKWARD, 1L, '{', FALSE)) { - setpcmark(); /* Set in findpar() otherwise */ + setpcmark(); // Set in findpar() otherwise curwin->w_cursor.lnum = 1; par_pos = curwin->w_cursor; } @@ -2343,27 +2343,27 @@ find_decl( } curwin->w_cursor.col = 0; - /* Search forward for the identifier, ignore comment lines. */ + // Search forward for the identifier, ignore comment lines. CLEAR_POS(&found_pos); for (;;) { t = searchit(curwin, curbuf, &curwin->w_cursor, NULL, FORWARD, pat, 1L, searchflags, RE_LAST, NULL); if (curwin->w_cursor.lnum >= old_pos.lnum) - t = FAIL; /* match after start is failure too */ + t = FAIL; // match after start is failure too if (thisblock && t != FAIL) { pos_T *pos; - /* Check that the block the match is in doesn't end before the - * position where we started the search from. */ + // Check that the block the match is in doesn't end before the + // position where we started the search from. if ((pos = findmatchlimit(NULL, '}', FM_FORWARD, (int)(old_pos.lnum - curwin->w_cursor.lnum + 1))) != NULL && pos->lnum < old_pos.lnum) { - /* There can't be a useful match before the end of this block. - * Skip to the end. */ + // There can't be a useful match before the end of this block. + // Skip to the end. curwin->w_cursor = *pos; continue; } @@ -2371,7 +2371,7 @@ find_decl( if (t == FAIL) { - /* If we previously found a valid position, use it. */ + // If we previously found a valid position, use it. if (found_pos.lnum != 0) { curwin->w_cursor = found_pos; @@ -2381,41 +2381,41 @@ find_decl( } if (get_leader_len(ml_get_curline(), NULL, FALSE, TRUE) > 0) { - /* Ignore this line, continue at start of next line. */ + // Ignore this line, continue at start of next line. ++curwin->w_cursor.lnum; curwin->w_cursor.col = 0; continue; } valid = is_ident(ml_get_curline(), curwin->w_cursor.col); - /* If the current position is not a valid identifier and a previous - * match is present, favor that one instead. */ + // If the current position is not a valid identifier and a previous + // match is present, favor that one instead. if (!valid && found_pos.lnum != 0) { curwin->w_cursor = found_pos; break; } - /* Global search: use first valid match found */ + // Global search: use first valid match found if (valid && !locally) break; if (valid && curwin->w_cursor.lnum >= par_pos.lnum) { - /* If we previously found a valid position, use it. */ + // If we previously found a valid position, use it. if (found_pos.lnum != 0) curwin->w_cursor = found_pos; break; } - /* For finding a local variable and the match is before the "{" or - * inside a comment, continue searching. For K&R style function - * declarations this skips the function header without types. */ + // For finding a local variable and the match is before the "{" or + // inside a comment, continue searching. For K&R style function + // declarations this skips the function header without types. if (!valid) CLEAR_POS(&found_pos); else found_pos = curwin->w_cursor; - /* Remove SEARCH_START from flags to avoid getting stuck at one - * position. */ + // Remove SEARCH_START from flags to avoid getting stuck at one + // position. searchflags &= ~SEARCH_START; } @@ -2427,7 +2427,7 @@ find_decl( else { curwin->w_set_curswant = TRUE; - /* "n" searches forward now */ + // "n" searches forward now reset_search_dir(); } @@ -2452,10 +2452,10 @@ nv_screengo(oparg_T *oap, int dir, long dist) int retval = OK; int atend = FALSE; int n; - int col_off1; /* margin offset for first screen line */ - int col_off2; /* margin offset for wrapped screen line */ - int width1; /* text width for first screen line */ - int width2; /* test width for wrapped screen line */ + int col_off1; // margin offset for first screen line + int col_off2; // margin offset for wrapped screen line + int width1; // text width for first screen line + int width2; // test width for wrapped screen line oap->motion_type = MCHAR; oap->inclusive = (curwin->w_curswant == MAXCOL); @@ -2465,7 +2465,7 @@ nv_screengo(oparg_T *oap, int dir, long dist) width1 = curwin->w_width - col_off1; width2 = curwin->w_width - col_off2; if (width2 == 0) - width2 = 1; /* avoid divide by zero */ + width2 = 1; // avoid divide by zero if (curwin->w_width != 0) { @@ -2508,7 +2508,7 @@ nv_screengo(oparg_T *oap, int dir, long dist) curwin->w_curswant -= width2; else { - /* to previous line */ + // to previous line if (curwin->w_cursor.lnum == 1) { retval = FAIL; @@ -2516,8 +2516,8 @@ nv_screengo(oparg_T *oap, int dir, long dist) } --curwin->w_cursor.lnum; #ifdef FEAT_FOLDING - /* Move to the start of a closed fold. Don't do that when - * 'foldopen' contains "all": it will open in a moment. */ + // Move to the start of a closed fold. Don't do that when + // 'foldopen' contains "all": it will open in a moment. if (!(fdo_flags & FDO_ALL)) (void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL); @@ -2528,20 +2528,20 @@ nv_screengo(oparg_T *oap, int dir, long dist) + 1) * width2; } } - else /* dir == FORWARD */ + else // dir == FORWARD { if (linelen > width1) n = ((linelen - width1 - 1) / width2 + 1) * width2 + width1; else n = width1; if (curwin->w_curswant + width2 < (colnr_T)n) - /* move forward within line */ + // move forward within line curwin->w_curswant += width2; else { - /* to next line */ + // to next line #ifdef FEAT_FOLDING - /* Move to the end of a closed fold. */ + // Move to the end of a closed fold. (void)hasFolding(curwin->w_cursor.lnum, NULL, &curwin->w_cursor.lnum); #endif @@ -2594,7 +2594,7 @@ nv_screengo(oparg_T *oap, int dir, long dist) } if (atend) - curwin->w_curswant = MAXCOL; /* stick in the last column */ + curwin->w_curswant = MAXCOL; // stick in the last column return retval; } @@ -2628,15 +2628,15 @@ scroll_redraw(int up, long count) scrolldown(count, TRUE); if (get_scrolloff_value()) { - /* Adjust the cursor position for 'scrolloff'. Mark w_topline as - * valid, otherwise the screen jumps back at the end of the file. */ + // Adjust the cursor position for 'scrolloff'. Mark w_topline as + // valid, otherwise the screen jumps back at the end of the file. cursor_correct(); check_cursor_moved(curwin); curwin->w_valid |= VALID_TOPLINE; - /* If moved back to where we were, at least move the cursor, otherwise - * we get stuck at one position. Don't move the cursor up if the - * first line of the buffer is already on the screen */ + // If moved back to where we were, at least move the cursor, otherwise + // we get stuck at one position. Don't move the cursor up if the + // first line of the buffer is already on the screen while (curwin->w_topline == prev_topline #ifdef FEAT_DIFF && curwin->w_topfill == prev_topfill @@ -2656,8 +2656,8 @@ scroll_redraw(int up, long count) || cursor_up(1L, FALSE) == FAIL) break; } - /* Mark w_topline as valid, otherwise the screen jumps back at the - * end of the file. */ + // Mark w_topline as valid, otherwise the screen jumps back at the + // end of the file. check_cursor_moved(curwin); curwin->w_valid |= VALID_TOPLINE; } @@ -2696,10 +2696,10 @@ nv_zet(cmdarg_T *cap) for (;;) { #ifdef USE_ON_FLY_SCROLL - dont_scroll = TRUE; /* disallow scrolling here */ + dont_scroll = TRUE; // disallow scrolling here #endif ++no_mapping; - ++allow_keys; /* no mapping for nchar, but allow key codes */ + ++allow_keys; // no mapping for nchar, but allow key codes nchar = plain_vgetc(); LANGMAP_ADJUST(nchar, TRUE); --no_mapping; @@ -2740,9 +2740,9 @@ nv_zet(cmdarg_T *cap) dozet: if ( #ifdef FEAT_FOLDING - /* "zf" and "zF" are always an operator, "zd", "zo", "zO", "zc" - * and "zC" only in Visual mode. "zj" and "zk" are motion - * commands. */ + // "zf" and "zF" are always an operator, "zd", "zo", "zO", "zc" + // and "zC" only in Visual mode. "zj" and "zk" are motion + // commands. cap->nchar != 'f' && cap->nchar != 'F' && !(VIsual_active && vim_strchr((char_u *)"dcCoO", cap->nchar)) && cap->nchar != 'j' && cap->nchar != 'k' @@ -2769,42 +2769,42 @@ dozet: switch (nchar) { - /* "z+", "z<CR>" and "zt": put cursor at top of screen */ + // "z+", "z<CR>" and "zt": put cursor at top of screen case '+': if (cap->count0 == 0) { - /* No count given: put cursor at the line below screen */ - validate_botline(); /* make sure w_botline is valid */ + // No count given: put cursor at the line below screen + validate_botline(); // make sure w_botline is valid if (curwin->w_botline > curbuf->b_ml.ml_line_count) curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; else curwin->w_cursor.lnum = curwin->w_botline; } - /* FALLTHROUGH */ + // FALLTHROUGH case NL: case CAR: case K_KENTER: beginline(BL_WHITE | BL_FIX); - /* FALLTHROUGH */ + // FALLTHROUGH case 't': scroll_cursor_top(0, TRUE); redraw_later(VALID); set_fraction(curwin); break; - /* "z." and "zz": put cursor in middle of screen */ + // "z." and "zz": put cursor in middle of screen case '.': beginline(BL_WHITE | BL_FIX); - /* FALLTHROUGH */ + // FALLTHROUGH case 'z': scroll_cursor_halfway(TRUE); redraw_later(VALID); set_fraction(curwin); break; - /* "z^", "z-" and "zb": put cursor at bottom of screen */ - case '^': /* Strange Vi behavior: <count>z^ finds line at top of window - * when <count> is at bottom of window, and puts that one at - * bottom of window. */ + // "z^", "z-" and "zb": put cursor at bottom of screen + case '^': // Strange Vi behavior: <count>z^ finds line at top of window + // when <count> is at bottom of window, and puts that one at + // bottom of window. if (cap->count0 != 0) { scroll_cursor_bot(0, TRUE); @@ -2814,22 +2814,22 @@ dozet: curwin->w_cursor.lnum = 1; else curwin->w_cursor.lnum = curwin->w_topline - 1; - /* FALLTHROUGH */ + // FALLTHROUGH case '-': beginline(BL_WHITE | BL_FIX); - /* FALLTHROUGH */ + // FALLTHROUGH case 'b': scroll_cursor_bot(0, TRUE); redraw_later(VALID); set_fraction(curwin); break; - /* "zH" - scroll screen right half-page */ + // "zH" - scroll screen right half-page case 'H': cap->count1 *= curwin->w_width / 2; - /* FALLTHROUGH */ + // FALLTHROUGH - /* "zh" - scroll screen to the right */ + // "zh" - scroll screen to the right case 'h': case K_LEFT: if (!curwin->w_p_wrap) @@ -2842,27 +2842,27 @@ dozet: } break; - /* "zL" - scroll screen left half-page */ + // "zL" - scroll screen left half-page case 'L': cap->count1 *= curwin->w_width / 2; - /* FALLTHROUGH */ + // FALLTHROUGH - /* "zl" - scroll screen to the left */ + // "zl" - scroll screen to the left case 'l': case K_RIGHT: if (!curwin->w_p_wrap) { - /* scroll the window left */ + // scroll the window left curwin->w_leftcol += (colnr_T)cap->count1; leftcol_changed(); } break; - /* "zs" - scroll screen, cursor at the start */ + // "zs" - scroll screen, cursor at the start case 's': if (!curwin->w_p_wrap) { #ifdef FEAT_FOLDING if (hasFolding(curwin->w_cursor.lnum, NULL, NULL)) - col = 0; /* like the cursor is in col 0 */ + col = 0; // like the cursor is in col 0 else #endif getvcol(curwin, &curwin->w_cursor, &col, NULL, NULL); @@ -2878,12 +2878,12 @@ dozet: } break; - /* "ze" - scroll screen, cursor at the end */ + // "ze" - scroll screen, cursor at the end case 'e': if (!curwin->w_p_wrap) { #ifdef FEAT_FOLDING if (hasFolding(curwin->w_cursor.lnum, NULL, NULL)) - col = 0; /* like the cursor is in col 0 */ + col = 0; // like the cursor is in col 0 else #endif getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col); @@ -2901,8 +2901,8 @@ dozet: break; #ifdef FEAT_FOLDING - /* "zF": create fold command */ - /* "zf": create fold operator */ + // "zF": create fold command + // "zf": create fold operator case 'F': case 'f': if (foldManualAllowed(TRUE)) { @@ -2910,7 +2910,7 @@ dozet: nv_operator(cap); curwin->w_p_fen = TRUE; - /* "zF" is like "zfzf" */ + // "zF" is like "zfzf" if (nchar == 'F' && cap->oap->op_type == OP_FOLD) { nv_operator(cap); @@ -2921,8 +2921,8 @@ dozet: clearopbeep(cap->oap); break; - /* "zd": delete fold at cursor */ - /* "zD": delete fold at cursor recursively */ + // "zd": delete fold at cursor + // "zD": delete fold at cursor recursively case 'd': case 'D': if (foldManualAllowed(FALSE)) { @@ -2934,7 +2934,7 @@ dozet: } break; - /* "zE": erase all folds */ + // "zE": erase all folds case 'E': if (foldmethodIsManual(curwin)) { clearFolding(curwin); @@ -2947,19 +2947,19 @@ dozet: emsg(_("E352: Cannot erase folds with current 'foldmethod'")); break; - /* "zn": fold none: reset 'foldenable' */ + // "zn": fold none: reset 'foldenable' case 'n': curwin->w_p_fen = FALSE; break; - /* "zN": fold Normal: set 'foldenable' */ + // "zN": fold Normal: set 'foldenable' case 'N': curwin->w_p_fen = TRUE; break; - /* "zi": invert folding: toggle 'foldenable' */ + // "zi": invert folding: toggle 'foldenable' case 'i': curwin->w_p_fen = !curwin->w_p_fen; break; - /* "za": open closed fold or close open fold at cursor */ + // "za": open closed fold or close open fold at cursor case 'a': if (hasFolding(curwin->w_cursor.lnum, NULL, NULL)) openFold(curwin->w_cursor.lnum, cap->count1); else @@ -2969,7 +2969,7 @@ dozet: } break; - /* "zA": open fold at cursor recursively */ + // "zA": open fold at cursor recursively case 'A': if (hasFolding(curwin->w_cursor.lnum, NULL, NULL)) openFoldRecurse(curwin->w_cursor.lnum); else @@ -2979,21 +2979,21 @@ dozet: } break; - /* "zo": open fold at cursor or Visual area */ + // "zo": open fold at cursor or Visual area case 'o': if (VIsual_active) nv_operator(cap); else openFold(curwin->w_cursor.lnum, cap->count1); break; - /* "zO": open fold recursively */ + // "zO": open fold recursively case 'O': if (VIsual_active) nv_operator(cap); else openFoldRecurse(curwin->w_cursor.lnum); break; - /* "zc": close fold at cursor or Visual area */ + // "zc": close fold at cursor or Visual area case 'c': if (VIsual_active) nv_operator(cap); else @@ -3001,7 +3001,7 @@ dozet: curwin->w_p_fen = TRUE; break; - /* "zC": close fold recursively */ + // "zC": close fold recursively case 'C': if (VIsual_active) nv_operator(cap); else @@ -3009,41 +3009,41 @@ dozet: curwin->w_p_fen = TRUE; break; - /* "zv": open folds at the cursor */ + // "zv": open folds at the cursor case 'v': foldOpenCursor(); break; - /* "zx": re-apply 'foldlevel' and open folds at the cursor */ + // "zx": re-apply 'foldlevel' and open folds at the cursor case 'x': curwin->w_p_fen = TRUE; - curwin->w_foldinvalid = TRUE; /* recompute folds */ - newFoldLevel(); /* update right now */ + curwin->w_foldinvalid = TRUE; // recompute folds + newFoldLevel(); // update right now foldOpenCursor(); break; - /* "zX": undo manual opens/closes, re-apply 'foldlevel' */ + // "zX": undo manual opens/closes, re-apply 'foldlevel' case 'X': curwin->w_p_fen = TRUE; - curwin->w_foldinvalid = TRUE; /* recompute folds */ - old_fdl = -1; /* force an update */ + curwin->w_foldinvalid = TRUE; // recompute folds + old_fdl = -1; // force an update break; - /* "zm": fold more */ + // "zm": fold more case 'm': if (curwin->w_p_fdl > 0) { curwin->w_p_fdl -= cap->count1; if (curwin->w_p_fdl < 0) curwin->w_p_fdl = 0; } - old_fdl = -1; /* force an update */ + old_fdl = -1; // force an update curwin->w_p_fen = TRUE; break; - /* "zM": close all folds */ + // "zM": close all folds case 'M': curwin->w_p_fdl = 0; - old_fdl = -1; /* force an update */ + old_fdl = -1; // force an update curwin->w_p_fen = TRUE; break; - /* "zr": reduce folding */ + // "zr": reduce folding case 'r': curwin->w_p_fdl += cap->count1; { int d = getDeepestNesting(); @@ -3053,24 +3053,24 @@ dozet: } break; - /* "zR": open all folds */ + // "zR": open all folds case 'R': curwin->w_p_fdl = getDeepestNesting(); - old_fdl = -1; /* force an update */ + old_fdl = -1; // force an update break; - case 'j': /* "zj" move to next fold downwards */ - case 'k': /* "zk" move to next fold upwards */ + case 'j': // "zj" move to next fold downwards + case 'k': // "zk" move to next fold upwards if (foldMoveTo(TRUE, nchar == 'j' ? FORWARD : BACKWARD, cap->count1) == FAIL) clearopbeep(cap->oap); break; -#endif /* FEAT_FOLDING */ +#endif // FEAT_FOLDING #ifdef FEAT_SPELL - case 'u': /* "zug" and "zuw": undo "zg" and "zw" */ + case 'u': // "zug" and "zuw": undo "zg" and "zw" ++no_mapping; - ++allow_keys; /* no mapping for nchar, but allow key codes */ + ++allow_keys; // no mapping for nchar, but allow key codes nchar = plain_vgetc(); LANGMAP_ADJUST(nchar, TRUE); --no_mapping; @@ -3084,12 +3084,12 @@ dozet: break; } undo = TRUE; - /* FALLTHROUGH */ + // FALLTHROUGH - case 'g': /* "zg": add good word to word list */ - case 'w': /* "zw": add wrong word to word list */ - case 'G': /* "zG": add good word to temp word list */ - case 'W': /* "zW": add wrong word to temp word list */ + case 'g': // "zg": add good word to word list + case 'w': // "zw": add wrong word to word list + case 'G': // "zG": add good word to temp word list + case 'W': // "zW": add wrong word to temp word list { char_u *ptr = NULL; int len; @@ -3103,9 +3103,9 @@ dozet: { pos_T pos = curwin->w_cursor; - /* Find bad word under the cursor. When 'spell' is - * off this fails and find_ident_under_cursor() is - * used below. */ + // Find bad word under the cursor. When 'spell' is + // off this fails and find_ident_under_cursor() is + // used below. emsg_off++; len = spell_move_to(curwin, FORWARD, TRUE, TRUE, NULL); emsg_off--; @@ -3125,7 +3125,7 @@ dozet: } break; - case '=': /* "z=": suggestions for a badly spelled word */ + case '=': // "z=": suggestions for a badly spelled word if (!checkclearop(cap->oap)) spell_suggest((int)cap->count0); break; @@ -3135,7 +3135,7 @@ dozet: } #ifdef FEAT_FOLDING - /* Redraw when 'foldenable' changed */ + // Redraw when 'foldenable' changed if (old_fen != curwin->w_p_fen) { # ifdef FEAT_DIFF @@ -3143,7 +3143,7 @@ dozet: if (foldmethodIsDiff(curwin) && curwin->w_p_scb) { - /* Adjust 'foldenable' in diff-synced windows. */ + // Adjust 'foldenable' in diff-synced windows. FOR_ALL_WINDOWS(wp) { if (wp != curwin && foldmethodIsDiff(wp) && wp->w_p_scb) @@ -3157,7 +3157,7 @@ dozet: changed_window_setting(); } - /* Redraw when 'foldlevel' changed. */ + // Redraw when 'foldlevel' changed. if (old_fdl != curwin->w_p_fdl) newFoldLevel(); #endif @@ -3173,7 +3173,7 @@ nv_ver_scrollbar(cmdarg_T *cap) if (cap->oap->op_type != OP_NOP) clearopbeep(cap->oap); - /* Even if an operator was pending, we still want to scroll */ + // Even if an operator was pending, we still want to scroll gui_do_scroll(); } @@ -3186,7 +3186,7 @@ nv_hor_scrollbar(cmdarg_T *cap) if (cap->oap->op_type != OP_NOP) clearopbeep(cap->oap); - /* Even if an operator was pending, we still want to scroll */ + // Even if an operator was pending, we still want to scroll gui_do_horiz_scroll(scrollbar_value, FALSE); } #endif @@ -3201,7 +3201,7 @@ nv_tabline(cmdarg_T *cap) if (cap->oap->op_type != OP_NOP) clearopbeep(cap->oap); - /* Even if an operator was pending, we still want to jump tabs. */ + // Even if an operator was pending, we still want to jump tabs. goto_tabpage(current_tab); } @@ -3214,7 +3214,7 @@ nv_tabmenu(cmdarg_T *cap) if (cap->oap->op_type != OP_NOP) clearopbeep(cap->oap); - /* Even if an operator was pending, we still want to jump tabs. */ + // Even if an operator was pending, we still want to jump tabs. handle_tabmenu(); } @@ -3293,13 +3293,13 @@ nv_colon(cmdarg_T *cap) { if (cap->oap->op_type != OP_NOP) { - /* Using ":" as a movement is characterwise exclusive. */ + // Using ":" as a movement is characterwise exclusive. cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; } else if (cap->count0) { - /* translate "count:" into ":.,.+(count - 1)" */ + // translate "count:" into ":.,.+(count - 1)" stuffcharReadbuff('.'); if (cap->count0 > 1) { @@ -3308,17 +3308,17 @@ nv_colon(cmdarg_T *cap) } } - /* When typing, don't type below an old message */ + // When typing, don't type below an old message if (KeyTyped) compute_cmdrow(); old_p_im = p_im; - /* get a command line and execute it */ + // get a command line and execute it cmd_result = do_cmdline(NULL, getexline, NULL, cap->oap->op_type != OP_NOP ? DOCMD_KEEPLINE : 0); - /* If 'insertmode' changed, enter or exit Insert mode */ + // If 'insertmode' changed, enter or exit Insert mode if (p_im != old_p_im) { if (p_im) @@ -3328,7 +3328,7 @@ nv_colon(cmdarg_T *cap) } if (cmd_result == FAIL) - /* The Ex command failed, do not execute the operator. */ + // The Ex command failed, do not execute the operator. clearop(cap->oap); else if (cap->oap->op_type != OP_NOP && (cap->oap->start.lnum > curbuf->b_ml.ml_line_count @@ -3336,8 +3336,7 @@ nv_colon(cmdarg_T *cap) (colnr_T)STRLEN(ml_get(cap->oap->start.lnum)) || did_emsg )) - /* The start of the operator has become invalid by the Ex command. - */ + // The start of the operator has become invalid by the Ex command. clearopbeep(cap->oap); } } @@ -3348,13 +3347,13 @@ nv_colon(cmdarg_T *cap) static void nv_ctrlg(cmdarg_T *cap) { - if (VIsual_active) /* toggle Selection/Visual mode */ + if (VIsual_active) // toggle Selection/Visual mode { VIsual_select = !VIsual_select; showmode(); } else if (!checkclearop(cap->oap)) - /* print full name if count given or :cd used */ + // print full name if count given or :cd used fileinfo((int)cap->count0, FALSE, TRUE); } @@ -3366,7 +3365,7 @@ nv_ctrlh(cmdarg_T *cap) { if (VIsual_active && VIsual_select) { - cap->cmdchar = 'x'; /* BS key behaves like 'x' in Select mode */ + cap->cmdchar = 'x'; // BS key behaves like 'x' in Select mode v_visop(cap); } else @@ -3390,7 +3389,7 @@ nv_clear(cmdarg_T *cap) ui_get_shellsize(); #endif #ifdef FEAT_SYN_HL - /* Clear all syntax states to force resyncing. */ + // Clear all syntax states to force resyncing. syn_stack_free_all(curwin->w_s); # ifdef FEAT_RELTIME { @@ -3422,7 +3421,7 @@ nv_ctrlo(cmdarg_T *cap) { VIsual_select = FALSE; showmode(); - restart_VIsual_select = 2; /* restart Select mode later */ + restart_VIsual_select = 2; // restart Select mode later } else { @@ -3453,11 +3452,11 @@ nv_Zet(cmdarg_T *cap) { switch (cap->nchar) { - /* "ZZ": equivalent to ":x". */ + // "ZZ": equivalent to ":x". case 'Z': do_cmdline_cmd((char_u *)"x"); break; - /* "ZQ": equivalent to ":q!" (Elvis compatible). */ + // "ZQ": equivalent to ":q!" (Elvis compatible). case 'Q': do_cmdline_cmd((char_u *)"q!"); break; @@ -3499,18 +3498,18 @@ nv_ident(cmdarg_T *cap) unsigned buflen; char_u *newbuf; char_u *p; - char_u *kp; /* value of 'keywordprg' */ - int kp_help; /* 'keywordprg' is ":he" */ - int kp_ex; /* 'keywordprg' starts with ":" */ - int n = 0; /* init for GCC */ + char_u *kp; // value of 'keywordprg' + int kp_help; // 'keywordprg' is ":he" + int kp_ex; // 'keywordprg' starts with ":" + int n = 0; // init for GCC int cmdchar; - int g_cmd; /* "g" command */ + int g_cmd; // "g" command int tag_cmd = FALSE; char_u *aux_ptr; int isman; int isman_s; - if (cap->cmdchar == 'g') /* "g*", "g#", "g]" and "gCTRL-]" */ + if (cap->cmdchar == 'g') // "g*", "g#", "g]" and "gCTRL-]" { cmdchar = cap->nchar; g_cmd = TRUE; @@ -3521,7 +3520,7 @@ nv_ident(cmdarg_T *cap) g_cmd = FALSE; } - if (cmdchar == POUND) /* the pound sign, '#' for English keyboards */ + if (cmdchar == POUND) // the pound sign, '#' for English keyboards cmdchar = '#'; /* @@ -3543,15 +3542,15 @@ nv_ident(cmdarg_T *cap) return; } - /* Allocate buffer to put the command in. Inserting backslashes can - * double the length of the word. p_kp / curbuf->b_p_kp could be added - * and some numbers. */ + // Allocate buffer to put the command in. Inserting backslashes can + // double the length of the word. p_kp / curbuf->b_p_kp could be added + // and some numbers. kp = (*curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp); kp_help = (*kp == NUL || STRCMP(kp, ":he") == 0 || STRCMP(kp, ":help") == 0); if (kp_help && *skipwhite(ptr) == NUL) { - emsg(_(e_noident)); /* found white space only */ + emsg(_(e_noident)); // found white space only return; } kp_ex = (*kp == ':'); @@ -3576,7 +3575,7 @@ nv_ident(cmdarg_T *cap) if (!g_cmd && vim_iswordp(ptr)) STRCPY(buf, "\\<"); - no_smartcase = TRUE; /* don't use 'smartcase' now */ + no_smartcase = TRUE; // don't use 'smartcase' now break; case 'K': @@ -3593,8 +3592,8 @@ nv_ident(cmdarg_T *cap) } else { - /* An external command will probably use an argument starting - * with "-" as an option. To avoid trouble we skip the "-". */ + // An external command will probably use an argument starting + // with "-" as an option. To avoid trouble we skip the "-". while (*ptr == '-' && n > 0) { ++ptr; @@ -3602,13 +3601,13 @@ nv_ident(cmdarg_T *cap) } if (n == 0) { - emsg(_(e_noident)); /* found dashes only */ + emsg(_(e_noident)); // found dashes only vim_free(buf); return; } - /* When a count is given, turn it into a range. Is this - * really what we want? */ + // When a count is given, turn it into a range. Is this + // really what we want? isman = (STRCMP(kp, "man") == 0); isman_s = (STRCMP(kp, "man -s") == 0); if (cap->count0 != 0 && !(isman || isman_s)) @@ -3658,10 +3657,10 @@ nv_ident(cmdarg_T *cap) { ptr = vim_strnsave(ptr, n); if (kp_ex) - /* Escape the argument properly for an Ex command */ + // Escape the argument properly for an Ex command p = vim_strsave_fnameescape(ptr, FALSE); else - /* Escape the argument properly for a shell command */ + // Escape the argument properly for a shell command p = vim_strsave_shellescape(ptr, TRUE, TRUE); vim_free(ptr); if (p == NULL) @@ -3689,7 +3688,7 @@ nv_ident(cmdarg_T *cap) else if (tag_cmd) { if (curbuf->b_help) - /* ":help" handles unescaped argument */ + // ":help" handles unescaped argument aux_ptr = (char_u *)""; else aux_ptr = (char_u *)"\\|\"\n["; @@ -3700,11 +3699,11 @@ nv_ident(cmdarg_T *cap) p = buf + STRLEN(buf); while (n-- > 0) { - /* put a backslash before \ and some others */ + // put a backslash before \ and some others if (vim_strchr(aux_ptr, *ptr) != NULL) *p++ = '\\'; - /* When current byte is a part of multibyte character, copy all - * bytes of that character. */ + // When current byte is a part of multibyte character, copy all + // bytes of that character. if (has_mbyte) { int i; @@ -3751,8 +3750,8 @@ nv_ident(cmdarg_T *cap) int get_visual_text( cmdarg_T *cap, - char_u **pp, /* return: start of selected text */ - int *lenp) /* return: length of selected text */ + char_u **pp, // return: start of selected text + int *lenp) // return: length of selected text { if (VIsual_mode != 'V') unadjust_for_sel(); @@ -3780,7 +3779,7 @@ get_visual_text( *lenp = curwin->w_cursor.col - VIsual.col + 1; } if (has_mbyte) - /* Correct the length to include the whole last character. */ + // Correct the length to include the whole last character. *lenp += (*mb_ptr2len)(*pp + (*lenp - 1)) - 1; } reset_VIsual_and_resel(); @@ -3815,7 +3814,7 @@ nv_scroll(cmdarg_T *cap) if (cap->cmdchar == 'L') { - validate_botline(); /* make sure curwin->w_botline is valid */ + validate_botline(); // make sure curwin->w_botline is valid curwin->w_cursor.lnum = curwin->w_botline - 1; if (cap->count1 - 1 >= curwin->w_cursor.lnum) curwin->w_cursor.lnum = 1; @@ -3824,7 +3823,7 @@ nv_scroll(cmdarg_T *cap) #ifdef FEAT_FOLDING if (hasAnyFolding(curwin)) { - /* Count a fold for one screen line. */ + // Count a fold for one screen line. for (n = cap->count1 - 1; n > 0 && curwin->w_cursor.lnum > curwin->w_topline; --n) { @@ -3843,17 +3842,17 @@ nv_scroll(cmdarg_T *cap) if (cap->cmdchar == 'M') { #ifdef FEAT_DIFF - /* Don't count filler lines above the window. */ + // Don't count filler lines above the window. used -= diff_check_fill(curwin, curwin->w_topline) - curwin->w_topfill; #endif - validate_botline(); /* make sure w_empty_rows is valid */ + validate_botline(); // make sure w_empty_rows is valid half = (curwin->w_height - curwin->w_empty_rows + 1) / 2; for (n = 0; curwin->w_topline + n < curbuf->b_ml.ml_line_count; ++n) { #ifdef FEAT_DIFF - /* Count half he number of filler lines to be "below this - * line" and half to be "above the next line". */ + // Count half he number of filler lines to be "below this + // line" and half to be "above the next line". if (n > 0 && used + diff_check_fill(curwin, curwin->w_topline + n) / 2 >= half) { @@ -3872,13 +3871,13 @@ nv_scroll(cmdarg_T *cap) if (n > 0 && used > curwin->w_height) --n; } - else /* (cap->cmdchar == 'H') */ + else // (cap->cmdchar == 'H') { n = cap->count1 - 1; #ifdef FEAT_FOLDING if (hasAnyFolding(curwin)) { - /* Count a fold for one screen line. */ + // Count a fold for one screen line. lnum = curwin->w_topline; while (n-- > 0 && lnum < curwin->w_botline - 1) { @@ -3894,7 +3893,7 @@ nv_scroll(cmdarg_T *cap) curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; } - /* Correct for 'so', except when an operator is pending. */ + // Correct for 'so', except when an operator is pending. if (cap->oap->op_type == OP_NOP) cursor_correct(); beginline(BL_SOL | BL_FIX); @@ -3911,7 +3910,7 @@ nv_right(cmdarg_T *cap) if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) { - /* <C-Right> and <S-Right> move a word or WORD right */ + // <C-Right> and <S-Right> move a word or WORD right if (mod_mask & MOD_MASK_CTRL) cap->arg = TRUE; nv_wordcmd(cap); @@ -3948,9 +3947,9 @@ nv_right(cmdarg_T *cap) && vim_strchr(p_ww, '>') != NULL)) && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { - /* When deleting we also count the NL as a character. - * Set cap->oap->inclusive when last char in the line is - * included, move to next line after that */ + // When deleting we also count the NL as a character. + // Set cap->oap->inclusive when last char in the line is + // included, move to next line after that if ( cap->oap->op_type != OP_NOP && !cap->oap->inclusive && !LINEEMPTY(curwin->w_cursor.lnum)) @@ -3967,7 +3966,7 @@ nv_right(cmdarg_T *cap) } if (cap->oap->op_type == OP_NOP) { - /* Only beep and flush if not moved at all */ + // Only beep and flush if not moved at all if (n == cap->count1) beep_flush(); } @@ -4011,7 +4010,7 @@ nv_left(cmdarg_T *cap) if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) { - /* <C-Left> and <S-Left> move a word or WORD left */ + // <C-Left> and <S-Left> move a word or WORD left if (mod_mask & MOD_MASK_CTRL) cap->arg = 1; nv_bck_word(cap); @@ -4024,10 +4023,9 @@ nv_left(cmdarg_T *cap) { if (oneleft() == FAIL) { - /* <BS> and <Del> wrap to previous line if 'whichwrap' has 'b'. - * 'h' wraps to previous line if 'whichwrap' has 'h'. - * CURS_LEFT wraps to previous line if 'whichwrap' has '<'. - */ + // <BS> and <Del> wrap to previous line if 'whichwrap' has 'b'. + // 'h' wraps to previous line if 'whichwrap' has 'h'. + // CURS_LEFT wraps to previous line if 'whichwrap' has '<'. if ( (((cap->cmdchar == K_BS || cap->cmdchar == Ctrl_H) && vim_strchr(p_ww, 'b') != NULL) @@ -4041,10 +4039,10 @@ nv_left(cmdarg_T *cap) coladvance((colnr_T)MAXCOL); curwin->w_set_curswant = TRUE; - /* When the NL before the first char has to be deleted we - * put the cursor on the NUL after the previous line. - * This is a very special case, be careful! - * Don't adjust op_end now, otherwise it won't work. */ + // When the NL before the first char has to be deleted we + // put the cursor on the NUL after the previous line. + // This is a very special case, be careful! + // Don't adjust op_end now, otherwise it won't work. if ( (cap->oap->op_type == OP_DELETE || cap->oap->op_type == OP_CHANGE) && !LINEEMPTY(curwin->w_cursor.lnum)) @@ -4062,7 +4060,7 @@ nv_left(cmdarg_T *cap) } continue; } - /* Only beep and flush if not moved at all */ + // Only beep and flush if not moved at all else if (cap->oap->op_type == OP_NOP && n == cap->count1) beep_flush(); break; @@ -4084,7 +4082,7 @@ nv_up(cmdarg_T *cap) { if (mod_mask & MOD_MASK_SHIFT) { - /* <S-Up> is page up */ + // <S-Up> is page up cap->arg = BACKWARD; nv_page(cap); } @@ -4107,25 +4105,25 @@ nv_down(cmdarg_T *cap) { if (mod_mask & MOD_MASK_SHIFT) { - /* <S-Down> is page down */ + // <S-Down> is page down cap->arg = FORWARD; nv_page(cap); } #if defined(FEAT_QUICKFIX) - /* Quickfix window only: view the result under the cursor. */ + // Quickfix window only: view the result under the cursor. else if (bt_quickfix(curbuf) && cap->cmdchar == CAR) qf_view_result(FALSE); #endif else { #ifdef FEAT_CMDWIN - /* In the cmdline window a <CR> executes the command. */ + // In the cmdline window a <CR> executes the command. if (cmdwin_type != 0 && cap->cmdchar == CAR) cmdwin_result = CAR; else #endif #ifdef FEAT_JOB_CHANNEL - /* In a prompt buffer a <CR> in the last line invokes the callback. */ + // In a prompt buffer a <CR> in the last line invokes the callback. if (bt_prompt(curbuf) && cap->cmdchar == CAR && curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count) { @@ -4171,7 +4169,7 @@ nv_gotofile(cmdarg_T *cap) if (ptr != NULL) { - /* do autowrite if necessary */ + // do autowrite if necessary if (curbufIsChanged() && curbuf->b_nwindows <= 1 && !buf_hide(curbuf)) (void)autowrite(curbuf, FALSE); setpcmark(); @@ -4196,11 +4194,11 @@ nv_gotofile(cmdarg_T *cap) static void nv_end(cmdarg_T *cap) { - if (cap->arg || (mod_mask & MOD_MASK_CTRL)) /* CTRL-END = goto last line */ + if (cap->arg || (mod_mask & MOD_MASK_CTRL)) // CTRL-END = goto last line { cap->arg = TRUE; nv_goto(cap); - cap->count1 = 1; /* to end of current line */ + cap->count1 = 1; // to end of current line } nv_dollar(cap); } @@ -4213,12 +4211,12 @@ nv_dollar(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->inclusive = TRUE; - /* In virtual mode when off the edge of a line and an operator - * is pending (whew!) keep the cursor where it is. - * Otherwise, send it to the end of the line. */ + // In virtual mode when off the edge of a line and an operator + // is pending (whew!) keep the cursor where it is. + // Otherwise, send it to the end of the line. if (!virtual_active() || gchar_cursor() != NUL || cap->oap->op_type == OP_NOP) - curwin->w_curswant = MAXCOL; /* so we stay at the end */ + curwin->w_curswant = MAXCOL; // so we stay at the end if (cursor_down((long)(cap->count1 - 1), cap->oap->op_type == OP_NOP) == FAIL) clearopbeep(cap->oap); @@ -4240,15 +4238,15 @@ nv_search(cmdarg_T *cap) if (cap->cmdchar == '?' && cap->oap->op_type == OP_ROT13) { - /* Translate "g??" to "g?g?" */ + // Translate "g??" to "g?g?" cap->cmdchar = 'g'; cap->nchar = '?'; nv_operator(cap); return; } - /* When using 'incsearch' the cursor may be moved to set a different search - * start position. */ + // When using 'incsearch' the cursor may be moved to set a different search + // start position. cap->searchbuf = getcmdline(cap->cmdchar, cap->count1, 0, TRUE); if (cap->searchbuf == NULL) @@ -4275,9 +4273,9 @@ nv_next(cmdarg_T *cap) if (i == 1 && !wrapped && EQUAL_POS(old, curwin->w_cursor)) { - /* Avoid getting stuck on the current cursor position, which can - * happen when an offset is given and the cursor is on the last char - * in the buffer: Repeat with count + 1. */ + // Avoid getting stuck on the current cursor position, which can + // happen when an offset is given and the cursor is on the last char + // in the buffer: Repeat with count + 1. cap->count1 += 1; (void)normal_search(cap, 0, NULL, SEARCH_MARK | cap->arg, NULL); cap->count1 -= 1; @@ -4323,8 +4321,8 @@ normal_search( #endif } - /* "/$" will put the cursor after the end of the line, may need to - * correct that here */ + // "/$" will put the cursor after the end of the line, may need to + // correct that here check_cursor(); return i; } @@ -4351,7 +4349,7 @@ nv_csearch(cmdarg_T *cap) else { curwin->w_set_curswant = TRUE; - /* Include a Tab for "tx" and for "dfx". */ + // Include a Tab for "tx" and for "dfx". if (gchar_cursor() == TAB && virtual_active() && cap->arg == FORWARD && (t_cmd || cap->oap->op_type != OP_NOP)) { @@ -4379,8 +4377,8 @@ nv_brackets(cmdarg_T *cap) { pos_T new_pos = {0, 0, 0}; pos_T prev_pos; - pos_T *pos = NULL; /* init for GCC */ - pos_T old_pos; /* cursor position before command */ + pos_T *pos = NULL; // init for GCC + pos_T old_pos; // cursor position before command int flag; long n; int findc; @@ -4472,13 +4470,13 @@ nv_brackets(cmdarg_T *cap) if ((pos = findmatchlimit(cap->oap, findc, (cap->cmdchar == '[') ? FM_BACKWARD : FM_FORWARD, 0)) == NULL) { - if (new_pos.lnum == 0) /* nothing found */ + if (new_pos.lnum == 0) // nothing found { if (cap->nchar != 'm' && cap->nchar != 'M') clearopbeep(cap->oap); } else - pos = &new_pos; /* use last one found */ + pos = &new_pos; // use last one found break; } prev_pos = new_pos; @@ -4495,11 +4493,11 @@ nv_brackets(cmdarg_T *cap) */ if (cap->nchar == 'm' || cap->nchar == 'M') { - /* norm is TRUE for "]M" and "[m" */ + // norm is TRUE for "]M" and "[m" int norm = ((findc == '{') == (cap->nchar == 'm')); n = cap->count1; - /* found a match: we were inside a method */ + // found a match: we were inside a method if (prev_pos.lnum != 0) { pos = &prev_pos; @@ -4515,7 +4513,7 @@ nv_brackets(cmdarg_T *cap) { if ((findc == '{' ? dec_cursor() : inc_cursor()) < 0) { - /* if not found anything, that's an error */ + // if not found anything, that's an error if (pos == NULL) clearopbeep(cap->oap); n = 0; @@ -4524,22 +4522,22 @@ nv_brackets(cmdarg_T *cap) c = gchar_cursor(); if (c == '{' || c == '}') { - /* Must have found end/start of class: use it. - * Or found the place to be at. */ + // Must have found end/start of class: use it. + // Or found the place to be at. if ((c == findc && norm) || (n == 1 && !norm)) { new_pos = curwin->w_cursor; pos = &new_pos; n = 0; } - /* if no match found at all, we started outside of the - * class and we're inside now. Just go on. */ + // if no match found at all, we started outside of the + // class and we're inside now. Just go on. else if (new_pos.lnum == 0) { new_pos = curwin->w_cursor; pos = &new_pos; } - /* found start/end of other method: go to match */ + // found start/end of other method: go to match else if ((pos = findmatchlimit(cap->oap, findc, (cap->cmdchar == '[') ? FM_BACKWARD : FM_FORWARD, 0)) == NULL) @@ -4573,10 +4571,10 @@ nv_brackets(cmdarg_T *cap) */ else if (cap->nchar == '[' || cap->nchar == ']') { - if (cap->nchar == cap->cmdchar) /* "]]" or "[[" */ + if (cap->nchar == cap->cmdchar) // "]]" or "[[" flag = '{'; else - flag = '}'; /* "][" or "[]" */ + flag = '}'; // "][" or "[]" curwin->w_set_curswant = TRUE; /* @@ -4683,7 +4681,7 @@ nv_brackets(cmdarg_T *cap) } #endif - /* Not a valid cap->nchar. */ + // Not a valid cap->nchar. else clearopbeep(cap->oap); } @@ -4700,7 +4698,7 @@ nv_percent(cmdarg_T *cap) #endif cap->oap->inclusive = TRUE; - if (cap->count0) /* {cnt}% : goto {cnt} percentage in file */ + if (cap->count0) // {cnt}% : goto {cnt} percentage in file { if (cap->count0 > 100) clearopbeep(cap->oap); @@ -4708,8 +4706,8 @@ nv_percent(cmdarg_T *cap) { cap->oap->motion_type = MLINE; setpcmark(); - /* Round up, so CTRL-G will give same value. Watch out for a - * large line count, the line number must not go negative! */ + // Round up, so CTRL-G will give same value. Watch out for a + // large line count, the line number must not go negative! if (curbuf->b_ml.ml_line_count > 1000000) curwin->w_cursor.lnum = (curbuf->b_ml.ml_line_count + 99L) / 100L * cap->count0; @@ -4721,7 +4719,7 @@ nv_percent(cmdarg_T *cap) beginline(BL_SOL | BL_FIX); } } - else /* "%" : go to matching paren */ + else // "%" : go to matching paren { cap->oap->motion_type = MCHAR; cap->oap->use_reg_one = TRUE; @@ -4754,7 +4752,7 @@ nv_brace(cmdarg_T *cap) { cap->oap->motion_type = MCHAR; cap->oap->use_reg_one = TRUE; - /* The motion used to be inclusive for "(", but that is not what Vi does. */ + // The motion used to be inclusive for "(", but that is not what Vi does. cap->oap->inclusive = FALSE; curwin->w_set_curswant = TRUE; @@ -4762,7 +4760,7 @@ nv_brace(cmdarg_T *cap) clearopbeep(cap->oap); else { - /* Don't leave the cursor on the NUL past end of line. */ + // Don't leave the cursor on the NUL past end of line. adjust_cursor(cap->oap); curwin->w_cursor.coladd = 0; #ifdef FEAT_FOLDING @@ -4816,7 +4814,7 @@ nv_undo(cmdarg_T *cap) { if (cap->oap->op_type == OP_LOWER || VIsual_active) { - /* translate "<Visual>u" to "<Visual>gu" and "guu" to "gugu" */ + // translate "<Visual>u" to "<Visual>gu" and "guu" to "gugu" cap->cmdchar = 'g'; cap->nchar = 'u'; nv_operator(cap); @@ -4865,34 +4863,34 @@ nv_replace(cmdarg_T *cap) } #endif - /* get another character */ + // get another character if (cap->nchar == Ctrl_V) { had_ctrl_v = Ctrl_V; cap->nchar = get_literal(); - /* Don't redo a multibyte character with CTRL-V. */ + // Don't redo a multibyte character with CTRL-V. if (cap->nchar > DEL) had_ctrl_v = NUL; } else had_ctrl_v = NUL; - /* Abort if the character is a special key. */ + // Abort if the character is a special key. if (IS_SPECIAL(cap->nchar)) { clearopbeep(cap->oap); return; } - /* Visual mode "r" */ + // Visual mode "r" if (VIsual_active) { if (got_int) reset_VIsual(); if (had_ctrl_v) { - /* Use a special (negative) number to make a difference between a - * literal CR or NL and a line break. */ + // Use a special (negative) number to make a difference between a + // literal CR or NL and a line break. if (cap->nchar == CAR) cap->nchar = REPLACE_CR_NCHAR; else if (cap->nchar == NL) @@ -4902,14 +4900,14 @@ nv_replace(cmdarg_T *cap) return; } - /* Break tabs, etc. */ + // Break tabs, etc. if (virtual_active()) { if (u_save_cursor() == FAIL) return; if (gchar_cursor() == NUL) { - /* Add extra space and put the cursor on the first one. */ + // Add extra space and put the cursor on the first one. coladvance_force((colnr_T)(getviscol() + cap->count1)); curwin->w_cursor.col -= cap->count1; } @@ -4917,7 +4915,7 @@ nv_replace(cmdarg_T *cap) coladvance_force(getviscol()); } - /* Abort if not enough characters to replace. */ + // Abort if not enough characters to replace. ptr = ml_get_cursor(); if (STRLEN(ptr) < (unsigned)cap->count1 || (has_mbyte && mb_charlen(ptr) < cap->count1)) @@ -4941,7 +4939,7 @@ nv_replace(cmdarg_T *cap) return; } - /* save line for undo */ + // save line for undo if (u_save_cursor() == FAIL) return; @@ -4955,11 +4953,11 @@ nv_replace(cmdarg_T *cap) * autoindent. The insert command depends on being on the last * character of a line or not. */ - (void)del_chars(cap->count1, FALSE); /* delete the characters */ + (void)del_chars(cap->count1, FALSE); // delete the characters stuffcharReadbuff('\r'); stuffcharReadbuff(ESC); - /* Give 'r' to edit(), to get the redo command right. */ + // Give 'r' to edit(), to get the redo command right. invoke_edit(cap, TRUE, 'r', FALSE); } else @@ -4977,9 +4975,9 @@ nv_replace(cmdarg_T *cap) if (cap->ncharC2 != 0) AppendCharToRedobuff(cap->ncharC2); - /* This is slow, but it handles replacing a single-byte with a - * multi-byte and the other way around. Also handles adding - * composing characters for utf-8. */ + // This is slow, but it handles replacing a single-byte with a + // multi-byte and the other way around. Also handles adding + // composing characters for utf-8. for (n = cap->count1; n > 0; --n) { State = REPLACE; @@ -4990,7 +4988,7 @@ nv_replace(cmdarg_T *cap) if (c != NUL) ins_char(c); else - /* will be decremented further down */ + // will be decremented further down ++curwin->w_cursor.col; } else @@ -5040,13 +5038,13 @@ nv_replace(cmdarg_T *cap) } #endif - /* mark the buffer as changed and prepare for displaying */ + // mark the buffer as changed and prepare for displaying changed_bytes(curwin->w_cursor.lnum, (colnr_T)(curwin->w_cursor.col - cap->count1)); } - --curwin->w_cursor.col; /* cursor on the last replaced char */ - /* if the character on the left of the current cursor is a multi-byte - * character, move two characters left */ + --curwin->w_cursor.col; // cursor on the last replaced char + // if the character on the left of the current cursor is a multi-byte + // character, move two characters left if (has_mbyte) mb_adjust_cursor(); curbuf->b_op_end = curwin->w_cursor; @@ -5075,8 +5073,8 @@ v_swap_corners(int cmdchar) curwin->w_cursor.lnum = old_cursor.lnum; curwin->w_curswant = right; - /* 'selection "exclusive" and cursor at right-bottom corner: move it - * right one column */ + // 'selection "exclusive" and cursor at right-bottom corner: move it + // right one column if (old_cursor.lnum >= VIsual.lnum && *p_sel == 'e') ++curwin->w_curswant; coladvance(curwin->w_curswant); @@ -5110,11 +5108,11 @@ v_swap_corners(int cmdchar) static void nv_Replace(cmdarg_T *cap) { - if (VIsual_active) /* "R" is replace lines */ + if (VIsual_active) // "R" is replace lines { cap->cmdchar = 'c'; cap->nchar = NUL; - VIsual_mode_orig = VIsual_mode; /* remember original area for gv */ + VIsual_mode_orig = VIsual_mode; // remember original area for gv VIsual_mode = 'V'; nv_operator(cap); } @@ -5141,7 +5139,7 @@ nv_vreplace(cmdarg_T *cap) { cap->cmdchar = 'r'; cap->nchar = cap->extra_char; - nv_replace(cap); /* Do same as "r" in Visual mode for now */ + nv_replace(cap); // Do same as "r" in Visual mode for now } else if (!checkclearopq(cap->oap)) { @@ -5149,7 +5147,7 @@ nv_vreplace(cmdarg_T *cap) emsg(_(e_modifiable)); else { - if (cap->extra_char == Ctrl_V) /* get another character */ + if (cap->extra_char == Ctrl_V) // get another character cap->extra_char = get_literal(); stuffcharReadbuff(cap->extra_char); stuffcharReadbuff(ESC); @@ -5279,7 +5277,7 @@ nv_cursormark(cmdarg_T *cap, int flag, pos_T *pos) cap->oap->motion_type = flag ? MLINE : MCHAR; if (cap->cmdchar == '`') cap->oap->use_reg_one = TRUE; - cap->oap->inclusive = FALSE; /* ignored if not MCHAR */ + cap->oap->inclusive = FALSE; // ignored if not MCHAR curwin->w_set_curswant = TRUE; } @@ -5291,8 +5289,8 @@ v_visop(cmdarg_T *cap) { static char_u trans[] = "YyDdCcxdXdAAIIrr"; - /* Uppercase means linewise, except in block mode, then "D" deletes till - * the end of the line, and "C" replaces till EOL */ + // Uppercase means linewise, except in block mode, then "D" deletes till + // the end of the line, and "C" replaces till EOL if (isupper(cap->cmdchar)) { if (VIsual_mode != Ctrl_V) @@ -5314,7 +5312,7 @@ v_visop(cmdarg_T *cap) nv_subst(cmdarg_T *cap) { #ifdef FEAT_TERMINAL - /* When showing output of term_dumpdiff() swap the top and botom. */ + // When showing output of term_dumpdiff() swap the top and botom. if (term_swap_diff() == OK) return; #endif @@ -5325,7 +5323,7 @@ nv_subst(cmdarg_T *cap) return; } #endif - if (VIsual_active) /* "vs" and "vS" are the same as "vc" */ + if (VIsual_active) // "vs" and "vS" are the same as "vc" { if (cap->cmdchar == 'S') { @@ -5346,9 +5344,9 @@ nv_subst(cmdarg_T *cap) nv_abbrev(cmdarg_T *cap) { if (cap->cmdchar == K_DEL || cap->cmdchar == K_KDEL) - cap->cmdchar = 'x'; /* DEL key behaves like 'x' */ + cap->cmdchar = 'x'; // DEL key behaves like 'x' - /* in Visual mode these commands are operators */ + // in Visual mode these commands are operators if (VIsual_active) v_visop(cap); else @@ -5405,7 +5403,7 @@ nv_gomark(cmdarg_T *cap) int c; #ifdef FEAT_FOLDING pos_T old_cursor = curwin->w_cursor; - int old_KeyTyped = KeyTyped; /* getting file may reset it */ + int old_KeyTyped = KeyTyped; // getting file may reset it #endif if (cap->cmdchar == 'g') @@ -5413,7 +5411,7 @@ nv_gomark(cmdarg_T *cap) else c = cap->nchar; pos = getmark(c, (cap->oap->op_type == OP_NOP)); - if (pos == (pos_T *)-1) /* jumped to other file */ + if (pos == (pos_T *)-1) // jumped to other file { if (cap->arg) { @@ -5426,7 +5424,7 @@ nv_gomark(cmdarg_T *cap) else nv_cursormark(cap, cap->arg, pos); - /* May need to clear the coladd that a mark includes. */ + // May need to clear the coladd that a mark includes. if (!virtual_active()) curwin->w_cursor.coladd = 0; check_cursor_col(); @@ -5450,7 +5448,7 @@ nv_pcmark(cmdarg_T *cap) pos_T *pos; # ifdef FEAT_FOLDING linenr_T lnum = curwin->w_cursor.lnum; - int old_KeyTyped = KeyTyped; /* getting file may reset it */ + int old_KeyTyped = KeyTyped; // getting file may reset it # endif if (!checkclearopq(cap->oap)) @@ -5459,12 +5457,12 @@ nv_pcmark(cmdarg_T *cap) pos = movechangelist((int)cap->count1); else pos = movemark((int)cap->count1); - if (pos == (pos_T *)-1) /* jump to other file */ + if (pos == (pos_T *)-1) // jump to other file { curwin->w_set_curswant = TRUE; check_cursor(); } - else if (pos != NULL) /* can jump */ + else if (pos != NULL) // can jump nv_cursormark(cap, FALSE, pos); else if (cap->cmdchar == 'g') { @@ -5505,7 +5503,7 @@ nv_regname(cmdarg_T *cap) if (cap->nchar != NUL && valid_yank_reg(cap->nchar, FALSE)) { cap->oap->regname = cap->nchar; - cap->opcount = cap->count0; /* remember count before '"' */ + cap->opcount = cap->count0; // remember count before '"' #ifdef FEAT_EVAL set_reg_var(cap->oap->regname); #endif @@ -5526,43 +5524,43 @@ nv_visual(cmdarg_T *cap) if (cap->cmdchar == Ctrl_Q) cap->cmdchar = Ctrl_V; - /* 'v', 'V' and CTRL-V can be used while an operator is pending to make it - * characterwise, linewise, or blockwise. */ + // 'v', 'V' and CTRL-V can be used while an operator is pending to make it + // characterwise, linewise, or blockwise. if (cap->oap->op_type != OP_NOP) { motion_force = cap->oap->motion_force = cap->cmdchar; - finish_op = FALSE; /* operator doesn't finish now but later */ + finish_op = FALSE; // operator doesn't finish now but later return; } VIsual_select = cap->arg; - if (VIsual_active) /* change Visual mode */ + if (VIsual_active) // change Visual mode { - if (VIsual_mode == cap->cmdchar) /* stop visual mode */ + if (VIsual_mode == cap->cmdchar) // stop visual mode end_visual_mode(); - else /* toggle char/block mode */ - { /* or char/line mode */ + else // toggle char/block mode + { // or char/line mode VIsual_mode = cap->cmdchar; showmode(); } - redraw_curbuf_later(INVERTED); /* update the inversion */ + redraw_curbuf_later(INVERTED); // update the inversion } - else /* start Visual mode */ + else // start Visual mode { check_visual_highlight(); if (cap->count0 > 0 && resel_VIsual_mode != NUL) { - /* use previously selected part */ + // use previously selected part VIsual = curwin->w_cursor; VIsual_active = TRUE; VIsual_reselect = TRUE; if (!cap->arg) - /* start Select mode when 'selectmode' contains "cmd" */ + // start Select mode when 'selectmode' contains "cmd" may_start_select('c'); setmouse(); if (p_smd && msg_silent == 0) - redraw_cmdline = TRUE; /* show visual mode later */ + redraw_cmdline = TRUE; // show visual mode later /* * For V and ^V, we multiply the number of lines even if there * was only one -- webb @@ -5601,19 +5599,19 @@ nv_visual(cmdarg_T *cap) } else curwin->w_set_curswant = TRUE; - redraw_curbuf_later(INVERTED); /* show the inversion */ + redraw_curbuf_later(INVERTED); // show the inversion } else { if (!cap->arg) - /* start Select mode when 'selectmode' contains "cmd" */ + // start Select mode when 'selectmode' contains "cmd" may_start_select('c'); n_start_visual_mode(cap->cmdchar); if (VIsual_mode != 'V' && *p_sel == 'e') - ++cap->count1; /* include one more char */ + ++cap->count1; // include one more char if (cap->count0 > 0 && --cap->count1 > 0) { - /* With a count select that many characters or lines. */ + // With a count select that many characters or lines. if (VIsual_mode == 'v' || VIsual_mode == Ctrl_V) nv_right(cap); else if (VIsual_mode == 'V') @@ -5629,7 +5627,7 @@ nv_visual(cmdarg_T *cap) void start_selection(void) { - /* if 'selectmode' contains "key", start Select mode */ + // if 'selectmode' contains "key", start Select mode may_start_select('k'); n_start_visual_mode('v'); } @@ -5652,7 +5650,7 @@ may_start_select(int c) n_start_visual_mode(int c) { #ifdef FEAT_CONCEAL - /* Check for redraw before changing the state. */ + // Check for redraw before changing the state. conceal_check_cursor_line(); #endif @@ -5675,20 +5673,20 @@ n_start_visual_mode(int c) setmouse(); #ifdef FEAT_CONCEAL - /* Check for redraw after changing the state. */ + // Check for redraw after changing the state. conceal_check_cursor_line(); #endif if (p_smd && msg_silent == 0) - redraw_cmdline = TRUE; /* show visual mode later */ + redraw_cmdline = TRUE; // show visual mode later #ifdef FEAT_CLIPBOARD - /* Make sure the clipboard gets updated. Needed because start and - * end may still be the same, and the selection needs to be owned */ + // Make sure the clipboard gets updated. Needed because start and + // end may still be the same, and the selection needs to be owned clip_star.vmode = NUL; #endif - /* Only need to redraw this line, unless still need to redraw an old - * Visual area (when 'lazyredraw' is set). */ + // Only need to redraw this line, unless still need to redraw an old + // Visual area (when 'lazyredraw' is set). if (curwin->w_redr_type < INVERTED) { curwin->w_old_cursor_lnum = curwin->w_cursor.lnum; @@ -5705,13 +5703,13 @@ nv_window(cmdarg_T *cap) { if (cap->nchar == ':') { - /* "CTRL-W :" is the same as typing ":"; useful in a terminal window */ + // "CTRL-W :" is the same as typing ":"; useful in a terminal window cap->cmdchar = ':'; cap->nchar = NUL; nv_colon(cap); } else if (!checkclearop(cap->oap)) - do_window(cap->nchar, cap->count0, NUL); /* everything is in window.c */ + do_window(cap->nchar, cap->count0, NUL); // everything is in window.c } /* @@ -5722,7 +5720,7 @@ nv_suspend(cmdarg_T *cap) { clearop(cap->oap); if (VIsual_active) - end_visual_mode(); /* stop Visual mode */ + end_visual_mode(); // stop Visual mode do_cmdline_cmd((char_u *)"st"); } @@ -5793,7 +5791,7 @@ nv_g_cmd(cmdarg_T *cap) beep_flush(); else { - /* set w_cursor to the start of the Visual area, tpos to the end */ + // set w_cursor to the start of the Visual area, tpos to the end if (VIsual_active) { i = VIsual_mode; @@ -5822,8 +5820,8 @@ nv_g_cmd(cmdarg_T *cap) VIsual_active = TRUE; VIsual_reselect = TRUE; - /* Set Visual to the start and w_cursor to the end of the Visual - * area. Make sure they are on an existing character. */ + // Set Visual to the start and w_cursor to the end of the Visual + // area. Make sure they are on an existing character. check_cursor(); VIsual = curwin->w_cursor; curwin->w_cursor = tpos; @@ -5840,8 +5838,8 @@ nv_g_cmd(cmdarg_T *cap) may_start_select('c'); setmouse(); #ifdef FEAT_CLIPBOARD - /* Make sure the clipboard gets updated. Needed because start and - * end are still the same, and the selection needs to be owned */ + // Make sure the clipboard gets updated. Needed because start and + // end are still the same, and the selection needs to be owned clip_star.vmode = NUL; #endif redraw_curbuf_later(INVERTED); @@ -5863,12 +5861,12 @@ nv_g_cmd(cmdarg_T *cap) */ case K_BS: cap->nchar = Ctrl_H; - /* FALLTHROUGH */ + // FALLTHROUGH case 'h': case 'H': case Ctrl_H: # ifdef EBCDIC - /* EBCDIC: 'v'-'h' != '^v'-'^h' */ + // EBCDIC: 'v'-'h' != '^v'-'^h' if (cap->nchar == Ctrl_H) cap->cmdchar = Ctrl_V; else @@ -5878,10 +5876,9 @@ nv_g_cmd(cmdarg_T *cap) nv_visual(cap); break; - /* "gn", "gN" visually select next/previous search match - * "gn" selects next match - * "gN" selects previous match - */ + // "gn", "gN" visually select next/previous search match + // "gn" selects next match + // "gN" selects previous match case 'N': case 'n': if (!current_search(cap->count1, cap->nchar == 'n')) @@ -5894,8 +5891,8 @@ nv_g_cmd(cmdarg_T *cap) */ case 'j': case K_DOWN: - /* with 'nowrap' it works just like the normal "j" command; also when - * in a closed fold */ + // with 'nowrap' it works just like the normal "j" command; also when + // in a closed fold if (!curwin->w_p_wrap #ifdef FEAT_FOLDING || hasFolding(curwin->w_cursor.lnum, NULL, NULL) @@ -5913,8 +5910,8 @@ nv_g_cmd(cmdarg_T *cap) case 'k': case K_UP: - /* with 'nowrap' it works just like the normal "k" command; also when - * in a closed fold */ + // with 'nowrap' it works just like the normal "k" command; also when + // in a closed fold if (!curwin->w_p_wrap #ifdef FEAT_FOLDING || hasFolding(curwin->w_cursor.lnum, NULL, NULL) @@ -5943,7 +5940,7 @@ nv_g_cmd(cmdarg_T *cap) */ case '^': flag = TRUE; - /* FALLTHROUGH */ + // FALLTHROUGH case '0': case 'm': @@ -5963,9 +5960,9 @@ nv_g_cmd(cmdarg_T *cap) } else i = curwin->w_leftcol; - /* Go to the middle of the screen line. When 'number' or - * 'relativenumber' is on and lines are wrapping the middle can be more - * to the left. */ + // Go to the middle of the screen line. When 'number' or + // 'relativenumber' is on and lines are wrapping the middle can be more + // to the left. if (cap->nchar == 'm') i += (curwin->w_width - curwin_col_off() + ((curwin->w_p_wrap && i > 0) @@ -6000,8 +5997,8 @@ nv_g_cmd(cmdarg_T *cap) break; case '_': - /* "g_": to the last non-blank character in the line or <count> lines - * downward. */ + // "g_": to the last non-blank character in the line or <count> lines + // downward. cap->oap->motion_type = MCHAR; cap->oap->inclusive = TRUE; curwin->w_curswant = MAXCOL; @@ -6012,11 +6009,11 @@ nv_g_cmd(cmdarg_T *cap) { char_u *ptr = ml_get_curline(); - /* In Visual mode we may end up after the line. */ + // In Visual mode we may end up after the line. if (curwin->w_cursor.col > 0 && ptr[curwin->w_cursor.col] == NUL) --curwin->w_cursor.col; - /* Decrease the cursor column until it's on a non-blank. */ + // Decrease the cursor column until it's on a non-blank. while (curwin->w_cursor.col > 0 && VIM_ISWHITE(ptr[curwin->w_cursor.col])) --curwin->w_cursor.col; @@ -6035,7 +6032,7 @@ nv_g_cmd(cmdarg_T *cap) oap->inclusive = TRUE; if (curwin->w_p_wrap && curwin->w_width != 0) { - curwin->w_curswant = MAXCOL; /* so we stay at the end */ + curwin->w_curswant = MAXCOL; // so we stay at the end if (cap->count1 == 1) { int width1 = curwin->w_width - col_off; @@ -6048,7 +6045,7 @@ nv_g_cmd(cmdarg_T *cap) * width2; coladvance((colnr_T)i); - /* Make sure we stick in this column. */ + // Make sure we stick in this column. validate_virtcol(); curwin->w_curswant = curwin->w_virtcol; curwin->w_set_curswant = FALSE; @@ -6089,10 +6086,10 @@ nv_g_cmd(cmdarg_T *cap) case '*': case '#': #if POUND != '#' - case POUND: /* pound sign (sometimes equal to '#') */ + case POUND: // pound sign (sometimes equal to '#') #endif - case Ctrl_RSB: /* :tag or :tselect for current identifier */ - case ']': /* :tselect for current identifier */ + case Ctrl_RSB: // :tag or :tselect for current identifier + case ']': // :tselect for current identifier nv_ident(cap); break; @@ -6155,10 +6152,10 @@ nv_g_cmd(cmdarg_T *cap) break; #endif - /* "g'm" and "g`m": jump to mark without setting pcmark */ + // "g'm" and "g`m": jump to mark without setting pcmark case '\'': cap->arg = TRUE; - /* FALLTHROUGH */ + // FALLTHROUGH case '`': nv_gomark(cap); break; @@ -6190,7 +6187,7 @@ nv_g_cmd(cmdarg_T *cap) show_utf8(); break; - /* "g<": show scrollback text */ + // "g<": show scrollback text case '<': show_sb_text(); break; @@ -6217,7 +6214,7 @@ nv_g_cmd(cmdarg_T *cap) case 'q': case 'w': oap->cursor_start = curwin->w_cursor; - /* FALLTHROUGH */ + // FALLTHROUGH case '~': case 'u': case 'U': @@ -6271,13 +6268,13 @@ nv_g_cmd(cmdarg_T *cap) break; #ifdef FEAT_BYTEOFF - /* "go": goto byte count from start of buffer */ + // "go": goto byte count from start of buffer case 'o': goto_byte(cap->count0); break; #endif - /* "gQ": improved Ex mode */ + // "gQ": improved Ex mode case 'Q': if (text_locked()) { @@ -6311,7 +6308,7 @@ nv_g_cmd(cmdarg_T *cap) break; case '+': - case '-': /* "g+" and "g-": undo or redo along the timeline */ + case '-': // "g+" and "g-": undo or redo along the timeline if (!checkclearopq(oap)) undo_time(cap->nchar == '-' ? -cap->count1 : cap->count1, FALSE, FALSE, FALSE); @@ -6337,11 +6334,11 @@ n_opencmd(cmdarg_T *cap) { #ifdef FEAT_FOLDING if (cap->cmdchar == 'O') - /* Open above the first line of a folded sequence of lines */ + // Open above the first line of a folded sequence of lines (void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL); else - /* Open below the last line of a folded sequence of lines */ + // Open below the last line of a folded sequence of lines (void)hasFolding(curwin->w_cursor.lnum, NULL, &curwin->w_cursor.lnum); #endif @@ -6360,10 +6357,10 @@ n_opencmd(cmdarg_T *cap) #endif #ifdef FEAT_SYN_HL if (curwin->w_p_cul) - /* force redraw of cursorline */ + // force redraw of cursorline curwin->w_valid &= ~VALID_CROW; #endif - /* When '#' is in 'cpoptions' ignore the count. */ + // When '#' is in 'cpoptions' ignore the count. if (vim_strchr(p_cpo, CPO_HASH) != NULL) cap->count1 = 1; invoke_edit(cap, FALSE, cap->cmdchar, TRUE); @@ -6408,10 +6405,10 @@ nv_redo(cmdarg_T *cap) static void nv_Undo(cmdarg_T *cap) { - /* In Visual mode and typing "gUU" triggers an operator */ + // In Visual mode and typing "gUU" triggers an operator if (cap->oap->op_type == OP_UPPER || VIsual_active) { - /* translate "gUU" to "gUgU" */ + // translate "gUU" to "gUgU" cap->cmdchar = 'g'; cap->nchar = 'U'; nv_operator(cap); @@ -6463,7 +6460,7 @@ nv_operator(cmdarg_T *cap) } #endif - if (op_type == cap->oap->op_type) /* double operator works on lines */ + if (op_type == cap->oap->op_type) // double operator works on lines nv_lineop(cap); else if (!checkclearop(cap->oap)) { @@ -6511,13 +6508,13 @@ nv_lineop(cmdarg_T *cap) cap->oap->motion_type = MLINE; if (cursor_down(cap->count1 - 1L, cap->oap->op_type == OP_NOP) == FAIL) clearopbeep(cap->oap); - else if ( (cap->oap->op_type == OP_DELETE /* only with linewise motions */ + else if ( (cap->oap->op_type == OP_DELETE // only with linewise motions && cap->oap->motion_force != 'v' && cap->oap->motion_force != Ctrl_V) || cap->oap->op_type == OP_LSHIFT || cap->oap->op_type == OP_RSHIFT) beginline(BL_SOL | BL_FIX); - else if (cap->oap->op_type != OP_YANK) /* 'Y' does not move cursor */ + else if (cap->oap->op_type != OP_YANK) // 'Y' does not move cursor beginline(BL_WHITE | BL_FIX); } @@ -6527,7 +6524,7 @@ nv_lineop(cmdarg_T *cap) static void nv_home(cmdarg_T *cap) { - /* CTRL-HOME is like "gg" */ + // CTRL-HOME is like "gg" if (mod_mask & MOD_MASK_CTRL) nv_goto(cap); else @@ -6535,8 +6532,8 @@ nv_home(cmdarg_T *cap) cap->count0 = 1; nv_pipe(cap); } - ins_at_eol = FALSE; /* Don't move cursor past eol (only necessary in a - one-character line). */ + ins_at_eol = FALSE; // Don't move cursor past eol (only necessary in a + // one-character line). } /* @@ -6555,8 +6552,8 @@ nv_pipe(cmdarg_T *cap) } else curwin->w_curswant = 0; - /* keep curswant at the column where we wanted to go, not where - * we ended; differs if line is too short */ + // keep curswant at the column where we wanted to go, not where + // we ended; differs if line is too short curwin->w_set_curswant = FALSE; } @@ -6605,7 +6602,7 @@ nv_wordcmd(cmdarg_T *cap) if (!word_end && cap->oap->op_type == OP_CHANGE) { n = gchar_cursor(); - if (n != NUL) /* not an empty line */ + if (n != NUL) // not an empty line { if (VIM_ISWHITE(n)) { @@ -6649,8 +6646,8 @@ nv_wordcmd(cmdarg_T *cap) else n = fwd_word(cap->count1, cap->arg, cap->oap->op_type != OP_NOP); - /* Don't leave the cursor on the NUL past the end of line. Unless we - * didn't move it forward. */ + // Don't leave the cursor on the NUL past the end of line. Unless we + // didn't move it forward. if (LT_POS(startpos, curwin->w_cursor)) adjust_cursor(cap->oap); @@ -6674,17 +6671,16 @@ nv_wordcmd(cmdarg_T *cap) static void adjust_cursor(oparg_T *oap) { - /* The cursor cannot remain on the NUL when: - * - the column is > 0 - * - not in Visual mode or 'selection' is "o" - * - 'virtualedit' is not "all" and not "onemore". - */ + // The cursor cannot remain on the NUL when: + // - the column is > 0 + // - not in Visual mode or 'selection' is "o" + // - 'virtualedit' is not "all" and not "onemore". if (curwin->w_cursor.col > 0 && gchar_cursor() == NUL && (!VIsual_active || *p_sel == 'o') && !virtual_active() && (ve_flags & VE_ONEMORE) == 0) { --curwin->w_cursor.col; - /* prevent cursor from moving on the trail byte */ + // prevent cursor from moving on the trail byte if (has_mbyte) mb_adjust_cursor(); oap->inclusive = TRUE; @@ -6705,8 +6701,8 @@ nv_beginline(cmdarg_T *cap) if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP) foldOpenCursor(); #endif - ins_at_eol = FALSE; /* Don't move cursor past eol (only necessary in a - one-character line). */ + ins_at_eol = FALSE; // Don't move cursor past eol (only necessary in a + // one-character line). } /* @@ -6770,7 +6766,7 @@ nv_select(cmdarg_T *cap) VIsual_select = TRUE; else if (VIsual_reselect) { - cap->nchar = 'v'; /* fake "gv" command */ + cap->nchar = 'v'; // fake "gv" command cap->arg = TRUE; nv_g_cmd(cap); } @@ -6793,7 +6789,7 @@ nv_goto(cmdarg_T *cap) cap->oap->motion_type = MLINE; setpcmark(); - /* When a count is given, use it instead of the default lnum */ + // When a count is given, use it instead of the default lnum if (cap->count0 != 0) lnum = cap->count0; if (lnum < 1L) @@ -6818,7 +6814,7 @@ nv_normal(cmdarg_T *cap) { clearop(cap->oap); if (restart_edit != 0 && mode_displayed) - clear_cmdline = TRUE; /* unshow mode later */ + clear_cmdline = TRUE; // unshow mode later restart_edit = 0; #ifdef FEAT_CMDWIN if (cmdwin_type != 0) @@ -6826,10 +6822,10 @@ nv_normal(cmdarg_T *cap) #endif if (VIsual_active) { - end_visual_mode(); /* stop Visual */ + end_visual_mode(); // stop Visual redraw_curbuf_later(INVERTED); } - /* CTRL-\ CTRL-G restarts Insert mode when 'insertmode' is set. */ + // CTRL-\ CTRL-G restarts Insert mode when 'insertmode' is set. if (cap->nchar == Ctrl_G && p_im) restart_edit = 'a'; } @@ -6852,7 +6848,7 @@ nv_esc(cmdarg_T *cap) && cap->oap->regname == 0 && !p_im); - if (cap->arg) /* TRUE for CTRL-C */ + if (cap->arg) // TRUE for CTRL-C { if (restart_edit == 0 #ifdef FEAT_CMDWIN @@ -6867,15 +6863,15 @@ nv_esc(cmdarg_T *cap) msg(_("Type :qa and press <Enter> to exit Vim")); } - /* Don't reset "restart_edit" when 'insertmode' is set, it won't be - * set again below when halfway a mapping. */ + // Don't reset "restart_edit" when 'insertmode' is set, it won't be + // set again below when halfway a mapping. if (!p_im) restart_edit = 0; #ifdef FEAT_CMDWIN if (cmdwin_type != 0) { cmdwin_result = K_IGNORE; - got_int = FALSE; /* don't stop executing autocommands et al. */ + got_int = FALSE; // don't stop executing autocommands et al. return; } #endif @@ -6883,8 +6879,8 @@ nv_esc(cmdarg_T *cap) if (VIsual_active) { - end_visual_mode(); /* stop Visual */ - check_cursor_col(); /* make sure cursor is not beyond EOL */ + end_visual_mode(); // stop Visual + check_cursor_col(); // make sure cursor is not beyond EOL curwin->w_set_curswant = TRUE; redraw_curbuf_later(INVERTED); } @@ -6892,8 +6888,8 @@ nv_esc(cmdarg_T *cap) vim_beep(BO_ESC); clearop(cap->oap); - /* A CTRL-C is often used at the start of a menu. When 'insertmode' is - * set return to Insert mode afterwards. */ + // A CTRL-C is often used at the start of a menu. When 'insertmode' is + // set return to Insert mode afterwards. if (restart_edit == 0 && goto_im() && ex_normal_busy == 0) restart_edit = 'a'; } @@ -6909,8 +6905,8 @@ set_cursor_for_append_to_line(void) { int save_State = State; - /* Pretend Insert mode here to allow the cursor on the - * character past the end of the line */ + // Pretend Insert mode here to allow the cursor on the + // character past the end of the line State = INSERT; coladvance((colnr_T)MAXCOL); State = save_State; @@ -6926,11 +6922,11 @@ set_cursor_for_append_to_line(void) static void nv_edit(cmdarg_T *cap) { - /* <Insert> is equal to "i" */ + // <Insert> is equal to "i" if (cap->cmdchar == K_INS || cap->cmdchar == K_KINS) cap->cmdchar = 'i'; - /* in Visual mode "A" and "I" are an operator */ + // in Visual mode "A" and "I" are an operator if (VIsual_active && (cap->cmdchar == 'A' || cap->cmdchar == 'I')) { #ifdef FEAT_TERMINAL @@ -6945,7 +6941,7 @@ nv_edit(cmdarg_T *cap) v_visop(cap); } - /* in Visual mode and after an operator "a" and "i" are for text objects */ + // in Visual mode and after an operator "a" and "i" are for text objects else if ((cap->cmdchar == 'a' || cap->cmdchar == 'i') && (cap->oap->op_type != OP_NOP || VIsual_active)) { @@ -6965,11 +6961,11 @@ nv_edit(cmdarg_T *cap) #endif else if (!curbuf->b_p_ma && !p_im) { - /* Only give this error when 'insertmode' is off. */ + // Only give this error when 'insertmode' is off. emsg(_(e_modifiable)); clearop(cap->oap); if (cap->cmdchar == K_PS) - /* drop the pasted text */ + // drop the pasted text bracketed_paste(PASTE_INSERT, TRUE, NULL); } else if (cap->cmdchar == K_PS && VIsual_active) @@ -6977,7 +6973,7 @@ nv_edit(cmdarg_T *cap) pos_T old_pos = curwin->w_cursor; pos_T old_visual = VIsual; - /* In Visual mode the selected text is deleted. */ + // In Visual mode the selected text is deleted. if (VIsual_mode == 'V' || curwin->w_cursor.lnum != VIsual.lnum) { shift_delete_registers(); @@ -6991,24 +6987,24 @@ nv_edit(cmdarg_T *cap) do_pending_operator(cap, 0, FALSE); cap->cmdchar = K_PS; - /* When the last char in the line was deleted then append. Detect this - * by checking if the cursor moved to before the Visual area. */ + // When the last char in the line was deleted then append. Detect this + // by checking if the cursor moved to before the Visual area. if (*ml_get_cursor() != NUL && LT_POS(curwin->w_cursor, old_pos) && LT_POS(curwin->w_cursor, old_visual)) inc_cursor(); - /* Insert to replace the deleted text with the pasted text. */ + // Insert to replace the deleted text with the pasted text. invoke_edit(cap, FALSE, cap->cmdchar, FALSE); } else if (!checkclearopq(cap->oap)) { switch (cap->cmdchar) { - case 'A': /* "A"ppend after the line */ + case 'A': // "A"ppend after the line set_cursor_for_append_to_line(); break; - case 'I': /* "I"nsert before the first non-blank */ + case 'I': // "I"nsert before the first non-blank if (vim_strchr(p_cpo, CPO_INSEND) == NULL) beginline(BL_WHITE); else @@ -7016,15 +7012,15 @@ nv_edit(cmdarg_T *cap) break; case K_PS: - /* Bracketed paste works like "a"ppend, unless the cursor is in - * the first column, then it inserts. */ + // Bracketed paste works like "a"ppend, unless the cursor is in + // the first column, then it inserts. if (curwin->w_cursor.col == 0) break; - /* FALLTHROUGH */ + // FALLTHROUGH - case 'a': /* "a"ppend is like "i"nsert on the next character. */ - /* increment coladd when in virtual space, increment the - * column otherwise, also to append after an unprintable char */ + case 'a': // "a"ppend is like "i"nsert on the next character. + // increment coladd when in virtual space, increment the + // column otherwise, also to append after an unprintable char if (virtual_active() && (curwin->w_cursor.coladd > 0 || *ml_get_cursor() == NUL @@ -7039,8 +7035,8 @@ nv_edit(cmdarg_T *cap) { int save_State = State; - /* Pretend Insert mode here to allow the cursor on the - * character past the end of the line */ + // Pretend Insert mode here to allow the cursor on the + // character past the end of the line State = INSERT; coladvance(getviscol()); State = save_State; @@ -7049,7 +7045,7 @@ nv_edit(cmdarg_T *cap) invoke_edit(cap, FALSE, cap->cmdchar, FALSE); } else if (cap->cmdchar == K_PS) - /* drop the pasted text */ + // drop the pasted text bracketed_paste(PASTE_INSERT, TRUE, NULL); } @@ -7059,21 +7055,21 @@ nv_edit(cmdarg_T *cap) static void invoke_edit( cmdarg_T *cap, - int repl, /* "r" or "gr" command */ + int repl, // "r" or "gr" command int cmd, int startln) { int restart_edit_save = 0; - /* Complicated: When the user types "a<C-O>a" we don't want to do Insert - * mode recursively. But when doing "a<C-O>." or "a<C-O>rx" we do allow - * it. */ + // Complicated: When the user types "a<C-O>a" we don't want to do Insert + // mode recursively. But when doing "a<C-O>." or "a<C-O>rx" we do allow + // it. if (repl || !stuff_empty()) restart_edit_save = restart_edit; else restart_edit_save = 0; - /* Always reset "restart_edit", this is not a restarted edit. */ + // Always reset "restart_edit", this is not a restarted edit. restart_edit = 0; if (edit(cmd, startln, cap->count1)) @@ -7096,67 +7092,66 @@ nv_object( char_u *mps_save; if (cap->cmdchar == 'i') - include = FALSE; /* "ix" = inner object: exclude white space */ + include = FALSE; // "ix" = inner object: exclude white space else - include = TRUE; /* "ax" = an object: include white space */ + include = TRUE; // "ax" = an object: include white space - /* Make sure (), [], {} and <> are in 'matchpairs' */ + // Make sure (), [], {} and <> are in 'matchpairs' mps_save = curbuf->b_p_mps; curbuf->b_p_mps = (char_u *)"(:),{:},[:],<:>"; switch (cap->nchar) { - case 'w': /* "aw" = a word */ + case 'w': // "aw" = a word flag = current_word(cap->oap, cap->count1, include, FALSE); break; - case 'W': /* "aW" = a WORD */ + case 'W': // "aW" = a WORD flag = current_word(cap->oap, cap->count1, include, TRUE); break; - case 'b': /* "ab" = a braces block */ + case 'b': // "ab" = a braces block case '(': case ')': flag = current_block(cap->oap, cap->count1, include, '(', ')'); break; - case 'B': /* "aB" = a Brackets block */ + case 'B': // "aB" = a Brackets block case '{': case '}': flag = current_block(cap->oap, cap->count1, include, '{', '}'); break; - case '[': /* "a[" = a [] block */ + case '[': // "a[" = a [] block case ']': flag = current_block(cap->oap, cap->count1, include, '[', ']'); break; - case '<': /* "a<" = a <> block */ + case '<': // "a<" = a <> block case '>': flag = current_block(cap->oap, cap->count1, include, '<', '>'); break; - case 't': /* "at" = a tag block (xml and html) */ - /* Do not adjust oap->end in do_pending_operator() - * otherwise there are different results for 'dit' - * (note leading whitespace in last line): - * 1) <b> 2) <b> - * foobar foobar - * </b> </b> - */ + case 't': // "at" = a tag block (xml and html) + // Do not adjust oap->end in do_pending_operator() + // otherwise there are different results for 'dit' + // (note leading whitespace in last line): + // 1) <b> 2) <b> + // foobar foobar + // </b> </b> cap->retval |= CA_NO_ADJ_OP_END; flag = current_tagblock(cap->oap, cap->count1, include); break; - case 'p': /* "ap" = a paragraph */ + case 'p': // "ap" = a paragraph flag = current_par(cap->oap, cap->count1, include, 'p'); break; - case 's': /* "as" = a sentence */ + case 's': // "as" = a sentence flag = current_sent(cap->oap, cap->count1, include); break; - case '"': /* "a"" = a double quoted string */ - case '\'': /* "a'" = a single quoted string */ - case '`': /* "a`" = a backtick quoted string */ + case '"': // "a"" = a double quoted string + case '\'': // "a'" = a single quoted string + case '`': // "a`" = a backtick quoted string flag = current_quote(cap->oap, cap->count1, include, cap->nchar); break; -#if 0 /* TODO */ - case 'S': /* "aS" = a section */ - case 'f': /* "af" = a filename */ - case 'u': /* "au" = a URL */ +#if 0 // TODO + case 'S': // "aS" = a section + case 'f': // "af" = a filename + case 'u': // "au" = a URL #endif default: flag = FAIL; @@ -7180,7 +7175,7 @@ nv_record(cmdarg_T *cap) { if (cap->oap->op_type == OP_FORMAT) { - /* "gqq" is the same as "gqgq": format line */ + // "gqq" is the same as "gqgq": format line cap->cmdchar = 'g'; cap->nchar = 'q'; nv_operator(cap); @@ -7195,8 +7190,8 @@ nv_record(cmdarg_T *cap) } else #endif - /* (stop) recording into a named register, unless executing a - * register */ + // (stop) recording into a named register, unless executing a + // register if (reg_executing == 0 && do_record(cap->nchar) == FAIL) clearopbeep(cap->oap); } @@ -7248,16 +7243,16 @@ nv_halfpage(cmdarg_T *cap) static void nv_join(cmdarg_T *cap) { - if (VIsual_active) /* join the visual lines */ + if (VIsual_active) // join the visual lines nv_operator(cap); else if (!checkclearop(cap->oap)) { if (cap->count0 <= 1) - cap->count0 = 2; /* default for join is two lines! */ + cap->count0 = 2; // default for join is two lines! if (curwin->w_cursor.lnum + cap->count0 - 1 > curbuf->b_ml.ml_line_count) { - /* can't join when on the last line */ + // can't join when on the last line if (cap->count0 <= 2) { clearopbeep(cap->oap); @@ -7299,7 +7294,7 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) if (cap->oap->op_type != OP_NOP) { #ifdef FEAT_DIFF - /* "dp" is ":diffput" */ + // "dp" is ":diffput" if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'p') { clearop(cap->oap); @@ -7333,11 +7328,10 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) if (VIsual_active) { - /* Putting in Visual mode: The put text replaces the selected - * text. First delete the selected text, then put the new text. - * Need to save and restore the registers that the delete - * overwrites if the old contents is being put. - */ + // Putting in Visual mode: The put text replaces the selected + // text. First delete the selected text, then put the new text. + // Need to save and restore the registers that the delete + // overwrites if the old contents is being put. was_visual = TRUE; regname = cap->oap->regname; #ifdef FEAT_CLIPBOARD @@ -7351,8 +7345,8 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) ) { - /* The delete is going to overwrite the register we want to - * put, save it first. */ + // The delete is going to overwrite the register we want to + // put, save it first. reg1 = get_register(regname, TRUE); } @@ -7366,20 +7360,20 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) empty = (curbuf->b_ml.ml_flags & ML_EMPTY); --msg_silent; - /* delete PUT_LINE_BACKWARD; */ + // delete PUT_LINE_BACKWARD; cap->oap->regname = regname; if (reg1 != NULL) { - /* Delete probably changed the register we want to put, save - * it first. Then put back what was there before the delete. */ + // Delete probably changed the register we want to put, save + // it first. Then put back what was there before the delete. reg2 = get_register(regname, FALSE); put_register(regname, reg1); } - /* When deleted a linewise Visual area, put the register as - * lines to avoid it joined with the next line. When deletion was - * characterwise, split a line when putting lines. */ + // When deleted a linewise Visual area, put the register as + // lines to avoid it joined with the next line. When deletion was + // characterwise, split a line when putting lines. if (VIsual_mode == 'V') flags |= PUT_LINE; else if (VIsual_mode == 'v') @@ -7391,38 +7385,38 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) && curwin->w_cursor.col < curbuf->b_op_start.col) || (VIsual_mode == 'V' && curwin->w_cursor.lnum < curbuf->b_op_start.lnum)) - /* cursor is at the end of the line or end of file, put - * forward. */ + // cursor is at the end of the line or end of file, put + // forward. dir = FORWARD; - /* May have been reset in do_put(). */ + // May have been reset in do_put(). VIsual_active = TRUE; } do_put(cap->oap->regname, dir, cap->count1, flags); - /* If a register was saved, put it back now. */ + // If a register was saved, put it back now. if (reg2 != NULL) put_register(regname, reg2); - /* What to reselect with "gv"? Selecting the just put text seems to - * be the most useful, since the original text was removed. */ + // What to reselect with "gv"? Selecting the just put text seems to + // be the most useful, since the original text was removed. if (was_visual) { curbuf->b_visual.vi_start = curbuf->b_op_start; curbuf->b_visual.vi_end = curbuf->b_op_end; - /* need to adjust cursor position */ + // need to adjust cursor position if (*p_sel == 'e') inc(&curbuf->b_visual.vi_end); } - /* When all lines were selected and deleted do_put() leaves an empty - * line that needs to be deleted now. */ + // When all lines were selected and deleted do_put() leaves an empty + // line that needs to be deleted now. if (empty && *ml_get(curbuf->b_ml.ml_line_count) == NUL) { ml_delete(curbuf->b_ml.ml_line_count, TRUE); deleted_lines(curbuf->b_ml.ml_line_count + 1, 1); - /* If the cursor was in that line, move it to the end of the last - * line. */ + // If the cursor was in that line, move it to the end of the last + // line. if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count) { curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; @@ -7440,7 +7434,7 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) nv_open(cmdarg_T *cap) { #ifdef FEAT_DIFF - /* "do" is ":diffget" */ + // "do" is ":diffget" if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'o') { clearop(cap->oap); @@ -7448,7 +7442,7 @@ nv_open(cmdarg_T *cap) } else #endif - if (VIsual_active) /* switch start and end of visual */ + if (VIsual_active) // switch start and end of visual v_swap_corners(cap->cmdchar); #ifdef FEAT_JOB_CHANNEL else if (bt_prompt(curbuf)) @@ -7484,5 +7478,5 @@ nv_cursorhold(cmdarg_T *cap) { apply_autocmds(EVENT_CURSORHOLD, NULL, NULL, FALSE, curbuf); did_cursorhold = TRUE; - cap->retval |= CA_COMMAND_BUSY; /* don't call edit() now */ + cap->retval |= CA_COMMAND_BUSY; // don't call edit() now } @@ -72,13 +72,13 @@ get_op_type(int char1, int char2) { int i; - if (char1 == 'r') /* ignore second character */ + if (char1 == 'r') // ignore second character return OP_REPLACE; - if (char1 == '~') /* when tilde is an operator */ + if (char1 == '~') // when tilde is an operator return OP_TILDE; - if (char1 == 'g' && char2 == Ctrl_A) /* add */ + if (char1 == 'g' && char2 == Ctrl_A) // add return OP_NR_ADD; - if (char1 == 'g' && char2 == Ctrl_X) /* subtract */ + if (char1 == 'g' && char2 == Ctrl_X) // subtract return OP_NR_SUB; for (i = 0; ; ++i) { @@ -152,13 +152,13 @@ op_shift(oparg_T *oap, int curs_top, int amount) for (i = oap->line_count; --i >= 0; ) { first_char = *ml_get_curline(); - if (first_char == NUL) /* empty line */ + if (first_char == NUL) // empty line curwin->w_cursor.col = 0; else if (oap->block_mode) shift_block(oap, amount); else - /* Move the line right if it doesn't start with '#', 'smartindent' - * isn't set or 'cindent' isn't set or '#' isn't in 'cino'. */ + // Move the line right if it doesn't start with '#', 'smartindent' + // isn't set or 'cindent' isn't set or '#' isn't in 'cino'. #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) if (first_char != '#' || !preprocs_left()) #endif @@ -172,16 +172,16 @@ op_shift(oparg_T *oap, int curs_top, int amount) curwin->w_cursor.lnum = oap->start.lnum; curwin->w_cursor.col = block_col; } - else if (curs_top) /* put cursor on first line, for ">>" */ + else if (curs_top) // put cursor on first line, for ">>" { curwin->w_cursor.lnum = oap->start.lnum; - beginline(BL_SOL | BL_FIX); /* shift_line() may have set cursor.col */ + beginline(BL_SOL | BL_FIX); // shift_line() may have set cursor.col } else - --curwin->w_cursor.lnum; /* put cursor on last line, for ":>" */ + --curwin->w_cursor.lnum; // put cursor on last line, for ":>" #ifdef FEAT_FOLDING - /* The cursor line is not in a closed fold */ + // The cursor line is not in a closed fold foldOpenCursor(); #endif @@ -291,18 +291,18 @@ shift_block(oparg_T *oap, int amount) #ifdef FEAT_RIGHTLEFT int old_p_ri = p_ri; - p_ri = 0; /* don't want revins in indent */ + p_ri = 0; // don't want revins in indent #endif - State = INSERT; /* don't want REPLACE for State */ + State = INSERT; // don't want REPLACE for State block_prep(oap, &bd, curwin->w_cursor.lnum, TRUE); if (bd.is_short) return; - /* total is number of screen columns to be inserted/removed */ + // total is number of screen columns to be inserted/removed total = (int)((unsigned)amount * (unsigned)sw_val); if ((total / sw_val) != amount) - return; /* multiplication overflow */ + return; // multiplication overflow oldp = ml_get_curline(); @@ -314,7 +314,7 @@ shift_block(oparg_T *oap, int amount) * 3. Divvy into TABs & spp * 4. Construct new string */ - total += bd.pre_whitesp; /* all virtual WS upto & incl a split TAB */ + total += bd.pre_whitesp; // all virtual WS upto & incl a split TAB ws_vcol = bd.start_vcol - bd.pre_whitesp; if (bd.startspaces) { @@ -333,14 +333,14 @@ shift_block(oparg_T *oap, int amount) } for ( ; VIM_ISWHITE(*bd.textstart); ) { - /* TODO: is passing bd.textstart for start of the line OK? */ + // TODO: is passing bd.textstart for start of the line OK? incr = lbr_chartabsize_adv(bd.textstart, &bd.textstart, (colnr_T)(bd.start_vcol)); total += incr; bd.start_vcol += incr; } - /* OK, now total=all the VWS reqd, and textstart points at the 1st - * non-ws char in the block. */ + // OK, now total=all the VWS reqd, and textstart points at the 1st + // non-ws char in the block. #ifdef FEAT_VARTABS if (!curbuf->b_p_et) tabstop_fromto(ws_vcol, ws_vcol + total, @@ -349,13 +349,13 @@ shift_block(oparg_T *oap, int amount) j = total; #else if (!curbuf->b_p_et) - i = ((ws_vcol % ts_val) + total) / ts_val; /* number of tabs */ + i = ((ws_vcol % ts_val) + total) / ts_val; // number of tabs if (i) - j = ((ws_vcol % ts_val) + total) % ts_val; /* number of spp */ + j = ((ws_vcol % ts_val) + total) % ts_val; // number of spp else j = total; #endif - /* if we're splitting a TAB, allow for it */ + // if we're splitting a TAB, allow for it bd.textcol -= bd.pre_whitesp_c - (bd.startspaces != 0); len = (int)STRLEN(bd.textstart) + 1; newp = alloc(bd.textcol + i + j + len); @@ -365,20 +365,20 @@ shift_block(oparg_T *oap, int amount) mch_memmove(newp, oldp, (size_t)bd.textcol); vim_memset(newp + bd.textcol, TAB, (size_t)i); vim_memset(newp + bd.textcol + i, ' ', (size_t)j); - /* the end */ + // the end mch_memmove(newp + bd.textcol + i + j, bd.textstart, (size_t)len); } - else /* left */ + else // left { - colnr_T destination_col; /* column to which text in block will - be shifted */ - char_u *verbatim_copy_end; /* end of the part of the line which is - copied verbatim */ - colnr_T verbatim_copy_width;/* the (displayed) width of this part - of line */ - unsigned fill; /* nr of spaces that replace a TAB */ - unsigned new_line_len; /* the length of the line after the - block shift */ + colnr_T destination_col; // column to which text in block will + // be shifted + char_u *verbatim_copy_end; // end of the part of the line which is + // copied verbatim + colnr_T verbatim_copy_width;// the (displayed) width of this part + // of line + unsigned fill; // nr of spaces that replace a TAB + unsigned new_line_len; // the length of the line after the + // block shift size_t block_space_width; size_t shift_amount; char_u *non_white = bd.textstart; @@ -392,13 +392,13 @@ shift_block(oparg_T *oap, int amount) * non-whitespace character. */ - /* If "bd.startspaces" is set, "bd.textstart" points to the character, - * the part of which is displayed at the block's beginning. Let's start - * searching from the next character. */ + // If "bd.startspaces" is set, "bd.textstart" points to the character, + // the part of which is displayed at the block's beginning. Let's start + // searching from the next character. if (bd.startspaces) MB_PTR_ADV(non_white); - /* The character's column is in "bd.start_vcol". */ + // The character's column is in "bd.start_vcol". non_white_col = bd.start_vcol; while (VIM_ISWHITE(*non_white)) @@ -408,29 +408,28 @@ shift_block(oparg_T *oap, int amount) } block_space_width = non_white_col - oap->start_vcol; - /* We will shift by "total" or "block_space_width", whichever is less. - */ + // We will shift by "total" or "block_space_width", whichever is less. shift_amount = (block_space_width < (size_t)total ? block_space_width : (size_t)total); - /* The column to which we will shift the text. */ + // The column to which we will shift the text. destination_col = (colnr_T)(non_white_col - shift_amount); - /* Now let's find out how much of the beginning of the line we can - * reuse without modification. */ + // Now let's find out how much of the beginning of the line we can + // reuse without modification. verbatim_copy_end = bd.textstart; verbatim_copy_width = bd.start_vcol; - /* If "bd.startspaces" is set, "bd.textstart" points to the character - * preceding the block. We have to subtract its width to obtain its - * column number. */ + // If "bd.startspaces" is set, "bd.textstart" points to the character + // preceding the block. We have to subtract its width to obtain its + // column number. if (bd.startspaces) verbatim_copy_width -= bd.start_char_vcols; while (verbatim_copy_width < destination_col) { char_u *line = verbatim_copy_end; - /* TODO: is passing verbatim_copy_end for start of the line OK? */ + // TODO: is passing verbatim_copy_end for start of the line OK? incr = lbr_chartabsize(line, verbatim_copy_end, verbatim_copy_width); if (verbatim_copy_width + incr > destination_col) @@ -439,15 +438,15 @@ shift_block(oparg_T *oap, int amount) MB_PTR_ADV(verbatim_copy_end); } - /* If "destination_col" is different from the width of the initial - * part of the line that will be copied, it means we encountered a tab - * character, which we will have to partly replace with spaces. */ + // If "destination_col" is different from the width of the initial + // part of the line that will be copied, it means we encountered a tab + // character, which we will have to partly replace with spaces. fill = destination_col - verbatim_copy_width; - /* The replacement line will consist of: - * - the beginning of the original line up to "verbatim_copy_end", - * - "fill" number of spaces, - * - the rest of the line, pointed to by non_white. */ + // The replacement line will consist of: + // - the beginning of the original line up to "verbatim_copy_end", + // - "fill" number of spaces, + // - the rest of the line, pointed to by non_white. new_line_len = (unsigned)(verbatim_copy_end - oldp) + fill + (unsigned)STRLEN(non_white) + 1; @@ -459,7 +458,7 @@ shift_block(oparg_T *oap, int amount) vim_memset(newp + (verbatim_copy_end - oldp), ' ', (size_t)fill); STRMOVE(newp + (verbatim_copy_end - oldp) + fill, non_white); } - /* replace the line */ + // replace the line ml_replace(curwin->w_cursor.lnum, newp, FALSE); changed_bytes(curwin->w_cursor.lnum, (colnr_T)bd.textcol); State = oldstate; @@ -481,22 +480,22 @@ block_insert( struct block_def *bdp) { int ts_val; - int count = 0; /* extra spaces to replace a cut TAB */ - int spaces = 0; /* non-zero if cutting a TAB */ - colnr_T offset; /* pointer along new line */ - unsigned s_len; /* STRLEN(s) */ - char_u *newp, *oldp; /* new, old lines */ - linenr_T lnum; /* loop var */ + int count = 0; // extra spaces to replace a cut TAB + int spaces = 0; // non-zero if cutting a TAB + colnr_T offset; // pointer along new line + unsigned s_len; // STRLEN(s) + char_u *newp, *oldp; // new, old lines + linenr_T lnum; // loop var int oldstate = State; - State = INSERT; /* don't want REPLACE for State */ + State = INSERT; // don't want REPLACE for State s_len = (unsigned)STRLEN(s); for (lnum = oap->start.lnum + 1; lnum <= oap->end.lnum; lnum++) { block_prep(oap, bdp, lnum, TRUE); if (bdp->is_short && b_insert) - continue; /* OP_INSERT, line ends before block start */ + continue; // OP_INSERT, line ends before block start oldp = ml_get(lnum); @@ -505,22 +504,22 @@ block_insert( ts_val = bdp->start_char_vcols; spaces = bdp->startspaces; if (spaces != 0) - count = ts_val - 1; /* we're cutting a TAB */ + count = ts_val - 1; // we're cutting a TAB offset = bdp->textcol; } - else /* append */ + else // append { ts_val = bdp->end_char_vcols; - if (!bdp->is_short) /* spaces = padding after block */ + if (!bdp->is_short) // spaces = padding after block { spaces = (bdp->endspaces ? ts_val - bdp->endspaces : 0); if (spaces != 0) - count = ts_val - 1; /* we're cutting a TAB */ + count = ts_val - 1; // we're cutting a TAB offset = bdp->textcol + bdp->textlen - (spaces != 0); } - else /* spaces = padding to block edge */ + else // spaces = padding to block edge { - /* if $ used, just append to EOL (ie spaces==0) */ + // if $ used, just append to EOL (ie spaces==0) if (!bdp->is_MAX) spaces = (oap->end_vcol - bdp->end_vcol) + 1; count = spaces; @@ -532,7 +531,7 @@ block_insert( { int off; - /* Avoid starting halfway a multi-byte character. */ + // Avoid starting halfway a multi-byte character. if (b_insert) { off = (*mb_head_off)(oldp, oldp + offset + spaces); @@ -550,24 +549,24 @@ block_insert( if (newp == NULL) continue; - /* copy up to shifted part */ + // copy up to shifted part mch_memmove(newp, oldp, (size_t)(offset)); oldp += offset; - /* insert pre-padding */ + // insert pre-padding vim_memset(newp + offset, ' ', (size_t)spaces); - /* copy the new text */ + // copy the new text mch_memmove(newp + offset + spaces, s, (size_t)s_len); offset += s_len; if (spaces && !bdp->is_short) { - /* insert post-padding */ + // insert post-padding vim_memset(newp + offset + spaces, ' ', (size_t)(ts_val - spaces)); - /* We're splitting a TAB, don't copy it. */ + // We're splitting a TAB, don't copy it. oldp++; - /* We allowed for that TAB, remember this now */ + // We allowed for that TAB, remember this now count++; } @@ -579,12 +578,12 @@ block_insert( if (lnum == oap->end.lnum) { - /* Set "']" mark to the end of the block instead of the end of - * the insert in the first line. */ + // Set "']" mark to the end of the block instead of the end of + // the insert in the first line. curbuf->b_op_end.lnum = oap->end.lnum; curbuf->b_op_end.col = offset; } - } /* for all lnum */ + } // for all lnum changed_lines(oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L); @@ -603,13 +602,13 @@ stuffescaped(char_u *arg, int literally) while (*arg != NUL) { - /* Stuff a sequence of normal ASCII characters, that's fast. Also - * stuff K_SPECIAL to get the effect of a special key when "literally" - * is TRUE. */ + // Stuff a sequence of normal ASCII characters, that's fast. Also + // stuff K_SPECIAL to get the effect of a special key when "literally" + // is TRUE. start = arg; while ((*arg >= ' ' #ifndef EBCDIC - && *arg < DEL /* EBCDIC: chars above space are normal */ + && *arg < DEL // EBCDIC: chars above space are normal #endif ) || (*arg == K_SPECIAL && !literally)) @@ -617,7 +616,7 @@ stuffescaped(char_u *arg, int literally) if (arg > start) stuffReadbuffLen(start, (long)(arg - start)); - /* stuff a single special character */ + // stuff a single special character if (*arg != NUL) { if (has_mbyte) @@ -647,10 +646,10 @@ op_delete(oparg_T *oap) linenr_T old_lcount = curbuf->b_ml.ml_line_count; int did_yank = FALSE; - if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to do */ + if (curbuf->b_ml.ml_flags & ML_EMPTY) // nothing to do return OK; - /* Nothing to delete, return here. Do prepare undo, for op_change(). */ + // Nothing to delete, return here. Do prepare undo, for op_change(). if (oap->empty) return u_save_cursor(); @@ -701,8 +700,8 @@ op_delete(oparg_T *oap) * 'cpoptions' (Vi compatible). */ if (virtual_op) - /* Virtual editing: Nothing gets deleted, but we set the '[ and '] - * marks as if it happened. */ + // Virtual editing: Nothing gets deleted, but we set the '[ and '] + // marks as if it happened. goto setmarks; if (vim_strchr(p_cpo, CPO_EMPTYREGION) != NULL) beep_flush(); @@ -718,14 +717,14 @@ op_delete(oparg_T *oap) { if (oap->regname != 0) { - /* check for read-only register */ + // check for read-only register if (!valid_yank_reg(oap->regname, TRUE)) { beep_flush(); return OK; } - get_yank_register(oap->regname, TRUE); /* yank into specif'd reg. */ - if (op_yank(oap, TRUE, FALSE) == OK) /* yank without message */ + get_yank_register(oap->regname, TRUE); // yank into specif'd reg. + if (op_yank(oap, TRUE, FALSE) == OK) // yank without message did_yank = TRUE; } @@ -744,8 +743,8 @@ op_delete(oparg_T *oap) did_yank = TRUE; } - /* Yank into small delete register when no named register specified - * and the delete is within one line. */ + // Yank into small delete register when no named register specified + // and the delete is within one line. if (( #ifdef FEAT_CLIPBOARD ((clip_unnamed & CLIP_UNNAMED) && oap->regname == '*') || @@ -771,7 +770,7 @@ op_delete(oparg_T *oap) { int msg_silent_save = msg_silent; - msg_silent = 0; /* must display the prompt */ + msg_silent = 0; // must display the prompt n = ask_yesno((char_u *)_("cannot yank; delete anyway"), TRUE); msg_silent = msg_silent_save; if (n != 'y') @@ -799,10 +798,10 @@ op_delete(oparg_T *oap) for (lnum = curwin->w_cursor.lnum; lnum <= oap->end.lnum; ++lnum) { block_prep(oap, &bd, lnum, TRUE); - if (bd.textlen == 0) /* nothing to delete */ + if (bd.textlen == 0) // nothing to delete continue; - /* Adjust cursor position for tab replaced by spaces and 'lbr'. */ + // Adjust cursor position for tab replaced by spaces and 'lbr'. if (lnum == curwin->w_cursor.lnum) { curwin->w_cursor.col = bd.textcol + bd.startspaces; @@ -817,15 +816,15 @@ op_delete(oparg_T *oap) newp = alloc(STRLEN(oldp) + 1 - n); if (newp == NULL) continue; - /* copy up to deleted part */ + // copy up to deleted part mch_memmove(newp, oldp, (size_t)bd.textcol); - /* insert spaces */ + // insert spaces vim_memset(newp + bd.textcol, ' ', (size_t)(bd.startspaces + bd.endspaces)); - /* copy the part after the deleted part */ + // copy the part after the deleted part oldp += bd.textcol + bd.textlen; STRMOVE(newp + bd.textcol + bd.startspaces + bd.endspaces, oldp); - /* replace the line */ + // replace the line ml_replace(lnum, newp, FALSE); #ifdef FEAT_PROP_POPUP @@ -837,16 +836,15 @@ op_delete(oparg_T *oap) check_cursor_col(); changed_lines(curwin->w_cursor.lnum, curwin->w_cursor.col, oap->end.lnum + 1, 0L); - oap->line_count = 0; /* no lines deleted */ + oap->line_count = 0; // no lines deleted } else if (oap->motion_type == MLINE) { if (oap->op_type == OP_CHANGE) { - /* Delete the lines except the first one. Temporarily move the - * cursor to the next line. Save the current line number, if the - * last line is deleted it may be changed. - */ + // Delete the lines except the first one. Temporarily move the + // cursor to the next line. Save the current line number, if the + // last line is deleted it may be changed. if (oap->line_count > 1) { lnum = curwin->w_cursor.lnum; @@ -856,24 +854,24 @@ op_delete(oparg_T *oap) } if (u_save_cursor() == FAIL) return FAIL; - if (curbuf->b_p_ai) /* don't delete indent */ + if (curbuf->b_p_ai) // don't delete indent { - beginline(BL_WHITE); /* cursor on first non-white */ - did_ai = TRUE; /* delete the indent when ESC hit */ + beginline(BL_WHITE); // cursor on first non-white + did_ai = TRUE; // delete the indent when ESC hit ai_col = curwin->w_cursor.col; } else - beginline(0); /* cursor in column 0 */ - truncate_line(FALSE); /* delete the rest of the line */ - /* leave cursor past last char in line */ + beginline(0); // cursor in column 0 + truncate_line(FALSE); // delete the rest of the line + // leave cursor past last char in line if (oap->line_count > 1) - u_clearline(); /* "U" command not possible after "2cc" */ + u_clearline(); // "U" command not possible after "2cc" } else { del_lines(oap->line_count, TRUE); beginline(BL_WHITE | BL_FIX); - u_clearline(); /* "U" command not possible after "dd" */ + u_clearline(); // "U" command not possible after "dd" } } else @@ -882,10 +880,10 @@ op_delete(oparg_T *oap) { int endcol = 0; - /* For virtualedit: break the tabs that are partly included. */ + // For virtualedit: break the tabs that are partly included. if (gchar_pos(&oap->start) == '\t') { - if (u_save_cursor() == FAIL) /* save first line for undo */ + if (u_save_cursor() == FAIL) // save first line for undo return FAIL; if (oap->line_count == 1) endcol = getviscol2(oap->end.col, oap->end.coladd); @@ -900,11 +898,11 @@ op_delete(oparg_T *oap) } } - /* Break a tab only when it's included in the area. */ + // Break a tab only when it's included in the area. if (gchar_pos(&oap->end) == '\t' && (int)oap->end.coladd < oap->inclusive) { - /* save last line for undo */ + // save last line for undo if (u_save((linenr_T)(oap->end.lnum - 1), (linenr_T)(oap->end.lnum + 1)) == FAIL) return FAIL; @@ -917,12 +915,12 @@ op_delete(oparg_T *oap) mb_adjust_opend(oap); } - if (oap->line_count == 1) /* delete characters within one line */ + if (oap->line_count == 1) // delete characters within one line { - if (u_save_cursor() == FAIL) /* save line for undo */ + if (u_save_cursor() == FAIL) // save line for undo return FAIL; - /* if 'cpoptions' contains '$', display '$' at end of change */ + // if 'cpoptions' contains '$', display '$' at end of change if ( vim_strchr(p_cpo, CPO_DOLLAR) != NULL && oap->op_type == OP_CHANGE && oap->end.lnum == curwin->w_cursor.lnum @@ -933,9 +931,8 @@ op_delete(oparg_T *oap) if (virtual_op) { - /* fix up things for virtualedit-delete: - * break the tabs which are going to get in our way - */ + // fix up things for virtualedit-delete: + // break the tabs which are going to get in our way char_u *curline = ml_get_curline(); int len = (int)STRLEN(curline); @@ -943,38 +940,38 @@ op_delete(oparg_T *oap) && (int)oap->end.col >= len - 1 && !(oap->start.coladd && (int)oap->end.col >= len - 1)) n++; - /* Delete at least one char (e.g, when on a control char). */ + // Delete at least one char (e.g, when on a control char). if (n == 0 && oap->start.coladd != oap->end.coladd) n = 1; - /* When deleted a char in the line, reset coladd. */ + // When deleted a char in the line, reset coladd. if (gchar_cursor() != NUL) curwin->w_cursor.coladd = 0; } (void)del_bytes((long)n, !virtual_op, oap->op_type == OP_DELETE && !oap->is_VIsual); } - else /* delete characters between lines */ + else // delete characters between lines { pos_T curpos; - /* save deleted and changed lines for undo */ + // save deleted and changed lines for undo if (u_save((linenr_T)(curwin->w_cursor.lnum - 1), (linenr_T)(curwin->w_cursor.lnum + oap->line_count)) == FAIL) return FAIL; - truncate_line(TRUE); /* delete from cursor to end of line */ + truncate_line(TRUE); // delete from cursor to end of line - curpos = curwin->w_cursor; /* remember curwin->w_cursor */ + curpos = curwin->w_cursor; // remember curwin->w_cursor ++curwin->w_cursor.lnum; del_lines((long)(oap->line_count - 2), FALSE); - /* delete from start of line until op_end */ + // delete from start of line until op_end n = (oap->end.col + 1 - !oap->inclusive); curwin->w_cursor.col = 0; (void)del_bytes((long)n, !virtual_op, oap->op_type == OP_DELETE && !oap->is_VIsual); - curwin->w_cursor = curpos; /* restore curwin->w_cursor */ + curwin->w_cursor = curpos; // restore curwin->w_cursor (void)do_join(2, FALSE, FALSE, FALSE, FALSE); } } @@ -1025,7 +1022,7 @@ replace_character(int c) State = REPLACE; ins_char(c); State = n; - /* Backup to the replaced character. */ + // Backup to the replaced character. dec_cursor(); } @@ -1044,7 +1041,7 @@ op_replace(oparg_T *oap, int c) int had_ctrl_v_cr = FALSE; if ((curbuf->b_ml.ml_flags & ML_EMPTY ) || oap->empty) - return OK; /* nothing to do */ + return OK; // nothing to do if (c == REPLACE_CR_NCHAR) { @@ -1072,17 +1069,16 @@ op_replace(oparg_T *oap, int c) bd.is_MAX = (curwin->w_curswant == MAXCOL); for ( ; curwin->w_cursor.lnum <= oap->end.lnum; ++curwin->w_cursor.lnum) { - curwin->w_cursor.col = 0; /* make sure cursor position is valid */ + curwin->w_cursor.col = 0; // make sure cursor position is valid block_prep(oap, &bd, curwin->w_cursor.lnum, TRUE); if (bd.textlen == 0 && (!virtual_op || bd.is_MAX)) - continue; /* nothing to replace */ + continue; // nothing to replace - /* n == number of extra chars required - * If we split a TAB, it may be replaced by several characters. - * Thus the number of characters may increase! - */ - /* If the range starts in virtual space, count the initial - * coladd offset as part of "startspaces" */ + // n == number of extra chars required + // If we split a TAB, it may be replaced by several characters. + // Thus the number of characters may increase! + // If the range starts in virtual space, count the initial + // coladd offset as part of "startspaces" if (virtual_op && bd.is_short && *bd.textstart == NUL) { pos_T vpos; @@ -1093,20 +1089,20 @@ op_replace(oparg_T *oap, int c) n = bd.startspaces; } else - /* allow for pre spaces */ + // allow for pre spaces n = (bd.startspaces ? bd.start_char_vcols - 1 : 0); - /* allow for post spp */ + // allow for post spp n += (bd.endspaces && !bd.is_oneChar && bd.end_char_vcols > 0) ? bd.end_char_vcols - 1 : 0; - /* Figure out how many characters to replace. */ + // Figure out how many characters to replace. numc = oap->end_vcol - oap->start_vcol + 1; if (bd.is_short && (!virtual_op || bd.is_MAX)) numc -= (oap->end_vcol - bd.end_vcol) + 1; - /* A double-wide character can be replaced only up to half the - * times. */ + // A double-wide character can be replaced only up to half the + // times. if ((*mb_char2cells)(c) > 1) { if ((numc & 1) && !bd.is_short) @@ -1117,10 +1113,10 @@ op_replace(oparg_T *oap, int c) numc = numc / 2; } - /* Compute bytes needed, move character count to num_chars. */ + // Compute bytes needed, move character count to num_chars. num_chars = numc; numc *= (*mb_char2len)(c); - /* oldlen includes textlen, so don't double count */ + // oldlen includes textlen, so don't double count n += numc - bd.textlen; oldp = ml_get_curline(); @@ -1129,14 +1125,14 @@ op_replace(oparg_T *oap, int c) if (newp == NULL) continue; vim_memset(newp, NUL, (size_t)(oldlen + 1 + n)); - /* copy up to deleted part */ + // copy up to deleted part mch_memmove(newp, oldp, (size_t)bd.textcol); oldp += bd.textcol + bd.textlen; - /* insert pre-spaces */ + // insert pre-spaces vim_memset(newp + bd.textcol, ' ', (size_t)bd.startspaces); - /* insert replacement chars CHECK FOR ALLOCATED SPACE */ - /* REPLACE_CR_NCHAR/REPLACE_NL_NCHAR is used for entering CR - * literally. */ + // insert replacement chars CHECK FOR ALLOCATED SPACE + // REPLACE_CR_NCHAR/REPLACE_NL_NCHAR is used for entering CR + // literally. if (had_ctrl_v_cr || (c != '\r' && c != '\n')) { if (has_mbyte) @@ -1149,20 +1145,20 @@ op_replace(oparg_T *oap, int c) vim_memset(newp + STRLEN(newp), c, (size_t)numc); if (!bd.is_short) { - /* insert post-spaces */ + // insert post-spaces vim_memset(newp + STRLEN(newp), ' ', (size_t)bd.endspaces); - /* copy the part after the changed part */ + // copy the part after the changed part STRMOVE(newp + STRLEN(newp), oldp); } } else { - /* Replacing with \r or \n means splitting the line. */ + // Replacing with \r or \n means splitting the line. after_p = alloc(oldlen + 1 + n - STRLEN(newp)); if (after_p != NULL) STRMOVE(after_p, oldp); } - /* replace the line */ + // replace the line ml_replace(curwin->w_cursor.lnum, newp, FALSE); if (after_p != NULL) { @@ -1196,8 +1192,8 @@ op_replace(oparg_T *oap, int c) { if ((*mb_char2len)(c) > 1 || (*mb_char2len)(n) > 1) { - /* This is slow, but it handles replacing a single-byte - * with a multi-byte and the other way around. */ + // This is slow, but it handles replacing a single-byte + // with a multi-byte and the other way around. if (curwin->w_cursor.lnum == oap->end.lnum) oap->end.col += (*mb_char2len)(c) - (*mb_char2len)(n); replace_character(c); @@ -1210,8 +1206,8 @@ op_replace(oparg_T *oap, int c) if (curwin->w_cursor.lnum == oap->end.lnum) { - /* oap->end has to be recalculated when - * the tab breaks */ + // oap->end has to be recalculated when + // the tab breaks end_vcol = getviscol2(oap->end.col, oap->end.coladd); } @@ -1230,9 +1226,9 @@ op_replace(oparg_T *oap, int c) && oap->start.col == oap->end.col && oap->start.coladd) virtcols -= oap->start.coladd; - /* oap->end has been trimmed so it's effectively inclusive; - * as a result an extra +1 must be counted so we don't - * trample the NUL byte. */ + // oap->end has been trimmed so it's effectively inclusive; + // as a result an extra +1 must be counted so we don't + // trample the NUL byte. coladvance_force(getviscol2(oap->end.col, oap->end.coladd) + 1); curwin->w_cursor.col -= (virtcols + 1); for (; virtcols >= 0; virtcols--) @@ -1246,7 +1242,7 @@ op_replace(oparg_T *oap, int c) } } - /* Advance to next character, stop at the end of the file. */ + // Advance to next character, stop at the end of the file. if (inc_cursor() == -1) break; } @@ -1258,7 +1254,7 @@ op_replace(oparg_T *oap, int c) if (!cmdmod.lockmarks) { - /* Set "'[" and "']" marks. */ + // Set "'[" and "']" marks. curbuf->b_op_start = oap->start; curbuf->b_op_end = oap->end; } @@ -1283,7 +1279,7 @@ op_tilde(oparg_T *oap) return; pos = oap->start; - if (oap->block_mode) /* Visual block mode */ + if (oap->block_mode) // Visual block mode { for (; pos.lnum <= oap->end.lnum; ++pos.lnum) { @@ -1309,7 +1305,7 @@ op_tilde(oparg_T *oap) if (did_change) changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L); } - else /* not block mode */ + else // not block mode { if (oap->motion_type == MLINE) { @@ -1366,7 +1362,7 @@ op_tilde(oparg_T *oap) } if (!did_change && oap->is_VIsual) - /* No change: need to remove the Visual selection */ + // No change: need to remove the Visual selection redraw_curbuf_later(INVERTED); if (!cmdmod.lockmarks) @@ -1400,12 +1396,12 @@ swapchars(int op_type, pos_T *pos, int length) { int len = (*mb_ptr2len)(ml_get_pos(pos)); - /* we're counting bytes, not characters */ + // we're counting bytes, not characters if (len > 0) todo -= len - 1; } did_change |= swapchar(op_type, pos); - if (inc(pos) == -1) /* at end of file */ + if (inc(pos) == -1) // at end of file break; } return did_change; @@ -1426,7 +1422,7 @@ swapchar(int op_type, pos_T *pos) c = gchar_pos(pos); - /* Only do rot13 encoding for ASCII characters. */ + // Only do rot13 encoding for ASCII characters. if (c >= 0x80 && op_type == OP_ROT13) return FALSE; @@ -1435,7 +1431,7 @@ swapchar(int op_type, pos_T *pos) { pos_T sp = curwin->w_cursor; - /* Special handling of German sharp s: change to "SS". */ + // Special handling of German sharp s: change to "SS". curwin->w_cursor = *pos; del_char(FALSE); ins_char('S'); @@ -1444,7 +1440,7 @@ swapchar(int op_type, pos_T *pos) inc(pos); } - if (enc_dbcs != 0 && c >= 0x100) /* No lower/uppercase letter */ + if (enc_dbcs != 0 && c >= 0x100) // No lower/uppercase letter return FALSE; nc = c; if (MB_ISLOWER(c)) @@ -1468,7 +1464,7 @@ swapchar(int op_type, pos_T *pos) pos_T sp = curwin->w_cursor; curwin->w_cursor = *pos; - /* don't use del_char(), it also removes composing chars */ + // don't use del_char(), it also removes composing chars del_bytes(utf_ptr2len(ml_get_cursor()), FALSE, FALSE); ins_char(nc); curwin->w_cursor = sp; @@ -1493,19 +1489,19 @@ op_insert(oparg_T *oap, long count1) int i; pos_T t1; - /* edit() changes this - record it for OP_APPEND */ + // edit() changes this - record it for OP_APPEND bd.is_MAX = (curwin->w_curswant == MAXCOL); - /* vis block is still marked. Get rid of it now. */ + // vis block is still marked. Get rid of it now. curwin->w_cursor.lnum = oap->start.lnum; update_screen(INVERTED); if (oap->block_mode) { - /* When 'virtualedit' is used, need to insert the extra spaces before - * doing block_prep(). When only "block" is used, virtual edit is - * already disabled, but still need it when calling - * coladvance_force(). */ + // When 'virtualedit' is used, need to insert the extra spaces before + // doing block_prep(). When only "block" is used, virtual edit is + // already disabled, but still need it when calling + // coladvance_force(). if (curwin->w_cursor.coladd > 0) { int old_ve_flags = ve_flags; @@ -1519,9 +1515,9 @@ op_insert(oparg_T *oap, long count1) --curwin->w_cursor.col; ve_flags = old_ve_flags; } - /* Get the info about the block before entering the text */ + // Get the info about the block before entering the text block_prep(oap, &bd, oap->start.lnum, TRUE); - /* Get indent information */ + // Get indent information ind_pre = (colnr_T)getwhitecols_curline(); firstline = ml_get(oap->start.lnum) + bd.textcol; @@ -1534,15 +1530,15 @@ op_insert(oparg_T *oap, long count1) { if (oap->block_mode && curwin->w_cursor.coladd == 0) { - /* Move the cursor to the character right of the block. */ + // Move the cursor to the character right of the block. curwin->w_set_curswant = TRUE; while (*ml_get_cursor() != NUL && (curwin->w_cursor.col < bd.textcol + bd.textlen)) ++curwin->w_cursor.col; if (bd.is_short && !bd.is_MAX) { - /* First line was too short, make it longer and adjust the - * values in "bd". */ + // First line was too short, make it longer and adjust the + // values in "bd". if (u_save_cursor() == FAIL) return; for (i = 0; i < bd.endspaces; ++i) @@ -1555,7 +1551,7 @@ op_insert(oparg_T *oap, long count1) curwin->w_cursor = oap->end; check_cursor_col(); - /* Works just like an 'i'nsert on the next character. */ + // Works just like an 'i'nsert on the next character. if (!LINEEMPTY(curwin->w_cursor.lnum) && oap->start_vcol != oap->end_vcol) inc_cursor(); @@ -1565,16 +1561,16 @@ op_insert(oparg_T *oap, long count1) t1 = oap->start; (void)edit(NUL, FALSE, (linenr_T)count1); - /* When a tab was inserted, and the characters in front of the tab - * have been converted to a tab as well, the column of the cursor - * might have actually been reduced, so need to adjust here. */ + // When a tab was inserted, and the characters in front of the tab + // have been converted to a tab as well, the column of the cursor + // might have actually been reduced, so need to adjust here. if (t1.lnum == curbuf->b_op_start_orig.lnum && LT_POS(curbuf->b_op_start_orig, t1)) oap->start = curbuf->b_op_start_orig; - /* If user has moved off this line, we don't know what to do, so do - * nothing. - * Also don't repeat the insert when Insert mode ended with CTRL-C. */ + // If user has moved off this line, we don't know what to do, so do + // nothing. + // Also don't repeat the insert when Insert mode ended with CTRL-C. if (curwin->w_cursor.lnum != oap->start.lnum || got_int) return; @@ -1585,8 +1581,8 @@ op_insert(oparg_T *oap, long count1) size_t len; int add; - /* If indent kicked in, the firstline might have changed - * but only do that, if the indent actually increased. */ + // If indent kicked in, the firstline might have changed + // but only do that, if the indent actually increased. ind_post = (colnr_T)getwhitecols_curline(); if (curbuf->b_op_start.col > ind_pre && ind_post > ind_pre) { @@ -1595,9 +1591,9 @@ op_insert(oparg_T *oap, long count1) did_indent = TRUE; } - /* The user may have moved the cursor before inserting something, try - * to adjust the block for that. But only do it, if the difference - * does not come from indent kicking in. */ + // The user may have moved the cursor before inserting something, try + // to adjust the block for that. But only do it, if the difference + // does not come from indent kicking in. if (oap->start.lnum == curbuf->b_op_start_orig.lnum && !bd.is_MAX && !did_indent) { @@ -1620,7 +1616,7 @@ op_insert(oparg_T *oap, long count1) int t = getviscol2(curbuf->b_op_start_orig.col, curbuf->b_op_start_orig.coladd); oap->start.col = curbuf->b_op_start_orig.col; - /* reset pre_textlen to the value of OP_INSERT */ + // reset pre_textlen to the value of OP_INSERT pre_textlen += bd.textlen; pre_textlen -= t - oap->start_vcol; oap->start_vcol = t; @@ -1665,7 +1661,7 @@ op_insert(oparg_T *oap, long count1) ins_text = vim_strnsave(firstline, (int)ins_len); if (ins_text != NULL) { - /* block handled here */ + // block handled here if (u_save(oap->start.lnum, (linenr_T)(oap->end.lnum + 1)) == OK) block_insert(oap, ins_text, (oap->op_type == OP_INSERT), @@ -1708,12 +1704,12 @@ op_change(oparg_T *oap) && !curbuf->b_p_cin # endif ) - can_si = TRUE; /* It's like opening a new line, do si */ + can_si = TRUE; // It's like opening a new line, do si #endif } - /* First delete the text in the region. In an empty buffer only need to - * save for undo */ + // First delete the text in the region. In an empty buffer only need to + // save for undo if (curbuf->b_ml.ml_flags & ML_EMPTY) { if (u_save_cursor() == FAIL) @@ -1726,11 +1722,11 @@ op_change(oparg_T *oap) && !virtual_op) inc_cursor(); - /* check for still on same line (<CR> in inserted text meaningless) */ - /* skip blank lines too */ + // check for still on same line (<CR> in inserted text meaningless) + // skip blank lines too if (oap->block_mode) { - /* Add spaces before getting the current line length. */ + // Add spaces before getting the current line length. if (virtual_op && (curwin->w_cursor.coladd > 0 || gchar_cursor() == NUL)) coladvance_force(getviscol()); @@ -1754,8 +1750,8 @@ op_change(oparg_T *oap) */ if (oap->block_mode && oap->start.lnum != oap->end.lnum && !got_int) { - /* Auto-indenting may have changed the indent. If the cursor was past - * the indent, exclude that indent change from the inserted text. */ + // Auto-indenting may have changed the indent. If the cursor was past + // the indent, exclude that indent change from the inserted text. firstline = ml_get(oap->start.lnum); if (bd.textcol > (colnr_T)pre_indent) { @@ -1768,8 +1764,8 @@ op_change(oparg_T *oap) ins_len = (long)STRLEN(firstline) - pre_textlen; if (ins_len > 0) { - /* Subsequent calls to ml_get() flush the firstline data - take a - * copy of the inserted text. */ + // Subsequent calls to ml_get() flush the firstline data - take a + // copy of the inserted text. if ((ins_text = alloc(ins_len + 1)) != NULL) { vim_strncpy(ins_text, firstline + bd.textcol, (size_t)ins_len); @@ -1781,8 +1777,8 @@ op_change(oparg_T *oap) { pos_T vpos; - /* If the block starts in virtual space, count the - * initial coladd offset as part of "startspaces" */ + // If the block starts in virtual space, count the + // initial coladd offset as part of "startspaces" if (bd.is_short) { vpos.lnum = linenr; @@ -1794,7 +1790,7 @@ op_change(oparg_T *oap) newp = alloc(STRLEN(oldp) + vpos.coladd + ins_len + 1); if (newp == NULL) continue; - /* copy up to block start */ + // copy up to block start mch_memmove(newp, oldp, (size_t)bd.textcol); offset = bd.textcol; vim_memset(newp + offset, ' ', (size_t)vpos.coladd); @@ -1829,14 +1825,14 @@ adjust_cursor_eol(void) && (ve_flags & VE_ONEMORE) == 0 && !(restart_edit || (State & INSERT))) { - /* Put the cursor on the last character in the line. */ + // Put the cursor on the last character in the line. dec_cursor(); if (ve_flags == VE_ALL) { colnr_T scol, ecol; - /* Coladd is set to the width of the last character. */ + // Coladd is set to the width of the last character. getvcol(curwin, &curwin->w_cursor, &scol, NULL, &ecol); curwin->w_cursor.coladd = ecol - scol + 1; } @@ -1869,9 +1865,8 @@ skip_comment( *is_comment = FALSE; if (leader_offset != -1) { - /* Let's check whether the line ends with an unclosed comment. - * If the last comment leader has COM_END in flags, there's no comment. - */ + // Let's check whether the line ends with an unclosed comment. + // If the last comment leader has COM_END in flags, there's no comment. while (*comment_flags) { if (*comment_flags == COM_END @@ -1891,11 +1886,10 @@ skip_comment( if (lead_len == 0) return line; - /* Find: - * - COM_END, - * - colon, - * whichever comes first. - */ + // Find: + // - COM_END, + // - colon, + // whichever comes first. while (*comment_flags) { if (*comment_flags == COM_END @@ -1904,10 +1898,9 @@ skip_comment( ++comment_flags; } - /* If we found a colon, it means that we are not processing a line - * starting with a closing part of a three-part comment. That's good, - * because we don't want to remove those as this would be annoying. - */ + // If we found a colon, it means that we are not processing a line + // starting with a closing part of a three-part comment. That's good, + // because we don't want to remove those as this would be annoying. if (*comment_flags == ':' || *comment_flags == NUL) line += lead_len; @@ -1936,11 +1929,11 @@ do_join( char_u *curr_start = NULL; char_u *cend; char_u *newp; - char_u *spaces; /* number of spaces inserted before a line */ + char_u *spaces; // number of spaces inserted before a line int endcurr1 = NUL; int endcurr2 = NUL; - int currsize = 0; /* size of the current line */ - int sumsize = 0; /* size of the long new line */ + int currsize = 0; // size of the current line + int sumsize = 0; // size of the long new line linenr_T t; colnr_T col = 0; int ret = OK; @@ -1957,9 +1950,9 @@ do_join( (linenr_T)(curwin->w_cursor.lnum + count)) == FAIL) return FAIL; - /* Allocate an array to store the number of spaces inserted before each - * line. We will use it to pre-compute the length of the new line and the - * proper placement of each original line in the new one. */ + // Allocate an array to store the number of spaces inserted before each + // line. We will use it to pre-compute the length of the new line and the + // proper placement of each original line in the new one. spaces = lalloc_clear(count, TRUE); if (spaces == NULL) return FAIL; @@ -1983,14 +1976,14 @@ do_join( curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t)); if (t == 0 && setmark && !cmdmod.lockmarks) { - /* Set the '[ mark. */ + // Set the '[ mark. curwin->w_buffer->b_op_start.lnum = curwin->w_cursor.lnum; curwin->w_buffer->b_op_start.col = (colnr_T)STRLEN(curr); } if (remove_comments) { - /* We don't want to remove the comment leader if the - * previous line is not a comment. */ + // We don't want to remove the comment leader if the + // previous line is not a comment. if (t > 0 && prev_was_comment) { @@ -2015,12 +2008,12 @@ do_join( || mb_ptr2char(curr) < 0x100 || endcurr1 < 0x100) ) { - /* don't add a space if the line is ending in a space */ + // don't add a space if the line is ending in a space if (endcurr1 == ' ') endcurr1 = endcurr2; else ++spaces[t]; - /* extra space when 'joinspaces' set and line ends in '.' */ + // extra space when 'joinspaces' set and line ends in '.' if ( p_js && (endcurr1 == '.' || (vim_strchr(p_cpo, CPO_JOINSP) == NULL @@ -2059,10 +2052,10 @@ do_join( } } - /* store the column position before last line */ + // store the column position before last line col = sumsize - currsize - spaces[count - 1]; - /* allocate the space for the new line */ + // allocate the space for the new line newp = alloc(sumsize + 1); if (newp == NULL) { @@ -2139,13 +2132,13 @@ do_join( if (setmark && !cmdmod.lockmarks) { - /* Set the '] mark. */ + // Set the '] mark. curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum; curwin->w_buffer->b_op_end.col = (colnr_T)sumsize; } - /* Only report the change in the first line here, del_lines() will report - * the deleted line. */ + // Only report the change in the first line here, del_lines() will report + // the deleted line. changed_lines(curwin->w_cursor.lnum, currsize, curwin->w_cursor.lnum + 1, 0L); /* @@ -2259,12 +2252,12 @@ same_leader( static void op_format( oparg_T *oap, - int keep_cursor) /* keep cursor on same text char */ + int keep_cursor) // keep cursor on same text char { long old_line_count = curbuf->b_ml.ml_line_count; - /* Place the cursor where the "gq" or "gw" command was given, so that "u" - * can put it back there. */ + // Place the cursor where the "gq" or "gw" command was given, so that "u" + // can put it back there. curwin->w_cursor = oap->cursor_start; if (u_save((linenr_T)(oap->start.lnum - 1), @@ -2273,15 +2266,15 @@ op_format( curwin->w_cursor = oap->start; if (oap->is_VIsual) - /* When there is no change: need to remove the Visual selection */ + // When there is no change: need to remove the Visual selection redraw_curbuf_later(INVERTED); if (!cmdmod.lockmarks) - /* Set '[ mark at the start of the formatted area */ + // Set '[ mark at the start of the formatted area curbuf->b_op_start = oap->start; - /* For "gw" remember the cursor position and put it back below (adjusted - * for joined and split lines). */ + // For "gw" remember the cursor position and put it back below (adjusted + // for joined and split lines). if (keep_cursor) saved_cursor = oap->cursor_start; @@ -2299,7 +2292,7 @@ op_format( msgmore(old_line_count); if (!cmdmod.lockmarks) - /* put '] mark on the end of the formatted area */ + // put '] mark on the end of the formatted area curbuf->b_op_end = curwin->w_cursor; if (keep_cursor) @@ -2316,8 +2309,8 @@ op_format( { if (wp->w_old_cursor_lnum != 0) { - /* When lines have been inserted or deleted, adjust the end of - * the Visual area to be redrawn. */ + // When lines have been inserted or deleted, adjust the end of + // the Visual area to be redrawn. if (wp->w_old_cursor_lnum > wp->w_old_visual_lnum) wp->w_old_cursor_lnum += old_line_count; else @@ -2335,12 +2328,12 @@ op_format( op_formatexpr(oparg_T *oap) { if (oap->is_VIsual) - /* When there is no change: need to remove the Visual selection */ + // When there is no change: need to remove the Visual selection redraw_curbuf_later(INVERTED); if (fex_format(oap->start.lnum, oap->line_count, NUL) != 0) - /* As documented: when 'formatexpr' returns non-zero fall back to - * internal formatting. */ + // As documented: when 'formatexpr' returns non-zero fall back to + // internal formatting. op_format(oap, FALSE); } @@ -2348,7 +2341,7 @@ op_formatexpr(oparg_T *oap) fex_format( linenr_T lnum, long count, - int c) /* character to be inserted */ + int c) // character to be inserted { int use_sandbox = was_set_insecurely((char_u *)"formatexpr", OPT_LOCAL); @@ -2363,7 +2356,7 @@ fex_format( set_vim_var_nr(VV_COUNT, count); set_vim_var_char(c); - /* Make a copy, the option could be changed while calling it. */ + // Make a copy, the option could be changed while calling it. fex = vim_strsave(curbuf->b_p_fex); if (fex == NULL) return 0; @@ -2393,37 +2386,37 @@ fex_format( void format_lines( linenr_T line_count, - int avoid_fex) /* don't use 'formatexpr' */ + int avoid_fex) // don't use 'formatexpr' { int max_len; - int is_not_par; /* current line not part of parag. */ - int next_is_not_par; /* next line not part of paragraph */ - int is_end_par; /* at end of paragraph */ - int prev_is_end_par = FALSE;/* prev. line not part of parag. */ + int is_not_par; // current line not part of parag. + int next_is_not_par; // next line not part of paragraph + int is_end_par; // at end of paragraph + int prev_is_end_par = FALSE;// prev. line not part of parag. int next_is_start_par = FALSE; - int leader_len = 0; /* leader len of current line */ - int next_leader_len; /* leader len of next line */ - char_u *leader_flags = NULL; /* flags for leader of current line */ - char_u *next_leader_flags; /* flags for leader of next line */ - int do_comments; /* format comments */ - int do_comments_list = 0; /* format comments with 'n' or '2' */ + int leader_len = 0; // leader len of current line + int next_leader_len; // leader len of next line + char_u *leader_flags = NULL; // flags for leader of current line + char_u *next_leader_flags; // flags for leader of next line + int do_comments; // format comments + int do_comments_list = 0; // format comments with 'n' or '2' int advance = TRUE; - int second_indent = -1; /* indent for second line (comment - * aware) */ + int second_indent = -1; // indent for second line (comment + // aware) int do_second_indent; int do_number_indent; int do_trail_white; int first_par_line = TRUE; int smd_save; long count; - int need_set_indent = TRUE; /* set indent of next paragraph */ + int need_set_indent = TRUE; // set indent of next paragraph int force_format = FALSE; int old_State = State; - /* length of a line to force formatting: 3 * 'tw' */ + // length of a line to force formatting: 3 * 'tw' max_len = comp_textwidth(TRUE) * 3; - /* check for 'q', '2' and '1' in 'formatoptions' */ + // check for 'q', '2' and '1' in 'formatoptions' do_comments = has_format_option(FO_Q_COMS); do_second_indent = has_format_option(FO_Q_SECOND); do_number_indent = has_format_option(FO_Q_NUMBER); @@ -2503,7 +2496,7 @@ format_lines( { if (leader_len == 0 && next_leader_len == 0) { - /* no comment found */ + // no comment found second_indent = get_indent_lnum(curwin->w_cursor.lnum + 1); } @@ -2517,13 +2510,13 @@ format_lines( { if (leader_len == 0 && next_leader_len == 0) { - /* no comment found */ + // no comment found second_indent = get_number_indent(curwin->w_cursor.lnum); } else { - /* get_number_indent() is now "comment aware"... */ + // get_number_indent() is now "comment aware"... second_indent = get_number_indent(curwin->w_cursor.lnum); do_comments_list = 1; @@ -2547,18 +2540,18 @@ format_lines( if (is_end_par || force_format) { if (need_set_indent) - /* replace indent in first line with minimal number of - * tabs and spaces, according to current options */ + // replace indent in first line with minimal number of + // tabs and spaces, according to current options (void)set_indent(get_indent(), SIN_CHANGED); - /* put cursor on last non-space */ - State = NORMAL; /* don't go past end-of-line */ + // put cursor on last non-space + State = NORMAL; // don't go past end-of-line coladvance((colnr_T)MAXCOL); while (curwin->w_cursor.col && vim_isspace(gchar_cursor())) dec_cursor(); - /* do the formatting, without 'showmode' */ - State = INSERT; /* for open_line() */ + // do the formatting, without 'showmode' + State = INSERT; // for open_line() smd_save = p_smd; p_smd = FALSE; insertchar(NUL, INSCHAR_FORMAT @@ -2569,12 +2562,12 @@ format_lines( State = old_State; p_smd = smd_save; second_indent = -1; - /* at end of par.: need to set indent of next par. */ + // at end of par.: need to set indent of next par. need_set_indent = is_end_par; if (is_end_par) { - /* When called with a negative line count, break at the - * end of the paragraph. */ + // When called with a negative line count, break at the + // end of the paragraph. if (line_count < 0) break; first_par_line = TRUE; @@ -2617,7 +2610,7 @@ format_lines( break; } first_par_line = FALSE; - /* If the line is getting long, format it next time */ + // If the line is getting long, format it next time if (STRLEN(ml_get_curline()) > (size_t)max_len) force_format = TRUE; else @@ -2639,8 +2632,8 @@ ends_in_white(linenr_T lnum) if (*s == NUL) return FALSE; - /* Don't use STRLEN() inside VIM_ISWHITE(), SAS/C complains: "macro - * invocation may call function multiple times". */ + // Don't use STRLEN() inside VIM_ISWHITE(), SAS/C complains: "macro + // invocation may call function multiple times". l = STRLEN(s) - 1; return VIM_ISWHITE(s[l]); } @@ -2660,7 +2653,7 @@ fmt_check_par( char_u **leader_flags, int do_comments) { - char_u *flags = NULL; /* init for GCC */ + char_u *flags = NULL; // init for GCC char_u *ptr; ptr = ml_get(lnum); @@ -2692,35 +2685,35 @@ fmt_check_par( paragraph_start(linenr_T lnum) { char_u *p; - int leader_len = 0; /* leader len of current line */ - char_u *leader_flags = NULL; /* flags for leader of current line */ - int next_leader_len; /* leader len of next line */ - char_u *next_leader_flags; /* flags for leader of next line */ - int do_comments; /* format comments */ + int leader_len = 0; // leader len of current line + char_u *leader_flags = NULL; // flags for leader of current line + int next_leader_len; // leader len of next line + char_u *next_leader_flags; // flags for leader of next line + int do_comments; // format comments if (lnum <= 1) - return TRUE; /* start of the file */ + return TRUE; // start of the file p = ml_get(lnum - 1); if (*p == NUL) - return TRUE; /* after empty line */ + return TRUE; // after empty line do_comments = has_format_option(FO_Q_COMS); if (fmt_check_par(lnum - 1, &leader_len, &leader_flags, do_comments)) - return TRUE; /* after non-paragraph line */ + return TRUE; // after non-paragraph line if (fmt_check_par(lnum, &next_leader_len, &next_leader_flags, do_comments)) - return TRUE; /* "lnum" is not a paragraph line */ + return TRUE; // "lnum" is not a paragraph line if (has_format_option(FO_WHITE_PAR) && !ends_in_white(lnum - 1)) - return TRUE; /* missing trailing space in previous line. */ + return TRUE; // missing trailing space in previous line. if (has_format_option(FO_Q_NUMBER) && (get_number_indent(lnum) > 0)) - return TRUE; /* numbered item starts in "lnum". */ + return TRUE; // numbered item starts in "lnum". if (!same_leader(lnum - 1, leader_len, leader_flags, next_leader_len, next_leader_flags)) - return TRUE; /* change of comment leader. */ + return TRUE; // change of comment leader. return FALSE; } @@ -2769,7 +2762,7 @@ block_prep( prev_pstart = line; while (bdp->start_vcol < oap->start_vcol && *pstart) { - /* 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) incr = lbr_chartabsize(line, pstart, (colnr_T)bdp->start_vcol); bdp->start_vcol += incr; if (VIM_ISWHITE(*pstart)) @@ -2786,7 +2779,7 @@ block_prep( MB_PTR_ADV(pstart); } bdp->start_char_vcols = incr; - if (bdp->start_vcol < oap->start_vcol) /* line too short */ + if (bdp->start_vcol < oap->start_vcol) // line too short { bdp->end_vcol = bdp->start_vcol; bdp->is_short = TRUE; @@ -2795,14 +2788,14 @@ block_prep( } else { - /* notice: this converts partly selected Multibyte characters to - * spaces, too. */ + // notice: this converts partly selected Multibyte characters to + // spaces, too. bdp->startspaces = bdp->start_vcol - oap->start_vcol; if (is_del && bdp->startspaces) bdp->startspaces = bdp->start_char_vcols - bdp->startspaces; pend = pstart; bdp->end_vcol = bdp->start_vcol; - if (bdp->end_vcol > oap->end_vcol) /* it's all in one character */ + if (bdp->end_vcol > oap->end_vcol) // it's all in one character { bdp->is_oneChar = TRUE; if (oap->op_type == OP_INSERT) @@ -2817,9 +2810,9 @@ block_prep( bdp->startspaces = oap->end_vcol - oap->start_vcol + 1; if (is_del && oap->op_type != OP_LSHIFT) { - /* just putting the sum of those two into - * bdp->startspaces doesn't work for Visual replace, - * so we have to split the tab in two */ + // just putting the sum of those two into + // bdp->startspaces doesn't work for Visual replace, + // so we have to split the tab in two bdp->startspaces = bdp->start_char_vcols - (bdp->start_vcol - oap->start_vcol); bdp->endspaces = bdp->end_vcol - oap->end_vcol - 1; @@ -2831,7 +2824,7 @@ block_prep( prev_pend = pend; while (bdp->end_vcol <= oap->end_vcol && *pend != 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) prev_pend = pend; incr = lbr_chartabsize_adv(line, &pend, (colnr_T)bdp->end_vcol); bdp->end_vcol += incr; @@ -2839,18 +2832,18 @@ block_prep( if (bdp->end_vcol <= oap->end_vcol && (!is_del || oap->op_type == OP_APPEND - || oap->op_type == OP_REPLACE)) /* line too short */ + || oap->op_type == OP_REPLACE)) // line too short { bdp->is_short = TRUE; - /* Alternative: include spaces to fill up the block. - * Disadvantage: can lead to trailing spaces when the line is - * short where the text is put */ - /* if (!is_del || oap->op_type == OP_APPEND) */ + // Alternative: include spaces to fill up the block. + // Disadvantage: can lead to trailing spaces when the line is + // short where the text is put + // if (!is_del || oap->op_type == OP_APPEND) if (oap->op_type == OP_APPEND || virtual_op) bdp->endspaces = oap->end_vcol - bdp->end_vcol + oap->inclusive; else - bdp->endspaces = 0; /* replace doesn't add characters */ + bdp->endspaces = 0; // replace doesn't add characters } else if (bdp->end_vcol > oap->end_vcol) { @@ -2878,8 +2871,8 @@ block_prep( void op_addsub( oparg_T *oap, - linenr_T Prenum1, /* Amount of add/subtract */ - int g_cmd) /* was g<c-a>/g<c-x> */ + linenr_T Prenum1, // Amount of add/subtract + int g_cmd) // was g<c-a>/g<c-x> { pos_T pos; struct block_def bd; @@ -2928,7 +2921,7 @@ op_addsub( pos = oap->start; for (; pos.lnum <= oap->end.lnum; ++pos.lnum) { - if (oap->block_mode) /* Visual block mode */ + if (oap->block_mode) // Visual block mode { block_prep(oap, &bd, pos.lnum, FALSE); pos.col = bd.textcol; @@ -2940,7 +2933,7 @@ op_addsub( pos.col = 0; length = (colnr_T)STRLEN(ml_get(pos.lnum)); } - else /* oap->motion_type == MCHAR */ + else // oap->motion_type == MCHAR { if (pos.lnum == oap->start.lnum && !oap->inclusive) dec(&(oap->end)); @@ -2962,7 +2955,7 @@ op_addsub( one_change = do_addsub(oap->op_type, &pos, length, amount); if (one_change) { - /* Remember the start position of the first change. */ + // Remember the start position of the first change. if (change_cnt == 0) startpos = curbuf->b_op_start; ++change_cnt; @@ -2989,11 +2982,11 @@ op_addsub( changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L); if (!change_cnt && oap->is_VIsual) - /* No change: need to remove the Visual selection */ + // No change: need to remove the Visual selection redraw_curbuf_later(INVERTED); - /* Set '[ mark if something changed. Keep the last end - * position from do_addsub(). */ + // Set '[ mark if something changed. Keep the last end + // position from do_addsub(). if (change_cnt > 0 && !cmdmod.lockmarks) curbuf->b_op_start = startpos; @@ -3019,8 +3012,8 @@ do_addsub( int col; char_u *buf1; char_u buf2[NUMBUFLEN]; - int pre; /* 'X'/'x': hex; '0': octal; 'B'/'b': bin */ - static int hexupper = FALSE; /* 0xABC */ + int pre; // 'X'/'x': hex; '0': octal; 'B'/'b': bin + static int hexupper = FALSE; // 0xABC uvarnumber_T n; uvarnumber_T oldn; char_u *ptr; @@ -3085,7 +3078,7 @@ do_addsub( && vim_isxdigit(ptr[col + 1])))) { - /* In case of binary/hexadecimal pattern overlap match, rescan */ + // In case of binary/hexadecimal pattern overlap match, rescan col = pos->col; @@ -3114,7 +3107,7 @@ do_addsub( !(*mb_head_off)(ptr, ptr + col - 1)) && vim_isbdigit(ptr[col + 1]))) { - /* Found hexadecimal or binary number, move to its start. */ + // Found hexadecimal or binary number, move to its start. --col; if (has_mbyte) col -= (*mb_head_off)(ptr, ptr + col); @@ -3177,7 +3170,7 @@ do_addsub( if (doalp && ASCII_ISALPHA(firstdigit)) { - /* decrement or increment alphabetic character */ + // decrement or increment alphabetic character if (op_type == OP_NR_SUB) { if (CharOrd(firstdigit) < Prenum1) @@ -3226,11 +3219,11 @@ do_addsub( !(*mb_head_off)(ptr, ptr + col - 1)) && !visual) { - /* negative number */ + // negative number --col; negative = TRUE; } - /* get the number value (unsigned) */ + // get the number value (unsigned) if (visual && VIsual_mode != 'V') maxlen = (curbuf->b_visual.vi_curswant == MAXCOL ? (int)STRLEN(ptr) - col @@ -3242,14 +3235,14 @@ do_addsub( + (dohex ? STR2NR_HEX : 0), NULL, &n, maxlen, FALSE); - /* ignore leading '-' for hex and octal and bin numbers */ + // ignore leading '-' for hex and octal and bin numbers if (pre && negative) { ++col; --length; negative = FALSE; } - /* add or subtract */ + // add or subtract subtract = FALSE; if (op_type == OP_NR_SUB) subtract ^= TRUE; @@ -3261,7 +3254,7 @@ do_addsub( n -= (uvarnumber_T)Prenum1; else n += (uvarnumber_T)Prenum1; - /* handle wraparound for decimal numbers */ + // handle wraparound for decimal numbers if (!pre) { if (subtract) @@ -3274,7 +3267,7 @@ do_addsub( } else { - /* add */ + // add if (n < oldn) { n = (n ^ (uvarnumber_T)-1); @@ -3287,7 +3280,7 @@ do_addsub( if (visual && !was_positive && !negative && col > 0) { - /* need to remove the '-' */ + // need to remove the '-' col--; length++; } @@ -3316,7 +3309,7 @@ do_addsub( else hexupper = FALSE; } - /* del_char() will mark line needing displaying */ + // del_char() will mark line needing displaying (void)del_char(FALSE); c = gchar_cursor(); } @@ -3353,7 +3346,7 @@ do_addsub( int bit = 0; int bits = sizeof(uvarnumber_T) * 8; - /* leading zeros */ + // leading zeros for (bit = bits; bit > 0; bit--) if ((n >> (bit - 1)) & 0x1) break; @@ -3387,7 +3380,7 @@ do_addsub( *ptr++ = '0'; *ptr = NUL; STRCAT(buf1, buf2); - ins_str(buf1); /* insert the new number */ + ins_str(buf1); // insert the new number vim_free(buf1); endpos = curwin->w_cursor; if (did_change && curwin->w_cursor.col) @@ -3396,7 +3389,7 @@ do_addsub( if (did_change && !cmdmod.lockmarks) { - /* set the '[ and '] marks */ + // set the '[ and '] marks curbuf->b_op_start = startpos; curbuf->b_op_end = endpos; if (curbuf->b_op_end.col > 0) @@ -3460,22 +3453,21 @@ x11_export_final_selection(void) return; # endif - /* Get selection to export */ + // Get selection to export if (clip_plus.owned) motion_type = clip_convert_selection(&str, &len, &clip_plus); else if (clip_star.owned) motion_type = clip_convert_selection(&str, &len, &clip_star); - /* Check it's OK */ + // Check it's OK if (dpy != NULL && str != NULL && motion_type >= 0 && len < 1024*1024 && len > 0) { int ok = TRUE; - /* The CUT_BUFFER0 is supposed to always contain latin1. Convert from - * 'enc' when it is a multi-byte encoding. When 'enc' is an 8-bit - * encoding conversion usually doesn't work, so keep the text as-is. - */ + // The CUT_BUFFER0 is supposed to always contain latin1. Convert from + // 'enc' when it is a multi-byte encoding. When 'enc' is an 8-bit + // encoding conversion usually doesn't work, so keep the text as-is. if (has_mbyte) { vimconv_T vc; @@ -3506,8 +3498,8 @@ x11_export_final_selection(void) } } - /* Do not store the string if conversion failed. Better to use any - * other selection than garbled text. */ + // Do not store the string if conversion failed. Better to use any + // other selection than garbled text. if (ok) { XStoreBuffer(dpy, (char *)str, (int)len, 0); @@ -3518,7 +3510,7 @@ x11_export_final_selection(void) vim_free(str); } #endif -#endif /* FEAT_CLIPBOARD || PROTO */ +#endif // FEAT_CLIPBOARD || PROTO void clear_oparg(oparg_T *oap) @@ -3573,7 +3565,7 @@ line_count_info( words++; *wc += words; - /* Add eol_size if the end of line was reached before hitting limit. */ + // Add eol_size if the end of line was reached before hitting limit. if (i < limit && line[i] == NUL) { i += eol_size; @@ -3649,7 +3641,7 @@ cursor_pos_info(dict_T *dict) char_u * saved_sbr = p_sbr; char_u * saved_w_sbr = curwin->w_p_sbr; - /* Make 'sbr' empty for a moment to get the correct size. */ + // Make 'sbr' empty for a moment to get the correct size. p_sbr = empty_option; curwin->w_p_sbr = empty_option; #endif @@ -3664,7 +3656,7 @@ cursor_pos_info(dict_T *dict) #endif if (curwin->w_curswant == MAXCOL) oparg.end_vcol = MAXCOL; - /* Swap the start, end vcol if needed */ + // Swap the start, end vcol if needed if (oparg.end_vcol < oparg.start_vcol) { oparg.end_vcol += oparg.start_vcol; @@ -3677,7 +3669,7 @@ cursor_pos_info(dict_T *dict) for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) { - /* Check for a CTRL-C every 100000 characters. */ + // Check for a CTRL-C every 100000 characters. if (byte_count > last_check) { ui_breakcheck(); @@ -3686,7 +3678,7 @@ cursor_pos_info(dict_T *dict) last_check = byte_count + 100000L; } - /* Do extra processing for VIsual mode. */ + // Do extra processing for VIsual mode. if (VIsual_active && lnum >= min_pos.lnum && lnum <= max_pos.lnum) { @@ -3731,7 +3723,7 @@ cursor_pos_info(dict_T *dict) } else { - /* In non-visual mode, check for the line the cursor is on */ + // In non-visual mode, check for the line the cursor is on if (lnum == curwin->w_cursor.lnum) { word_count_cursor += word_count; @@ -3743,13 +3735,13 @@ cursor_pos_info(dict_T *dict) eol_size); } } - /* Add to the running totals */ + // Add to the running totals byte_count += line_count_info(ml_get(lnum), &word_count, &char_count, (varnumber_T)MAXCOL, eol_size); } - /* Correction for when last line doesn't have an EOL. */ + // Correction for when last line doesn't have an EOL. if (!curbuf->b_p_eol && (curbuf->b_p_bin || !curbuf->b_p_fixeol)) byte_count -= eol_size; @@ -4328,7 +4320,8 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) if (cap->cmdchar == 'g' && (cap->nchar == 'n' || cap->nchar == 'N')) prep_redo(oap->regname, cap->count0, - get_op_char(oap->op_type), get_extra_op_char(oap->op_type), + get_op_char(oap->op_type), + get_extra_op_char(oap->op_type), oap->motion_force, cap->cmdchar, cap->nchar); else if (cap->cmdchar != ':') { diff --git a/src/option.c b/src/option.c index 1ccb5d9ec..5c99c6966 100644 --- a/src/option.c +++ b/src/option.c @@ -81,10 +81,10 @@ set_init_1(int clean_arg) langmap_init(); #endif - /* Be Vi compatible by default */ + // Be Vi compatible by default p_cp = TRUE; - /* Use POSIX compatibility when $VIM_POSIX is set. */ + // Use POSIX compatibility when $VIM_POSIX is set. if (mch_getenv((char_u *)"VIM_POSIX") != NULL) { set_string_default("cpo", (char_u *)CPO_ALL); @@ -156,7 +156,7 @@ set_init_1(int clean_arg) p = vim_getenv((char_u *)names[n], &mustfree); if (p != NULL && *p != NUL) { - /* First time count the NUL, otherwise count the ','. */ + // First time count the NUL, otherwise count the ','. len = (int)STRLEN(p) + 3; if (ga_grow(&ga, len) == OK) { @@ -190,11 +190,11 @@ set_init_1(int clean_arg) #endif { #ifdef HAVE_AVAIL_MEM - /* Use amount of memory available at this moment. */ + // Use amount of memory available at this moment. n = (mch_avail_mem(FALSE) >> 1); #else # ifdef HAVE_TOTAL_MEM - /* Use amount of memory available to Vim. */ + // Use amount of memory available to Vim. n = (mch_total_mem(FALSE) >> 1); # else n = (0x7fffffff >> 11); @@ -221,14 +221,14 @@ set_init_1(int clean_arg) int j; int mustfree = FALSE; - /* Initialize the 'cdpath' option's default value. */ + // Initialize the 'cdpath' option's default value. cdpath = vim_getenv((char_u *)"CDPATH", &mustfree); if (cdpath != NULL) { buf = alloc((STRLEN(cdpath) << 1) + 2); if (buf != NULL) { - buf[0] = ','; /* start with ",", current dir first */ + buf[0] = ','; // start with ",", current dir first j = 1; for (i = 0; cdpath[i] != NUL; ++i) { @@ -249,7 +249,7 @@ set_init_1(int clean_arg) options[opt_idx].flags |= P_DEF_ALLOCED; } else - vim_free(buf); /* cannot happen */ + vim_free(buf); // cannot happen } if (mustfree) vim_free(cdpath); @@ -258,7 +258,7 @@ set_init_1(int clean_arg) #endif #if defined(FEAT_POSTSCRIPT) && (defined(MSWIN) || defined(VMS) || defined(EBCDIC) || defined(MAC) || defined(hpux)) - /* Set print encoding on platforms that don't default to latin1 */ + // Set print encoding on platforms that don't default to latin1 set_string_default("penc", # if defined(MSWIN) (char_u *)"cp1252" @@ -271,7 +271,7 @@ set_init_1(int clean_arg) # else # ifdef MAC (char_u *)"mac-roman" -# else /* HPUX */ +# else // HPUX (char_u *)"hp-roman8" # endif # endif @@ -281,7 +281,7 @@ set_init_1(int clean_arg) #endif #ifdef FEAT_POSTSCRIPT - /* 'printexpr' must be allocated to be able to evaluate it. */ + // 'printexpr' must be allocated to be able to evaluate it. set_string_default("pexpr", # if defined(MSWIN) (char_u *)"system('copy' . ' ' . v:fname_in . (&printdevice == '' ? ' LPT1:' : (' \"' . &printdevice . '\"'))) . delete(v:fname_in)" @@ -326,18 +326,18 @@ set_init_1(int clean_arg) #endif curbuf->b_p_initialized = TRUE; - curbuf->b_p_ar = -1; /* no local 'autoread' value */ + curbuf->b_p_ar = -1; // no local 'autoread' value curbuf->b_p_ul = NO_LOCAL_UNDOLEVEL; check_buf_options(curbuf); check_win_options(curwin); check_options(); - /* Must be before option_expand(), because that one needs vim_isIDc() */ + // Must be before option_expand(), because that one needs vim_isIDc() didset_options(); #ifdef FEAT_SPELL - /* Use the current chartab for the generic chartab. This is not in - * didset_options() because it only depends on 'encoding'. */ + // Use the current chartab for the generic chartab. This is not in + // didset_options() because it only depends on 'encoding'. init_spell_chartab(); #endif @@ -360,11 +360,10 @@ set_init_1(int clean_arg) if (p != NULL && (p = vim_strsave(p)) != NULL) { *(char_u **)options[opt_idx].var = p; - /* VIMEXP - * Defaults for all expanded options are currently the same for Vi - * and Vim. When this changes, add some code here! Also need to - * split P_DEF_ALLOCED in two. - */ + // VIMEXP + // Defaults for all expanded options are currently the same for Vi + // and Vim. When this changes, add some code here! Also need to + // split P_DEF_ALLOCED in two. if (options[opt_idx].flags & P_DEF_ALLOCED) vim_free(options[opt_idx].def_val[VI_DEFAULT]); options[opt_idx].def_val[VI_DEFAULT] = p; @@ -372,15 +371,14 @@ set_init_1(int clean_arg) } } - save_file_ff(curbuf); /* Buffer is unchanged */ + save_file_ff(curbuf); // Buffer is unchanged #if defined(FEAT_ARABIC) - /* Detect use of mlterm. - * Mlterm is a terminal emulator akin to xterm that has some special - * abilities (bidi namely). - * NOTE: mlterm's author is being asked to 'set' a variable - * instead of an environment variable due to inheritance. - */ + // Detect use of mlterm. + // Mlterm is a terminal emulator akin to xterm that has some special + // abilities (bidi namely). + // NOTE: mlterm's author is being asked to 'set' a variable + // instead of an environment variable due to inheritance. if (mch_getenv((char_u *)"MLTERM") != NULL) set_option_value((char_u *)"tbidi", 1L, NULL, 0); #endif @@ -396,14 +394,14 @@ set_init_1(int clean_arg) { char buf[20]; - /* Could use LOCALE_SISO639LANGNAME, but it's not in Win95. - * LOCALE_SABBREVLANGNAME gives us three letters, like "enu", we use - * only the first two. */ + // Could use LOCALE_SISO639LANGNAME, but it's not in Win95. + // LOCALE_SABBREVLANGNAME gives us three letters, like "enu", we use + // only the first two. n = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME, (LPTSTR)buf, 20); if (n >= 2 && STRNICMP(buf, "en", 2) != 0) { - /* There are a few exceptions (probably more) */ + // There are a few exceptions (probably more) if (STRNICMP(buf, "cht", 3) == 0 || STRNICMP(buf, "zht", 3) == 0) STRCPY(buf, "zh_TW"); else if (STRNICMP(buf, "chs", 3) == 0 @@ -412,32 +410,32 @@ set_init_1(int clean_arg) else if (STRNICMP(buf, "jp", 2) == 0) STRCPY(buf, "ja"); else - buf[2] = NUL; /* truncate to two-letter code */ + buf[2] = NUL; // truncate to two-letter code vim_setenv((char_u *)"LANG", (char_u *)buf); } } # else # ifdef MACOS_CONVERT - /* Moved to os_mac_conv.c to avoid dependency problems. */ + // Moved to os_mac_conv.c to avoid dependency problems. mac_lang_init(); # endif # endif - /* enc_locale() will try to find the encoding of the current locale. */ + // enc_locale() will try to find the encoding of the current locale. p = enc_locale(); if (p != NULL) { char_u *save_enc; - /* Try setting 'encoding' and check if the value is valid. - * If not, go back to the default "latin1". */ + // Try setting 'encoding' and check if the value is valid. + // If not, go back to the default "latin1". save_enc = p_enc; p_enc = p; if (STRCMP(p_enc, "gb18030") == 0) { - /* We don't support "gb18030", but "cp936" is a good substitute - * for practical purposes, thus use that. It's not an alias to - * still support conversion between gb18030 and utf-8. */ + // We don't support "gb18030", but "cp936" is a good substitute + // for practical purposes, thus use that. It's not an alias to + // still support conversion between gb18030 and utf-8. p_enc = vim_strsave((char_u *)"cp936"); vim_free(p); } @@ -453,9 +451,9 @@ set_init_1(int clean_arg) #if defined(MSWIN) || defined(MACOS_X) || defined(VMS) if (STRCMP(p_enc, "latin1") == 0 || enc_utf8) { - /* Adjust the default for 'isprint' and 'iskeyword' to match - * latin1. Also set the defaults for when 'nocompatible' is - * set. */ + // Adjust the default for 'isprint' and 'iskeyword' to match + // latin1. Also set the defaults for when 'nocompatible' is + // set. set_string_option_direct((char_u *)"isp", -1, ISP_LATIN1, OPT_FREE, SID_NONE); set_string_option_direct((char_u *)"isk", -1, @@ -471,8 +469,8 @@ set_init_1(int clean_arg) #endif #if defined(MSWIN) && (!defined(FEAT_GUI) || defined(VIMDLL)) - /* Win32 console: When GetACP() returns a different value from - * GetConsoleCP() set 'termencoding'. */ + // Win32 console: When GetACP() returns a different value from + // GetConsoleCP() set 'termencoding'. if ( # ifdef VIMDLL (!gui.in_use && !gui.starting) && @@ -481,8 +479,8 @@ set_init_1(int clean_arg) { char buf[50]; - /* Win32 console: In ConPTY, GetConsoleCP() returns zero. - * Use an alternative value. */ + // Win32 console: In ConPTY, GetConsoleCP() returns zero. + // Use an alternative value. if (GetConsoleCP() == 0) sprintf(buf, "cp%ld", (long)GetACP()); else @@ -504,7 +502,7 @@ set_init_1(int clean_arg) } #endif #if defined(MSWIN) - /* $HOME may have characters in active code page. */ + // $HOME may have characters in active code page. init_homedir(); #endif } @@ -516,7 +514,7 @@ set_init_1(int clean_arg) } #ifdef FEAT_MULTI_LANG - /* Set the default for 'helplang'. */ + // Set the default for 'helplang'. set_helplang_default(get_mess_lang()); #endif } @@ -528,24 +526,24 @@ set_init_1(int clean_arg) static void set_option_default( int opt_idx, - int opt_flags, /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */ - int compatible) /* use Vi default value */ + int opt_flags, // OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL + int compatible) // use Vi default value { - char_u *varp; /* pointer to variable for current option */ - int dvi; /* index in def_val[] */ + char_u *varp; // pointer to variable for current option + int dvi; // index in def_val[] long_u flags; long_u *flagsp; int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0; varp = get_varp_scope(&(options[opt_idx]), both ? OPT_LOCAL : opt_flags); flags = options[opt_idx].flags; - if (varp != NULL) /* skip hidden option, nothing to do for it */ + if (varp != NULL) // skip hidden option, nothing to do for it { dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT; if (flags & P_STRING) { - /* Use set_string_option_direct() for local options to handle - * freeing and allocating the value. */ + // Use set_string_option_direct() for local options to handle + // freeing and allocating the value. if (options[opt_idx].indir != PV_NONE) set_string_option_direct(NULL, opt_idx, options[opt_idx].def_val[dvi], opt_flags, 0); @@ -572,29 +570,29 @@ set_option_default( *(long *)varp = -1; else *(long *)varp = def_val; - /* May also set global value for local option. */ + // May also set global value for local option. if (both) *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = def_val; } } - else /* P_BOOL */ + else // P_BOOL { - /* the cast to long is required for Manx C, long_i is needed for - * MSVC */ + // the cast to long is required for Manx C, long_i is needed for + // MSVC *(int *)varp = (int)(long)(long_i)options[opt_idx].def_val[dvi]; #ifdef UNIX - /* 'modeline' defaults to off for root */ + // 'modeline' defaults to off for root if (options[opt_idx].indir == PV_ML && getuid() == ROOT_UID) *(int *)varp = FALSE; #endif - /* May also set global value for local option. */ + // May also set global value for local option. if (both) *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = *(int *)varp; } - /* The default value is not insecure. */ + // The default value is not insecure. flagsp = insecure_flag(opt_idx, opt_flags); *flagsp = *flagsp & ~P_INSECURE; } @@ -610,7 +608,7 @@ set_option_default( */ static void set_options_default( - int opt_flags) /* OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL */ + int opt_flags) // OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL { int i; win_T *wp; @@ -627,7 +625,7 @@ set_options_default( ))) set_option_default(i, opt_flags, p_cp); - /* The 'scroll' option must be computed for all windows. */ + // The 'scroll' option must be computed for all windows. FOR_ALL_TAB_WINDOWS(tp, wp) win_comp_scroll(wp); #ifdef FEAT_CINDENT @@ -650,7 +648,7 @@ set_string_default_esc(char *name, char_u *val, int escape) p = vim_strsave_escaped(val, (char_u *)" "); else p = vim_strsave(val); - if (p != NULL) /* we don't want a NULL */ + if (p != NULL) // we don't want a NULL { opt_idx = findoption((char_u *)name); if (opt_idx >= 0) @@ -728,7 +726,7 @@ free_all_options(void) { if (options[i].indir == PV_NONE) { - /* global option: free value and default value. */ + // global option: free value and default value. if ((options[i].flags & P_ALLOCED) && options[i].var != NULL) free_string_option(*(char_u **)options[i].var); if (options[i].flags & P_DEF_ALLOCED) @@ -736,7 +734,7 @@ free_all_options(void) } else if (options[i].var != VAR_WIN && (options[i].flags & P_STRING)) - /* buffer-local option: free global value */ + // buffer-local option: free global value free_string_option(*(char_u **)options[i].var); } } @@ -769,7 +767,7 @@ set_init_2(void) p_window = Rows - 1; set_number_default("window", Rows - 1); - /* For DOS console the default is always black. */ + // For DOS console the default is always black. #if !((defined(MSWIN)) && !defined(FEAT_GUI)) /* * If 'background' wasn't set by the user, try guessing the value, @@ -781,20 +779,20 @@ set_init_2(void) && *term_bg_default() == 'd') { set_string_option_direct(NULL, idx, (char_u *)"dark", OPT_FREE, 0); - /* don't mark it as set, when starting the GUI it may be - * changed again */ + // don't mark it as set, when starting the GUI it may be + // changed again options[idx].flags &= ~P_WAS_SET; } #endif #ifdef CURSOR_SHAPE - parse_shape_opt(SHAPE_CURSOR); /* set cursor shapes from 'guicursor' */ + parse_shape_opt(SHAPE_CURSOR); // set cursor shapes from 'guicursor' #endif #ifdef FEAT_MOUSESHAPE - parse_shape_opt(SHAPE_MOUSE); /* set mouse shapes from 'mouseshape' */ + parse_shape_opt(SHAPE_MOUSE); // set mouse shapes from 'mouseshape' #endif #ifdef FEAT_PRINTER - (void)parse_printoptions(); /* parse 'printoptions' default value */ + (void)parse_printoptions(); // parse 'printoptions' default value #endif } @@ -863,7 +861,7 @@ set_init_3(void) } } else - /* Always use bourne shell style redirection if we reach this */ + // Always use bourne shell style redirection if we reach this if ( fnamecmp(p, "sh") == 0 || fnamecmp(p, "ksh") == 0 || fnamecmp(p, "mksh") == 0 @@ -926,7 +924,7 @@ set_init_3(void) options[idx3].def_val[VI_DEFAULT] = p_shcf; } - /* Somehow Win32 requires the quotes around the redirection too */ + // Somehow Win32 requires the quotes around the redirection too idx3 = findoption((char_u *)"sxq"); if (idx3 >= 0 && !(options[idx3].flags & P_WAS_SET)) { @@ -971,7 +969,7 @@ set_init_3(void) { int idx_ffs = findoption((char_u *)"ffs"); - /* Apply the first entry of 'fileformats' to the initial buffer. */ + // Apply the first entry of 'fileformats' to the initial buffer. if (idx_ffs >= 0 && (options[idx_ffs].flags & P_WAS_SET)) set_fileformat(default_fileformat(), OPT_LOCAL); } @@ -991,7 +989,7 @@ set_helplang_default(char_u *lang) { int idx; - if (lang == NULL || STRLEN(lang) < 2) /* safety check */ + if (lang == NULL || STRLEN(lang) < 2) // safety check return; idx = findoption((char_u *)"hlg"); if (idx >= 0 && !(options[idx].flags & P_WAS_SET)) @@ -1085,26 +1083,26 @@ set_title_defaults(void) */ int do_set( - char_u *arg, /* option string (may be written to!) */ + char_u *arg, // option string (may be written to!) int opt_flags) { int opt_idx; char *errmsg; char errbuf[80]; char_u *startarg; - int prefix; /* 1: nothing, 0: "no", 2: "inv" in front of name */ - int nextchar; /* next non-white char after option name */ - int afterchar; /* character just after option name */ + int prefix; // 1: nothing, 0: "no", 2: "inv" in front of name + int nextchar; // next non-white char after option name + int afterchar; // character just after option name int len; int i; varnumber_T value; int key; - long_u flags; /* flags for current option */ - char_u *varp = NULL; /* pointer to variable for current option */ - int did_show = FALSE; /* already showed one value */ - int adding; /* "opt+=arg" */ - int prepending; /* "opt^=arg" */ - int removing; /* "opt-=arg" */ + long_u flags; // flags for current option + char_u *varp = NULL; // pointer to variable for current option + int did_show = FALSE; // already showed one value + int adding; // "opt+=arg" + int prepending; // "opt^=arg" + int removing; // "opt-=arg" int cp_val = 0; char_u key_name[2]; @@ -1115,10 +1113,10 @@ do_set( goto theend; } - while (*arg != NUL) /* loop to process all options */ + while (*arg != NUL) // loop to process all options { errmsg = NULL; - startarg = arg; /* remember for error message */ + startarg = arg; // remember for error message if (STRNCMP(arg, "all", 3) == 0 && !isalpha(arg[3]) && !(opt_flags & OPT_MODELINE)) @@ -1131,7 +1129,7 @@ do_set( if (*arg == '&') { ++arg; - /* Only for :set command set global value of local options. */ + // Only for :set command set global value of local options. set_options_default(OPT_FREE | opt_flags); didset_options(); didset_options2(); @@ -1164,12 +1162,12 @@ do_set( arg += 3; } - /* find end of name */ + // find end of name key = 0; if (*arg == '<') { opt_idx = -1; - /* look out for <t_>;> */ + // look out for <t_>;> if (arg[1] == 't' && arg[2] == '_' && arg[3] && arg[4]) len = 5; else @@ -1183,10 +1181,10 @@ do_set( errmsg = e_invarg; goto skip; } - arg[len] = NUL; /* put NUL after name */ - if (arg[1] == 't' && arg[2] == '_') /* could be term code */ + arg[len] = NUL; // put NUL after name + if (arg[1] == 't' && arg[2] == '_') // could be term code opt_idx = findoption(arg + 1); - arg[len++] = '>'; /* restore '>' */ + arg[len++] = '>'; // restore '>' if (opt_idx == -1) key = find_key_option(arg + 1, TRUE); } @@ -1202,17 +1200,17 @@ do_set( while (ASCII_ISALNUM(arg[len]) || arg[len] == '_') ++len; nextchar = arg[len]; - arg[len] = NUL; /* put NUL after name */ + arg[len] = NUL; // put NUL after name opt_idx = findoption(arg); - arg[len] = nextchar; /* restore nextchar */ + arg[len] = nextchar; // restore nextchar if (opt_idx == -1) key = find_key_option(arg, FALSE); } - /* remember character after option name */ + // remember character after option name afterchar = arg[len]; - /* skip white space, allow ":set ai ?" */ + // skip white space, allow ":set ai ?" while (VIM_ISWHITE(arg[len])) ++len; @@ -1223,23 +1221,23 @@ do_set( { if (arg[len] == '+') { - adding = TRUE; /* "+=" */ + adding = TRUE; // "+=" ++len; } else if (arg[len] == '^') { - prepending = TRUE; /* "^=" */ + prepending = TRUE; // "^=" ++len; } else if (arg[len] == '-') { - removing = TRUE; /* "-=" */ + removing = TRUE; // "-=" ++len; } } nextchar = arg[len]; - if (opt_idx == -1 && key == 0) /* found a mismatch: skip */ + if (opt_idx == -1 && key == 0) // found a mismatch: skip { errmsg = N_("E518: Unknown option"); goto skip; @@ -1247,10 +1245,10 @@ do_set( if (opt_idx >= 0) { - if (options[opt_idx].var == NULL) /* hidden option: skip */ + if (options[opt_idx].var == NULL) // hidden option: skip { - /* Only give an error message when requesting the value of - * a hidden option, ignore setting it. */ + // Only give an error message when requesting the value of + // a hidden option, ignore setting it. if (vim_strchr((char_u *)"=:!&<", nextchar) == NULL && (!(options[opt_idx].flags & P_BOOL) || nextchar == '?')) @@ -1276,18 +1274,18 @@ do_set( } } - /* Skip all options that are not window-local (used when showing - * an already loaded buffer in a window). */ + // Skip all options that are not window-local (used when showing + // an already loaded buffer in a window). if ((opt_flags & OPT_WINONLY) && (opt_idx < 0 || options[opt_idx].var != VAR_WIN)) goto skip; - /* Skip all options that are window-local (used for :vimgrep). */ + // Skip all options that are window-local (used for :vimgrep). if ((opt_flags & OPT_NOWIN) && opt_idx >= 0 && options[opt_idx].var == VAR_WIN) goto skip; - /* Disallow changing some options from modelines. */ + // Disallow changing some options from modelines. if (opt_flags & OPT_MODELINE) { if (flags & (P_SECURE | P_NO_ML)) @@ -1301,11 +1299,11 @@ do_set( goto skip; } #ifdef FEAT_DIFF - /* In diff mode some options are overruled. This avoids that - * 'foldmethod' becomes "marker" instead of "diff" and that - * "wrap" gets set. */ + // In diff mode some options are overruled. This avoids that + // 'foldmethod' becomes "marker" instead of "diff" and that + // "wrap" gets set. if (curwin->w_p_diff - && opt_idx >= 0 /* shut up coverity warning */ + && opt_idx >= 0 // shut up coverity warning && ( #ifdef FEAT_FOLDING options[opt_idx].indir == PV_FDM || @@ -1316,7 +1314,7 @@ do_set( } #ifdef HAVE_SANDBOX - /* Disallow changing some options in the sandbox */ + // Disallow changing some options in the sandbox if (sandbox != 0 && (flags & P_SECURE)) { errmsg = _(e_sandbox); @@ -1330,12 +1328,12 @@ do_set( cp_val = p_cp; if (nextchar == '&' && arg[1] == 'v' && arg[2] == 'i') { - if (arg[3] == 'm') /* "opt&vim": set to Vim default */ + if (arg[3] == 'm') // "opt&vim": set to Vim default { cp_val = FALSE; arg += 3; } - else /* "opt&vi": set to Vi default */ + else // "opt&vi": set to Vi default { cp_val = TRUE; arg += 2; @@ -1362,11 +1360,11 @@ do_set( * print value */ if (did_show) - msg_putchar('\n'); /* cursor below last one */ + msg_putchar('\n'); // cursor below last one else { - gotocmdline(TRUE); /* cursor at status line */ - did_show = TRUE; /* remember that we did a line */ + gotocmdline(TRUE); // cursor at status line + did_show = TRUE; // remember that we did a line } if (opt_idx >= 0) { @@ -1374,7 +1372,7 @@ do_set( #ifdef FEAT_EVAL if (p_verbose > 0) { - /* Mention where the option was last set. */ + // Mention where the option was last set. if (varp == options[opt_idx].var) last_set_msg(options[opt_idx].script_ctx); else if ((int)options[opt_idx].indir & PV_WIN) @@ -1408,7 +1406,7 @@ do_set( int value_is_replaced = !prepending && !adding && !removing; int value_checked = FALSE; - if (flags & P_BOOL) /* boolean */ + if (flags & P_BOOL) // boolean { if (nextchar == '=' || nextchar == ':') { @@ -1429,7 +1427,7 @@ do_set( ? VI_DEFAULT : VIM_DEFAULT]; else if (nextchar == '<') { - /* For 'autoread' -1 means to use global value. */ + // For 'autoread' -1 means to use global value. if ((int *)varp == &curbuf->b_p_ar && opt_flags == OPT_LOCAL) value = -1; @@ -1448,7 +1446,7 @@ do_set( errmsg = e_trailing; goto skip; } - if (prefix == 2) /* inv */ + if (prefix == 2) // inv value = *(int *)(varp) ^ 1; else value = prefix; @@ -1457,7 +1455,7 @@ do_set( errmsg = set_bool_option(opt_idx, varp, (int)value, opt_flags); } - else /* numeric or string */ + else // numeric or string { if (vim_strchr((char_u *)"=:&<", nextchar) == NULL || prefix != 1) @@ -1466,7 +1464,7 @@ do_set( goto skip; } - if (flags & P_NUM) /* numeric */ + if (flags & P_NUM) // numeric { /* * Different ways to set a number option: @@ -1484,8 +1482,8 @@ do_set( ? VI_DEFAULT : VIM_DEFAULT]; else if (nextchar == '<') { - /* For 'undolevels' NO_LOCAL_UNDOLEVEL means to - * use the global value. */ + // For 'undolevels' NO_LOCAL_UNDOLEVEL means to + // use the global value. if ((long *)varp == &curbuf->b_p_ul && opt_flags == OPT_LOCAL) value = NO_LOCAL_UNDOLEVEL; @@ -1510,8 +1508,8 @@ do_set( } else if (*arg == '-' || VIM_ISDIGIT(*arg)) { - /* Allow negative (for 'undolevels'), octal and - * hex numbers. */ + // Allow negative (for 'undolevels'), octal and + // hex numbers. vim_str2nr(arg, NULL, &i, STR2NR_ALL, &value, NULL, 0, TRUE); if (i == 0 || (arg[i] != NUL @@ -1536,11 +1534,11 @@ do_set( errmsg = set_num_option(opt_idx, varp, value, errbuf, sizeof(errbuf), opt_flags); } - else if (opt_idx >= 0) /* string */ + else if (opt_idx >= 0) // string { char_u *save_arg = NULL; char_u *s = NULL; - char_u *oldval = NULL; /* previous value if *varp */ + char_u *oldval = NULL; // previous value if *varp char_u *newval; char_u *origval = NULL; char_u *origval_l = NULL; @@ -1554,18 +1552,18 @@ do_set( unsigned newlen; int comma; int bs; - int new_value_alloced; /* new string option - was allocated */ + int new_value_alloced; // new string option + // was allocated - /* When using ":set opt=val" for a global option - * with a local value the local value will be - * reset, use the global value here. */ + // When using ":set opt=val" for a global option + // with a local value the local value will be + // reset, use the global value here. if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0 && ((int)options[opt_idx].indir & PV_BOTH)) varp = options[opt_idx].var; - /* The old value is kept until we are sure that the - * new value is valid. */ + // The old value is kept until we are sure that the + // new value is valid. oldval = *(char_u **)varp; if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) @@ -1592,14 +1590,14 @@ do_set( else origval = oldval; - if (nextchar == '&') /* set to default val */ + if (nextchar == '&') // set to default val { newval = options[opt_idx].def_val[ ((flags & P_VI_DEF) || cp_val) ? VI_DEFAULT : VIM_DEFAULT]; if ((char_u **)varp == &p_bg) { - /* guess the value of 'background' */ + // guess the value of 'background' #ifdef FEAT_GUI if (gui.in_use) newval = gui_bg_default(); @@ -1608,10 +1606,10 @@ do_set( newval = term_bg_default(); } - /* expand environment variables and ~ (since the - * default value was already expanded, only - * required when an environment variable was set - * later */ + // expand environment variables and ~ (since the + // default value was already expanded, only + // required when an environment variable was set + // later if (newval == NULL) newval = empty_option; else @@ -1623,7 +1621,7 @@ do_set( } new_value_alloced = TRUE; } - else if (nextchar == '<') /* set to global val */ + else if (nextchar == '<') // set to global val { newval = vim_strsave(*(char_u **)get_varp_scope( &(options[opt_idx]), OPT_GLOBAL)); @@ -1631,7 +1629,7 @@ do_set( } else { - ++arg; /* jump to after the '=' or ':' */ + ++arg; // jump to after the '=' or ':' /* * Set 'keywordprg' to ":help" if an empty @@ -1696,7 +1694,7 @@ do_set( STRCAT(errbuf, "<,>,"); if (i & 16) STRCAT(errbuf, "[,],"); - if (*errbuf != NUL) /* remove trailing , */ + if (*errbuf != NUL) // remove trailing , errbuf[STRLEN(errbuf) - 1] = NUL; save_arg = arg; arg = (char_u *)errbuf; @@ -1717,12 +1715,12 @@ do_set( * Can't use set_string_option_direct(), because * we need to remove the backslashes. */ - /* get a bit too much */ + // get a bit too much newlen = (unsigned)STRLEN(arg) + 1; if (adding || prepending || removing) newlen += (unsigned)STRLEN(origval) + 1; newval = alloc(newlen); - if (newval == NULL) /* out of mem, don't change */ + if (newval == NULL) // out of mem, don't change break; s = newval; @@ -1745,11 +1743,11 @@ do_set( && arg[2] != '\\'))) #endif ) - ++arg; /* remove backslash */ + ++arg; // remove backslash if (has_mbyte && (i = (*mb_ptr2len)(arg)) > 1) { - /* copy multibyte char */ + // copy multibyte char mch_memmove(s, arg, (size_t)i); arg += i; s += i; @@ -1781,9 +1779,9 @@ do_set( } } - /* locate newval[] in origval[] when removing it - * and when adding to avoid duplicates */ - i = 0; /* init for GCC */ + // locate newval[] in origval[] when removing it + // and when adding to avoid duplicates + i = 0; // init for GCC if (removing || (flags & P_NODUP)) { i = (int)STRLEN(newval); @@ -1798,10 +1796,10 @@ do_set( || s[i] == ',' || s[i] == NUL)) break; - /* Count backslashes. Only a comma with an - * even number of backslashes or a single - * backslash preceded by a comma before it - * is recognized as a separator */ + // Count backslashes. Only a comma with an + // even number of backslashes or a single + // backslash preceded by a comma before it + // is recognized as a separator if ((s > origval + 1 && s[-1] == '\\' && s[-2] != ',') @@ -1813,7 +1811,7 @@ do_set( bs = 0; } - /* do not add if already there */ + // do not add if already there if ((adding || prepending) && *s) { prepending = FALSE; @@ -1822,8 +1820,8 @@ do_set( } } - /* concatenate the two strings; add a ',' if - * needed */ + // concatenate the two strings; add a ',' if + // needed if (adding || prepending) { comma = ((flags & P_COMMA) && *origval != NUL @@ -1831,7 +1829,7 @@ do_set( if (adding) { i = (int)STRLEN(origval); - /* strip a trailing comma, would get 2 */ + // strip a trailing comma, would get 2 if (comma && i > 1 && (flags & P_ONECOMMA) == P_ONECOMMA && origval[i - 1] == ',' @@ -1850,25 +1848,25 @@ do_set( newval[i] = ','; } - /* Remove newval[] from origval[]. (Note: "i" has - * been set above and is used here). */ + // Remove newval[] from origval[]. (Note: "i" has + // been set above and is used here). if (removing) { STRCPY(newval, origval); if (*s) { - /* may need to remove a comma */ + // may need to remove a comma if (flags & P_COMMA) { if (s == origval) { - /* include comma after string */ + // include comma after string if (s[i] == ',') ++i; } else { - /* include comma before string */ + // include comma before string --s; ++i; } @@ -1879,18 +1877,18 @@ do_set( if (flags & P_FLAGLIST) { - /* Remove flags that appear twice. */ + // Remove flags that appear twice. for (s = newval; *s;) { - /* if options have P_FLAGLIST and - * P_ONECOMMA such as 'whichwrap' */ + // if options have P_FLAGLIST and + // P_ONECOMMA such as 'whichwrap' if (flags & P_ONECOMMA) { if (*s != ',' && *(s + 1) == ',' && vim_strchr(s + 2, *s) != NULL) { - /* Remove the duplicated value and - * the next comma. */ + // Remove the duplicated value and + // the next comma. STRMOVE(s, s + 2); continue; } @@ -1908,7 +1906,7 @@ do_set( } } - if (save_arg != NULL) /* number for 'whichwrap' */ + if (save_arg != NULL) // number for 'whichwrap' arg = save_arg; new_value_alloced = TRUE; } @@ -1925,11 +1923,11 @@ do_set( # endif && origval != NULL && newval != NULL) { - /* origval may be freed by - * did_set_string_option(), make a copy. */ + // origval may be freed by + // did_set_string_option(), make a copy. saved_origval = vim_strsave(origval); - /* newval (and varp) may become invalid if the - * buffer is closed by autocommands. */ + // newval (and varp) may become invalid if the + // buffer is closed by autocommands. saved_newval = vim_strsave(newval); if (origval_l != NULL) saved_origval_l = vim_strsave(origval_l); @@ -1977,11 +1975,11 @@ do_set( vim_free(saved_origval_g); vim_free(saved_newval); #endif - /* If error detected, print the error message. */ + // If error detected, print the error message. if (errmsg != NULL) goto skip; } - else /* key code option */ + else // key code option { char_u *p; @@ -1992,7 +1990,7 @@ do_set( } else { - ++arg; /* jump to after the '=' or ':' */ + ++arg; // jump to after the '=' or ':' for (p = arg; *p && !VIM_ISWHITE(*p); ++p) if (*p == '\\' && p[1] != NUL) ++p; @@ -2036,12 +2034,12 @@ skip: i = (int)STRLEN(IObuff) + 2; if (i + (arg - startarg) < IOSIZE) { - /* append the argument with the error */ + // append the argument with the error STRCAT(IObuff, ": "); mch_memmove(IObuff + i, startarg, (arg - startarg)); IObuff[i + (arg - startarg)] = NUL; } - /* make sure all characters are printable */ + // make sure all characters are printable trans_characters(IObuff, IOSIZE); ++no_wait_return; // wait_return done later @@ -2057,14 +2055,14 @@ skip: theend: if (silent_mode && did_show) { - /* After displaying option values in silent mode. */ + // After displaying option values in silent mode. silent_mode = FALSE; - info_message = TRUE; /* use mch_msg(), not mch_errmsg() */ + info_message = TRUE; // use mch_msg(), not mch_errmsg() msg_putchar('\n'); - cursor_on(); /* msg_start() switches it off */ + cursor_on(); // msg_start() switches it off out_flush(); silent_mode = TRUE; - info_message = FALSE; /* use mch_msg(), not mch_errmsg() */ + info_message = FALSE; // use mch_msg(), not mch_errmsg() } return OK; @@ -2086,9 +2084,9 @@ did_set_option( options[opt_idx].flags |= P_WAS_SET; - /* When an option is set in the sandbox, from a modeline or in secure mode - * set the P_INSECURE flag. Otherwise, if a new value is stored reset the - * flag. */ + // When an option is set in the sandbox, from a modeline or in secure mode + // set the P_INSECURE flag. Otherwise, if a new value is stored reset the + // flag. p = insecure_flag(opt_idx, opt_flags); if (!value_checked && (secure #ifdef HAVE_SANDBOX @@ -2143,7 +2141,7 @@ did_set_title(void) set_options_bin( int oldval, int newval, - int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ + int opt_flags) // OPT_LOCAL and/or OPT_GLOBAL { /* * The option values that are changed when 'bin' changes are @@ -2151,7 +2149,7 @@ set_options_bin( */ if (newval) { - if (!oldval) /* switched on */ + if (!oldval) // switched on { if (!(opt_flags & OPT_GLOBAL)) { @@ -2171,10 +2169,10 @@ set_options_bin( if (!(opt_flags & OPT_GLOBAL)) { - curbuf->b_p_tw = 0; /* no automatic line wrap */ - curbuf->b_p_wm = 0; /* no automatic line wrap */ - curbuf->b_p_ml = 0; /* no modelines */ - curbuf->b_p_et = 0; /* no expandtab */ + curbuf->b_p_tw = 0; // no automatic line wrap + curbuf->b_p_wm = 0; // no automatic line wrap + curbuf->b_p_ml = 0; // no modelines + curbuf->b_p_et = 0; // no expandtab } if (!(opt_flags & OPT_LOCAL)) { @@ -2182,10 +2180,10 @@ set_options_bin( p_wm = 0; p_ml = FALSE; p_et = FALSE; - p_bin = TRUE; /* needed when called for the "-b" argument */ + p_bin = TRUE; // needed when called for the "-b" argument } } - else if (oldval) /* switched off */ + else if (oldval) // switched off { if (!(opt_flags & OPT_GLOBAL)) { @@ -2213,12 +2211,12 @@ set_options_bin( static char_u * option_expand(int opt_idx, char_u *val) { - /* if option doesn't need expansion nothing to do */ + // if option doesn't need expansion nothing to do if (!(options[opt_idx].flags & P_EXPAND) || options[opt_idx].var == NULL) return NULL; - /* If val is longer than MAXPATHL no meaningful expansion can be done, - * expand_env() would truncate the string. */ + // If val is longer than MAXPATHL no meaningful expansion can be done, + // expand_env() would truncate the string. if (val != NULL && STRLEN(val) > MAXPATHL) return NULL; @@ -2237,7 +2235,7 @@ option_expand(int opt_idx, char_u *val) (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" : #endif NULL); - if (STRCMP(NameBuff, val) == 0) /* they are the same */ + if (STRCMP(NameBuff, val) == 0) // they are the same return NULL; return NameBuff; @@ -2250,7 +2248,7 @@ option_expand(int opt_idx, char_u *val) static void didset_options(void) { - /* initialize the table for 'iskeyword' et.al. */ + // initialize the table for 'iskeyword' et.al. (void)init_chartab(); didset_string_options(); @@ -2266,7 +2264,7 @@ didset_options(void) (void)check_cedit(); #endif #ifdef FEAT_LINEBREAK - /* initialize the table for 'breakat'. */ + // initialize the table for 'breakat'. fill_breakat_flags(); #endif after_copy_winopt(curwin); @@ -2278,18 +2276,18 @@ didset_options(void) static void didset_options2(void) { - /* Initialize the highlight_attr[] table. */ + // Initialize the highlight_attr[] table. (void)highlight_changed(); - /* Parse default for 'wildmode' */ + // Parse default for 'wildmode' check_opt_wim(); (void)set_chars_option(&p_lcs); - /* Parse default for 'fillchars'. */ + // Parse default for 'fillchars'. (void)set_chars_option(&p_fcs); #ifdef FEAT_CLIPBOARD - /* Parse default for 'clipboard' */ + // Parse default for 'clipboard' (void)check_clipboard_option(); #endif #ifdef FEAT_VARTABS @@ -2394,7 +2392,7 @@ insecure_flag(int opt_idx, int opt_flags) #endif } - /* Nothing special, return global flags field. */ + // Nothing special, return global flags field. return &options[opt_idx].flags; } #endif @@ -2439,8 +2437,8 @@ set_option_sctx_idx(int opt_idx, int opt_flags, sctx_T script_ctx) new_script_ctx.sc_lnum += sourcing_lnum; - /* Remember where the option was set. For local options need to do that - * in the buffer or window structure. */ + // Remember where the option was set. For local options need to do that + // in the buffer or window structure. if (both || (opt_flags & OPT_GLOBAL) || (indir & (PV_BUF|PV_WIN)) == 0) options[opt_idx].script_ctx = new_script_ctx; if (both || (opt_flags & OPT_LOCAL)) @@ -2485,17 +2483,17 @@ set_term_option_sctx_idx(char *name, int opt_idx) */ static char * set_bool_option( - int opt_idx, /* index in options[] table */ - char_u *varp, /* pointer to the option variable */ - int value, /* new value */ - int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ + int opt_idx, // index in options[] table + char_u *varp, // pointer to the option variable + int value, // new value + int opt_flags) // OPT_LOCAL and/or OPT_GLOBAL { int old_value = *(int *)varp; #if defined(FEAT_EVAL) int old_global_value = 0; #endif - /* Disallow changing some options from secure mode */ + // Disallow changing some options from secure mode if ((secure #ifdef HAVE_SANDBOX || sandbox != 0 @@ -2512,9 +2510,9 @@ set_bool_option( OPT_GLOBAL); #endif - *(int *)varp = value; /* set the new value */ + *(int *)varp = value; // set the new value #ifdef FEAT_EVAL - /* Remember where the option was set. */ + // Remember where the option was set. set_option_sctx_idx(opt_idx, opt_flags, current_sctx); #endif @@ -2522,7 +2520,7 @@ set_bool_option( need_mouse_correct = TRUE; #endif - /* May set global value for local option. */ + // May set global value for local option. if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) *(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = value; @@ -2530,16 +2528,16 @@ set_bool_option( * Handle side effects of changing a bool option. */ - /* 'compatible' */ + // 'compatible' if ((int *)varp == &p_cp) compatible_set(); #ifdef FEAT_LANGMAP if ((int *)varp == &p_lrm) - /* 'langremap' -> !'langnoremap' */ + // 'langremap' -> !'langnoremap' p_lnr = !p_lrm; else if ((int *)varp == &p_lnr) - /* 'langnoremap' -> !'langremap' */ + // 'langnoremap' -> !'langremap' p_lrm = !p_lnr; #endif @@ -2549,12 +2547,12 @@ set_bool_option( #endif #ifdef FEAT_PERSISTENT_UNDO - /* 'undofile' */ + // 'undofile' else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf) { - /* Only take action when the option was set. When reset we do not - * delete the undo file, the option may be set again without making - * any changes in between. */ + // Only take action when the option was set. When reset we do not + // delete the undo file, the option may be set again without making + // any changes in between. if (curbuf->b_p_udf || p_udf) { char_u hash[UNDO_HASH_SIZE]; @@ -2562,10 +2560,10 @@ set_bool_option( FOR_ALL_BUFFERS(curbuf) { - /* When 'undofile' is set globally: for every buffer, otherwise - * only for the current buffer: Try to read in the undofile, - * if one exists, the buffer wasn't changed and the buffer was - * loaded */ + // When 'undofile' is set globally: for every buffer, otherwise + // only for the current buffer: Try to read in the undofile, + // if one exists, the buffer wasn't changed and the buffer was + // loaded if ((curbuf == save_curbuf || (opt_flags & OPT_GLOBAL) || opt_flags == 0) && !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL) @@ -2581,11 +2579,11 @@ set_bool_option( else if ((int *)varp == &curbuf->b_p_ro) { - /* when 'readonly' is reset globally, also reset readonlymode */ + // when 'readonly' is reset globally, also reset readonlymode if (!curbuf->b_p_ro && (opt_flags & OPT_LOCAL) == 0) readonlymode = FALSE; - /* when 'readonly' is set may give W10 again */ + // when 'readonly' is set may give W10 again if (curbuf->b_p_ro) curbuf->b_did_warn = FALSE; @@ -2602,11 +2600,11 @@ set_bool_option( } #endif - /* when 'modifiable' is changed, redraw the window title */ + // when 'modifiable' is changed, redraw the window title else if ((int *)varp == &curbuf->b_p_ma) { # ifdef FEAT_TERMINAL - /* Cannot set 'modifiable' when in Terminal mode. */ + // Cannot set 'modifiable' when in Terminal mode. if (curbuf->b_p_ma && (term_in_normal_mode() || (bt_terminal(curbuf) && curbuf->b_term != NULL && !term_is_finished(curbuf)))) { @@ -2619,24 +2617,24 @@ set_bool_option( # endif } #ifdef FEAT_TITLE - /* when 'endofline' is changed, redraw the window title */ + // when 'endofline' is changed, redraw the window title else if ((int *)varp == &curbuf->b_p_eol) { redraw_titles(); } - /* when 'fixeol' is changed, redraw the window title */ + // when 'fixeol' is changed, redraw the window title else if ((int *)varp == &curbuf->b_p_fixeol) { redraw_titles(); } - /* when 'bomb' is changed, redraw the window title and tab page text */ + // when 'bomb' is changed, redraw the window title and tab page text else if ((int *)varp == &curbuf->b_p_bomb) { redraw_titles(); } #endif - /* when 'bin' is set also set some other options */ + // when 'bin' is set also set some other options else if ((int *)varp == &curbuf->b_p_bin) { set_options_bin(old_value, curbuf->b_p_bin, opt_flags); @@ -2645,50 +2643,50 @@ set_bool_option( #endif } - /* when 'buflisted' changes, trigger autocommands */ + // when 'buflisted' changes, trigger autocommands else if ((int *)varp == &curbuf->b_p_bl && old_value != curbuf->b_p_bl) { apply_autocmds(curbuf->b_p_bl ? EVENT_BUFADD : EVENT_BUFDELETE, NULL, NULL, TRUE, curbuf); } - /* when 'swf' is set, create swapfile, when reset remove swapfile */ + // when 'swf' is set, create swapfile, when reset remove swapfile else if ((int *)varp == &curbuf->b_p_swf) { if (curbuf->b_p_swf && p_uc) - ml_open_file(curbuf); /* create the swap file */ + ml_open_file(curbuf); // create the swap file else - /* no need to reset curbuf->b_may_swap, ml_open_file() will check - * buf->b_p_swf */ - mf_close_file(curbuf, TRUE); /* remove the swap file */ + // no need to reset curbuf->b_may_swap, ml_open_file() will check + // buf->b_p_swf + mf_close_file(curbuf, TRUE); // remove the swap file } - /* when 'terse' is set change 'shortmess' */ + // when 'terse' is set change 'shortmess' else if ((int *)varp == &p_terse) { char_u *p; p = vim_strchr(p_shm, SHM_SEARCH); - /* insert 's' in p_shm */ + // insert 's' in p_shm if (p_terse && p == NULL) { STRCPY(IObuff, p_shm); STRCAT(IObuff, "s"); set_string_option_direct((char_u *)"shm", -1, IObuff, OPT_FREE, 0); } - /* remove 's' from p_shm */ + // remove 's' from p_shm else if (!p_terse && p != NULL) STRMOVE(p, p + 1); } - /* when 'paste' is set or reset also change other options */ + // when 'paste' is set or reset also change other options else if ((int *)varp == &p_paste) { paste_option_changed(); } - /* when 'insertmode' is set from an autocommand need to do work here */ + // when 'insertmode' is set from an autocommand need to do work here else if ((int *)varp == &p_im) { if (p_im) @@ -2697,33 +2695,33 @@ set_bool_option( need_start_insertmode = TRUE; stop_insert_mode = FALSE; } - /* only reset if it was set previously */ + // only reset if it was set previously else if (old_value) { need_start_insertmode = FALSE; stop_insert_mode = TRUE; if (restart_edit != 0 && mode_displayed) - clear_cmdline = TRUE; /* remove "(insert)" */ + clear_cmdline = TRUE; // remove "(insert)" restart_edit = 0; } } - /* when 'ignorecase' is set or reset and 'hlsearch' is set, redraw */ + // when 'ignorecase' is set or reset and 'hlsearch' is set, redraw else if ((int *)varp == &p_ic && p_hls) { redraw_all_later(SOME_VALID); } #ifdef FEAT_SEARCH_EXTRA - /* when 'hlsearch' is set or reset: reset no_hlsearch */ + // when 'hlsearch' is set or reset: reset no_hlsearch else if ((int *)varp == &p_hls) { set_no_hlsearch(FALSE); } #endif - /* when 'scrollbind' is set: snapshot the current position to avoid a jump - * at the end of normal_cmd() */ + // when 'scrollbind' is set: snapshot the current position to avoid a jump + // at the end of normal_cmd() else if ((int *)varp == &curwin->w_p_scb) { if (curwin->w_p_scb) @@ -2734,7 +2732,7 @@ set_bool_option( } #if defined(FEAT_QUICKFIX) - /* There can be only one window with 'previewwindow' set. */ + // There can be only one window with 'previewwindow' set. else if ((int *)varp == &curwin->w_p_pvw) { if (curwin->w_p_pvw) @@ -2751,13 +2749,13 @@ set_bool_option( } #endif - /* when 'textmode' is set or reset also change 'fileformat' */ + // when 'textmode' is set or reset also change 'fileformat' else if ((int *)varp == &curbuf->b_p_tx) { set_fileformat(curbuf->b_p_tx ? EOL_DOS : EOL_UNIX, opt_flags); } - /* when 'textauto' is set or reset also change 'fileformats' */ + // when 'textauto' is set or reset also change 'fileformats' else if ((int *)varp == &p_ta) { set_string_option_direct((char_u *)"ffs", -1, @@ -2772,12 +2770,12 @@ set_bool_option( #ifdef FEAT_LISP else if (varp == (char_u *)&(curbuf->b_p_lisp)) { - (void)buf_init_chartab(curbuf, FALSE); /* ignore errors */ + (void)buf_init_chartab(curbuf, FALSE); // ignore errors } #endif #ifdef FEAT_TITLE - /* when 'title' changed, may need to change the title; same for 'icon' */ + // when 'title' changed, may need to change the title; same for 'icon' else if ((int *)varp == &p_title || (int *)varp == &p_icon) { did_set_title(); @@ -2787,7 +2785,7 @@ set_bool_option( else if ((int *)varp == &curbuf->b_changed) { if (!value) - save_file_ff(curbuf); /* Buffer is unchanged */ + save_file_ff(curbuf); // Buffer is unchanged #ifdef FEAT_TITLE redraw_titles(); #endif @@ -2810,7 +2808,7 @@ set_bool_option( pseps[0] = '\\'; } - /* need to adjust the file name arguments and buffer names. */ + // need to adjust the file name arguments and buffer names. buflist_slash_adjust(); alist_slash_adjust(); # ifdef FEAT_EVAL @@ -2819,7 +2817,7 @@ set_bool_option( } #endif - /* If 'wrap' is set, set w_leftcol to zero. */ + // If 'wrap' is set, set w_leftcol to zero. else if ((int *)varp == &curwin->w_p_wrap) { if (curwin->w_p_wrap) @@ -2867,16 +2865,16 @@ set_bool_option( #ifdef FEAT_AUTOCHDIR else if ((int *)varp == &p_acd) { - /* Change directories when the 'acd' option is set now. */ + // Change directories when the 'acd' option is set now. DO_AUTOCHDIR; } #endif #ifdef FEAT_DIFF - /* 'diff' */ + // 'diff' else if ((int *)varp == &curwin->w_p_diff) { - /* May add or remove the buffer from the list of diff buffers. */ + // May add or remove the buffer from the list of diff buffers. diff_buf_adjust(curwin); # ifdef FEAT_FOLDING if (foldmethodIsDiff(curwin)) @@ -2886,21 +2884,21 @@ set_bool_option( #endif #ifdef HAVE_INPUT_METHOD - /* 'imdisable' */ + // 'imdisable' else if ((int *)varp == &p_imdisable) { - /* Only de-activate it here, it will be enabled when changing mode. */ + // Only de-activate it here, it will be enabled when changing mode. if (p_imdisable) im_set_active(FALSE); else if (State & INSERT) - /* When the option is set from an autocommand, it may need to take - * effect right away. */ + // When the option is set from an autocommand, it may need to take + // effect right away. im_set_active(curbuf->b_p_iminsert == B_IMODE_IM); } #endif #ifdef FEAT_SPELL - /* 'spell' */ + // 'spell' else if ((int *)varp == &curwin->w_p_spell) { if (curwin->w_p_spell) @@ -2923,14 +2921,14 @@ set_bool_option( */ if (!p_tbidi) { - /* set rightleft mode */ + // set rightleft mode if (!curwin->w_p_rl) { curwin->w_p_rl = TRUE; changed_window_setting(); } - /* Enable Arabic shaping (major part of what Arabic requires) */ + // Enable Arabic shaping (major part of what Arabic requires) if (!p_arshape) { p_arshape = TRUE; @@ -2938,8 +2936,8 @@ set_bool_option( } } - /* Arabic requires a utf-8 encoding, inform the user if its not - * set. */ + // Arabic requires a utf-8 encoding, inform the user if its not + // set. if (STRCMP(p_enc, "utf-8") != 0) { static char *w_arabic = N_("W17: Arabic requires UTF-8, do ':set encoding=utf-8'"); @@ -2951,11 +2949,11 @@ set_bool_option( #endif } - /* set 'delcombine' */ + // set 'delcombine' p_deco = TRUE; # ifdef FEAT_KEYMAP - /* Force-set the necessary keymap for arabic */ + // Force-set the necessary keymap for arabic set_option_value((char_u *)"keymap", 0L, (char_u *)"arabic", OPT_LOCAL); # endif @@ -2967,22 +2965,22 @@ set_bool_option( */ if (!p_tbidi) { - /* reset rightleft mode */ + // reset rightleft mode if (curwin->w_p_rl) { curwin->w_p_rl = FALSE; changed_window_setting(); } - /* 'arabicshape' isn't reset, it is a global option and - * another window may still need it "on". */ + // 'arabicshape' isn't reset, it is a global option and + // another window may still need it "on". } - /* 'delcombine' isn't reset, it is a global option and another - * window may still want it "on". */ + // 'delcombine' isn't reset, it is a global option and another + // window may still want it "on". # ifdef FEAT_KEYMAP - /* Revert to the default keymap */ + // Revert to the default keymap curbuf->b_p_iminsert = B_IMODE_NONE; curbuf->b_p_imsearch = B_IMODE_USE_INSERT; # endif @@ -3010,11 +3008,11 @@ set_bool_option( #endif #ifdef FEAT_TERMGUICOLORS - /* 'termguicolors' */ + // 'termguicolors' else if ((int *)varp == &p_tgc) { # ifdef FEAT_VTP - /* Do not turn on 'tgc' when 24-bit colors are not supported. */ + // Do not turn on 'tgc' when 24-bit colors are not supported. if ( # ifdef VIMDLL !gui.in_use && !gui.starting && @@ -3032,7 +3030,7 @@ set_bool_option( # endif highlight_gui_started(); # ifdef FEAT_VTP - /* reset t_Co */ + // reset t_Co if (is_term_win32()) { control_console_color_rgb(); @@ -3047,7 +3045,7 @@ set_bool_option( * End of handling side effects for bool options. */ - /* after handling side effects, call autocommand */ + // after handling side effects, call autocommand options[opt_idx].flags |= P_WAS_SET; @@ -3093,7 +3091,7 @@ set_bool_option( } #endif - comp_col(); /* in case 'ruler' or 'showcmd' changed */ + comp_col(); // in case 'ruler' or 'showcmd' changed if (curwin->w_curswant != MAXCOL && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0) curwin->w_set_curswant = TRUE; @@ -3108,13 +3106,13 @@ set_bool_option( */ static char * set_num_option( - int opt_idx, /* index in options[] table */ - char_u *varp, /* pointer to the option variable */ - long value, /* new value */ - char *errbuf, /* buffer for error messages */ - size_t errbuflen, /* length of "errbuf" */ - int opt_flags) /* OPT_LOCAL, OPT_GLOBAL and - OPT_MODELINE */ + int opt_idx, // index in options[] table + char_u *varp, // pointer to the option variable + long value, // new value + char *errbuf, // buffer for error messages + size_t errbuflen, // length of "errbuf" + int opt_flags) // OPT_LOCAL, OPT_GLOBAL and + // OPT_MODELINE { char *errmsg = NULL; long old_value = *(long *)varp; @@ -3126,7 +3124,7 @@ set_num_option( long old_Columns = Columns; // remember old Columns long *pp = (long *)varp; - /* Disallow changing some options from secure mode. */ + // Disallow changing some options from secure mode. if ((secure #ifdef HAVE_SANDBOX || sandbox != 0 @@ -3145,7 +3143,7 @@ set_num_option( *pp = value; #ifdef FEAT_EVAL - /* Remember where the option was set. */ + // Remember where the option was set. set_option_sctx_idx(opt_idx, opt_flags, current_sctx); #endif #ifdef FEAT_GUI @@ -3187,7 +3185,7 @@ set_num_option( p_hh = 0; } - /* Change window height NOW */ + // Change window height NOW if (!ONE_WINDOW) { if (pp == &p_wh && curwin->w_height < p_wh) @@ -3225,7 +3223,7 @@ set_num_option( p_wiw = p_wmw; } - /* Change window width NOW */ + // Change window width NOW if (!ONE_WINDOW && curwin->w_width < p_wiw) win_setwidth((int)p_wiw); } @@ -3245,30 +3243,30 @@ set_num_option( win_setminwidth(); } - /* (re)set last window status line */ + // (re)set last window status line else if (pp == &p_ls) { last_status(FALSE); } - /* (re)set tab page line */ + // (re)set tab page line else if (pp == &p_stal) { - shell_new_rows(); /* recompute window positions and heights */ + shell_new_rows(); // recompute window positions and heights } #ifdef FEAT_GUI else if (pp == &p_linespace) { - /* Recompute gui.char_height and resize the Vim window to keep the - * same number of lines. */ + // Recompute gui.char_height and resize the Vim window to keep the + // same number of lines. if (gui.in_use && gui_mch_adjust_charheight() == OK) gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); } #endif #ifdef FEAT_FOLDING - /* 'foldlevel' */ + // 'foldlevel' else if (pp == &curwin->w_p_fdl) { if (curwin->w_p_fdl < 0) @@ -3276,20 +3274,20 @@ set_num_option( newFoldLevel(); } - /* 'foldminlines' */ + // 'foldminlines' else if (pp == &curwin->w_p_fml) { foldUpdateAll(curwin); } - /* 'foldnestmax' */ + // 'foldnestmax' else if (pp == &curwin->w_p_fdn) { if (foldmethodIsSyntax(curwin) || foldmethodIsIndent(curwin)) foldUpdateAll(curwin); } - /* 'foldcolumn' */ + // 'foldcolumn' else if (pp == &curwin->w_p_fdc) { if (curwin->w_p_fdc < 0) @@ -3303,10 +3301,10 @@ set_num_option( curwin->w_p_fdc = 12; } } -#endif /* FEAT_FOLDING */ +#endif // FEAT_FOLDING #if defined(FEAT_FOLDING) || defined(FEAT_CINDENT) - /* 'shiftwidth' or 'tabstop' */ + // 'shiftwidth' or 'tabstop' else if (pp == &curbuf->b_p_sw || pp == &curbuf->b_p_ts) { # ifdef FEAT_FOLDING @@ -3314,22 +3312,22 @@ set_num_option( foldUpdateAll(curwin); # endif # ifdef FEAT_CINDENT - /* When 'shiftwidth' changes, or it's zero and 'tabstop' changes: - * parse 'cinoptions'. */ + // When 'shiftwidth' changes, or it's zero and 'tabstop' changes: + // parse 'cinoptions'. if (pp == &curbuf->b_p_sw || curbuf->b_p_sw == 0) parse_cino(curbuf); # endif } #endif - /* 'maxcombine' */ + // 'maxcombine' else if (pp == &p_mco) { if (p_mco > MAX_MCO) p_mco = MAX_MCO; else if (p_mco < 0) p_mco = 0; - screenclear(); /* will re-allocate the screen */ + screenclear(); // will re-allocate the screen } else if (pp == &curbuf->b_p_iminsert) @@ -3340,16 +3338,16 @@ set_num_option( curbuf->b_p_iminsert = B_IMODE_NONE; } p_iminsert = curbuf->b_p_iminsert; - if (termcap_active) /* don't do this in the alternate screen */ + if (termcap_active) // don't do this in the alternate screen showmode(); #if defined(FEAT_KEYMAP) - /* Show/unshow value of 'keymap' in status lines. */ + // Show/unshow value of 'keymap' in status lines. status_redraw_curbuf(); #endif } #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) - /* 'imstyle' */ + // 'imstyle' else if (pp == &p_imst) { if (p_imst != IM_ON_THE_SPOT && p_imst != IM_OVER_THE_SPOT) @@ -3376,7 +3374,7 @@ set_num_option( } #ifdef FEAT_TITLE - /* if 'titlelen' has changed, redraw the title */ + // if 'titlelen' has changed, redraw the title else if (pp == &p_titlelen) { if (p_titlelen < 0) @@ -3389,7 +3387,7 @@ set_num_option( } #endif - /* if p_ch changed value, change the command line height */ + // if p_ch changed value, change the command line height else if (pp == &p_ch) { if (p_ch < 1) @@ -3400,8 +3398,8 @@ set_num_option( if (p_ch > Rows - min_rows() + 1) p_ch = Rows - min_rows() + 1; - /* Only compute the new window layout when startup has been - * completed. Otherwise the frame sizes may be wrong. */ + // Only compute the new window layout when startup has been + // completed. Otherwise the frame sizes may be wrong. if (p_ch != old_value && full_screen #ifdef FEAT_GUI && !gui.starting @@ -3410,7 +3408,7 @@ set_num_option( command_height(); } - /* when 'updatecount' changes from zero to non-zero, open swap files */ + // when 'updatecount' changes from zero to non-zero, open swap files else if (pp == &p_uc) { if (p_uc < 0) @@ -3442,7 +3440,7 @@ set_num_option( #endif #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) - /* 'pyxversion' */ + // 'pyxversion' else if (pp == &p_pyx) { if (p_pyx != 0 && p_pyx != 2 && p_pyx != 3) @@ -3450,24 +3448,24 @@ set_num_option( } #endif - /* sync undo before 'undolevels' changes */ + // sync undo before 'undolevels' changes else if (pp == &p_ul) { - /* use the old value, otherwise u_sync() may not work properly */ + // use the old value, otherwise u_sync() may not work properly p_ul = old_value; u_sync(TRUE); p_ul = value; } else if (pp == &curbuf->b_p_ul) { - /* use the old value, otherwise u_sync() may not work properly */ + // use the old value, otherwise u_sync() may not work properly curbuf->b_p_ul = old_value; u_sync(TRUE); curbuf->b_p_ul = value; } #ifdef FEAT_LINEBREAK - /* 'numberwidth' must be positive */ + // 'numberwidth' must be positive else if (pp == &curwin->w_p_nuw) { if (curwin->w_p_nuw < 1) @@ -3480,7 +3478,7 @@ set_num_option( errmsg = e_invarg; curwin->w_p_nuw = 20; } - curwin->w_nrwidth_line_count = 0; /* trigger a redraw */ + curwin->w_nrwidth_line_count = 0; // trigger a redraw } #endif @@ -3533,7 +3531,7 @@ set_num_option( */ if (old_Rows != Rows || old_Columns != Columns) { - /* Changing the screen size is not allowed while updating the screen. */ + // Changing the screen size is not allowed while updating the screen. if (updating_screen) *pp = old_value; else if (full_screen @@ -3544,8 +3542,8 @@ set_num_option( set_shellsize((int)Columns, (int)Rows, TRUE); else { - /* Postpone the resizing; check the size and cmdline position for - * messages. */ + // Postpone the resizing; check the size and cmdline position for + // messages. check_shellsize(); if (cmdline_row > Rows - p_ch && Rows > p_ch) cmdline_row = Rows - p_ch; @@ -3575,11 +3573,11 @@ set_num_option( errmsg = e_scroll; win_comp_scroll(curwin); } - /* If 'scroll' became invalid because of a side effect silently adjust - * it. */ + // If 'scroll' became invalid because of a side effect silently adjust + // it. else if (curwin->w_p_scr <= 0) curwin->w_p_scr = 1; - else /* curwin->w_p_scr > curwin->w_height */ + else // curwin->w_p_scr > curwin->w_height curwin->w_p_scr = curwin->w_height; } if (p_hi < 0) @@ -3604,7 +3602,7 @@ set_num_option( } if ((p_sj < -100 || p_sj >= Rows) && full_screen) { - if (Rows != old_Rows) /* Rows changed, just adjust p_sj */ + if (Rows != old_Rows) // Rows changed, just adjust p_sj p_sj = Rows / 2; else { @@ -3640,7 +3638,7 @@ set_num_option( p_ss = 0; } - /* May set global value for local option. */ + // May set global value for local option. if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) *(long *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = *pp; @@ -3685,7 +3683,7 @@ set_num_option( } #endif - comp_col(); /* in case 'columns' or 'ls' changed */ + comp_col(); // in case 'columns' or 'ls' changed if (curwin->w_curswant != MAXCOL && (options[opt_idx].flags & (P_CURSWANT | P_RALL)) != 0) curwin->w_set_curswant = TRUE; @@ -3700,11 +3698,11 @@ set_num_option( void check_redraw(long_u flags) { - /* Careful: P_RCLR and P_RALL are a combination of other P_ flags */ + // Careful: P_RCLR and P_RALL are a combination of other P_ flags int doclear = (flags & P_RCLR) == P_RCLR; int all = ((flags & P_RALL) == P_RALL || doclear); - if ((flags & P_RSTAT) || all) /* mark all status lines dirty */ + if ((flags & P_RSTAT) || all) // mark all status lines dirty status_redraw_all(); if ((flags & P_RBUF) || (flags & P_RWIN) || all) @@ -3728,7 +3726,7 @@ findoption(char_u *arg) { int opt_idx; char *s, *p; - static short quick_tab[27] = {0, 0}; /* quick access table */ + static short quick_tab[27] = {0, 0}; // quick access table int is_term_opt; /* @@ -3769,7 +3767,7 @@ findoption(char_u *arg) opt_idx = quick_tab[CharOrdLow(arg[0])]; for ( ; (s = options[opt_idx].fullname) != NULL; opt_idx++) { - if (STRCMP(arg, s) == 0) /* match full name */ + if (STRCMP(arg, s) == 0) // match full name break; } if (s == NULL && !is_term_opt) @@ -3778,7 +3776,7 @@ findoption(char_u *arg) for ( ; options[opt_idx].fullname != NULL; opt_idx++) { s = options[opt_idx].shortname; - if (s != NULL && STRCMP(arg, s) == 0) /* match short name */ + if (s != NULL && STRCMP(arg, s) == 0) // match short name break; s = NULL; } @@ -3803,14 +3801,14 @@ findoption(char_u *arg) get_option_value( char_u *name, long *numval, - char_u **stringval, /* NULL when only checking existence */ + char_u **stringval, // NULL when only checking existence int opt_flags) { int opt_idx; char_u *varp; opt_idx = findoption(name); - if (opt_idx < 0) /* unknown option */ + if (opt_idx < 0) // unknown option { int key; @@ -3845,12 +3843,12 @@ get_option_value( if (options[opt_idx].flags & P_STRING) { - if (varp == NULL) /* hidden option */ + if (varp == NULL) // hidden option return -2; if (stringval != NULL) { #ifdef FEAT_CRYPT - /* never return the value of the crypt key */ + // never return the value of the crypt key if ((char_u **)varp == &curbuf->b_p_key && **(char_u **)(varp) != NUL) *stringval = vim_strsave((char_u *)"*****"); @@ -3861,14 +3859,14 @@ get_option_value( return 0; } - if (varp == NULL) /* hidden option */ + if (varp == NULL) // hidden option return -1; if (options[opt_idx].flags & P_NUM) *numval = *(long *)varp; else { - /* Special case: 'modified' is b_changed, but we also want to consider - * it set when 'ff' or 'fenc' changed. */ + // Special case: 'modified' is b_changed, but we also want to consider + // it set when 'ff' or 'fenc' changed. if ((int *)varp == &curbuf->b_changed) *numval = curbufIsChanged(); else @@ -3901,7 +3899,7 @@ get_option_value( get_option_value_strict( char_u *name, long *numval, - char_u **stringval, /* NULL when only obtaining attributes */ + char_u **stringval, // NULL when only obtaining attributes int opt_type, void *from) { @@ -3916,7 +3914,7 @@ get_option_value_strict( p = &(options[opt_idx]); - /* Hidden option */ + // Hidden option if (p->var == NULL) return 0; @@ -3932,26 +3930,26 @@ get_option_value_strict( if (opt_type == SREQ_GLOBAL) r |= SOPT_GLOBAL; else - return 0; /* Did not request global-only option */ + return 0; // Did not request global-only option } else { if (p->indir & PV_BOTH) r |= SOPT_GLOBAL; else if (opt_type == SREQ_GLOBAL) - return 0; /* Requested global option */ + return 0; // Requested global option if (p->indir & PV_WIN) { if (opt_type == SREQ_BUF) - return 0; /* Did not request window-local option */ + return 0; // Did not request window-local option else r |= SOPT_WIN; } else if (p->indir & PV_BUF) { if (opt_type == SREQ_WIN) - return 0; /* Did not request buffer-local option */ + return 0; // Did not request buffer-local option else r |= SOPT_BUF; } @@ -3966,8 +3964,8 @@ get_option_value_strict( { if (opt_type == SREQ_BUF) { - /* Special case: 'modified' is b_changed, but we also want to - * consider it set when 'ff' or 'fenc' changed. */ + // Special case: 'modified' is b_changed, but we also want to + // consider it set when 'ff' or 'fenc' changed. if (p->indir == PV_MOD) { *numval = bufIsChanged((buf_T *)from); @@ -3976,7 +3974,7 @@ get_option_value_strict( #ifdef FEAT_CRYPT else if (p->indir == PV_KEY) { - /* never return the value of the crypt key */ + // never return the value of the crypt key *stringval = NULL; varp = NULL; } @@ -4050,7 +4048,7 @@ option_iter_next(void **option, int opt_type) ret = ((struct vimoption *) (*option)); - /* Hidden option */ + // Hidden option if (ret->var == NULL) { ret = NULL; @@ -4168,7 +4166,7 @@ set_option_value( char_u *name, long number, char_u *string, - int opt_flags) /* OPT_LOCAL or 0 (both) */ + int opt_flags) // OPT_LOCAL or 0 (both) { int opt_idx; char_u *varp; @@ -4207,7 +4205,7 @@ set_option_value( { flags = options[opt_idx].flags; #ifdef HAVE_SANDBOX - /* Disallow changing some options in the sandbox */ + // Disallow changing some options in the sandbox if (sandbox > 0 && (flags & P_SECURE)) { emsg(_(e_sandbox)); @@ -4219,24 +4217,24 @@ set_option_value( else { varp = get_varp_scope(&(options[opt_idx]), opt_flags); - if (varp != NULL) /* hidden option is not changed */ + if (varp != NULL) // hidden option is not changed { if (number == 0 && string != NULL) { int idx; - /* Either we are given a string or we are setting option - * to zero. */ + // Either we are given a string or we are setting option + // to zero. for (idx = 0; string[idx] == '0'; ++idx) ; if (string[idx] != NUL || idx == 0) { - /* There's another character after zeros or the string - * is empty. In both cases, we are trying to set a - * num option using a string. */ + // There's another character after zeros or the string + // is empty. In both cases, we are trying to set a + // num option using a string. semsg(_("E521: Number required: &%s = '%s'"), name, string); - return NULL; /* do nothing as we hit an error */ + return NULL; // do nothing as we hit an error } } @@ -4317,10 +4315,10 @@ find_key_option(char_u *arg_arg, int has_lt) key = TERMCAP2KEY(arg[2], arg[3]); else if (has_lt) { - --arg; /* put arg at the '<' */ + --arg; // put arg at the '<' modifiers = 0; key = find_special_key(&arg, &modifiers, TRUE, TRUE, FALSE, TRUE, NULL); - if (modifiers) /* can't handle modifiers here */ + if (modifiers) // can't handle modifiers here key = 0; } return key; @@ -4334,7 +4332,7 @@ find_key_option(char_u *arg_arg, int has_lt) static void showoptions( int all, - int opt_flags) /* OPT_LOCAL and/or OPT_GLOBAL */ + int opt_flags) // OPT_LOCAL and/or OPT_GLOBAL { struct vimoption *p; int col; @@ -4355,7 +4353,7 @@ showoptions( if (items == NULL) return; - /* Highlight title */ + // Highlight title if (all == 2) msg_puts_title(_("\n--- Terminal codes ---")); else if (opt_flags & OPT_GLOBAL) @@ -4397,7 +4395,7 @@ showoptions( || (all == 0 && !optval_default(p, varp, p_cp)))) { if (p->flags & P_BOOL) - len = 1; /* a toggle option fits always */ + len = 1; // a toggle option fits always else { option_value2string(p, opt_flags); @@ -4419,17 +4417,17 @@ showoptions( cols = 1; rows = (item_count + cols - 1) / cols; } - else /* run == 2 */ + else // run == 2 rows = item_count; for (row = 0; row < rows && !got_int; ++row) { - msg_putchar('\n'); /* go to next line */ - if (got_int) /* 'q' typed in more */ + msg_putchar('\n'); // go to next line + if (got_int) // 'q' typed in more break; col = 0; for (i = row; i < item_count; i += rows) { - msg_col = col; /* make columns */ + msg_col = col; // make columns showoneopt(items[i], opt_flags); col += INC; } @@ -4449,15 +4447,15 @@ optval_default(struct vimoption *p, char_u *varp, int compatible) int dvi; if (varp == NULL) - return TRUE; /* hidden option is always at default */ + return TRUE; // hidden option is always at default dvi = ((p->flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT; if (p->flags & P_NUM) return (*(long *)varp == (long)(long_i)p->def_val[dvi]); if (p->flags & P_BOOL) - /* the cast to long is required for Manx C, long_i is - * needed for MSVC */ + // the cast to long is required for Manx C, long_i is + // needed for MSVC return (*(int *)varp == (int)(long)(long_i)p->def_val[dvi]); - /* P_STRING */ + // P_STRING return (STRCMP(*(char_u **)varp, p->def_val[dvi]) == 0); } @@ -4468,17 +4466,17 @@ optval_default(struct vimoption *p, char_u *varp, int compatible) static void showoneopt( struct vimoption *p, - int opt_flags) /* OPT_LOCAL or OPT_GLOBAL */ + int opt_flags) // OPT_LOCAL or OPT_GLOBAL { char_u *varp; int save_silent = silent_mode; silent_mode = FALSE; - info_message = TRUE; /* use mch_msg(), not mch_errmsg() */ + info_message = TRUE; // use mch_msg(), not mch_errmsg() varp = get_varp_scope(p, opt_flags); - /* for 'modified' we also need to check if 'ff' or 'fenc' changed. */ + // for 'modified' we also need to check if 'ff' or 'fenc' changed. if ((p->flags & P_BOOL) && ((int *)varp == &curbuf->b_changed ? !curbufIsChanged() : !*(int *)varp)) msg_puts("no"); @@ -4490,7 +4488,7 @@ showoneopt( if (!(p->flags & P_BOOL)) { msg_putchar('='); - /* put value string in NameBuff */ + // put value string in NameBuff option_value2string(p, opt_flags); msg_outtrans(NameBuff); } @@ -4525,9 +4523,9 @@ showoneopt( makeset(FILE *fd, int opt_flags, int local_only) { struct vimoption *p; - char_u *varp; /* currently used value */ - char_u *varp_fresh; /* local value */ - char_u *varp_local = NULL; /* fresh value */ + char_u *varp; // currently used value + char_u *varp_fresh; // local value + char_u *varp_local = NULL; // fresh value char *cmd; int round; int pri; @@ -4545,16 +4543,16 @@ makeset(FILE *fd, int opt_flags, int local_only) && !istermoption(p) && ((pri == 1) == ((p->flags & P_PRI_MKRC) != 0))) { - /* skip global option when only doing locals */ + // skip global option when only doing locals if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL)) continue; - /* Do not store options like 'bufhidden' and 'syntax' in a vimrc - * file, they are always buffer-specific. */ + // Do not store options like 'bufhidden' and 'syntax' in a vimrc + // file, they are always buffer-specific. if ((opt_flags & OPT_GLOBAL) && (p->flags & P_NOGLOB)) continue; - /* Global values are only written when not at the default value. */ + // Global values are only written when not at the default value. varp = get_varp_scope(p, opt_flags); if ((opt_flags & OPT_GLOBAL) && optval_default(p, varp, p_cp)) continue; @@ -4564,11 +4562,11 @@ makeset(FILE *fd, int opt_flags, int local_only) { if (p->var == VAR_WIN) { - /* skip window-local option when only doing globals */ + // skip window-local option when only doing globals if (!(opt_flags & OPT_LOCAL)) continue; - /* When fresh value of window-local option is not at the - * default, need to write it too. */ + // When fresh value of window-local option is not at the + // default, need to write it too. if (!(opt_flags & OPT_GLOBAL) && !local_only) { varp_fresh = get_varp_scope(p, OPT_GLOBAL); @@ -4582,8 +4580,8 @@ makeset(FILE *fd, int opt_flags, int local_only) } } - /* Round 1: fresh value for window-local options. - * Round 2: other values */ + // Round 1: fresh value for window-local options. + // Round 2: other values for ( ; round <= 2; varp = varp_local, ++round) { if (round == 1 || (opt_flags & OPT_GLOBAL)) @@ -4601,12 +4599,12 @@ makeset(FILE *fd, int opt_flags, int local_only) if (put_setnum(fd, cmd, p->fullname, (long *)varp) == FAIL) return FAIL; } - else /* P_STRING */ + else // P_STRING { int do_endif = FALSE; - /* Don't set 'syntax' and 'filetype' again if the value is - * already right, avoids reloading the syntax file. */ + // Don't set 'syntax' and 'filetype' again if the value is + // already right, avoids reloading the syntax file. if ( #if defined(FEAT_SYN_HL) p->indir == PV_SYN || @@ -4679,9 +4677,9 @@ put_setstring( return FAIL; if (*valuep != NULL) { - /* Output 'pastetoggle' as key names. For other - * options some characters have to be escaped with - * CTRL-V or backslash */ + // Output 'pastetoggle' as key names. For other + // options some characters have to be escaped with + // CTRL-V or backslash if (valuep == &p_pt) { s = *valuep; @@ -4761,7 +4759,7 @@ put_setnum( return FAIL; if (wc_use_keyname((char_u *)valuep, &wc)) { - /* print 'wildchar' and 'wildcharm' as a key name */ + // print 'wildchar' and 'wildcharm' as a key name if (fputs((char *)get_special_key_name((int)wc, 0), fd) < 0) return FAIL; } @@ -4779,7 +4777,7 @@ put_setbool( char *name, int value) { - if (value < 0) /* global/local option using global value */ + if (value < 0) // global/local option using global value return OK; if (fprintf(fd, "%s %s%s", cmd, value ? "" : "no", name) < 0 || put_eol(fd) < 0) @@ -4802,15 +4800,15 @@ clear_termoptions(void) */ mch_setmouse(FALSE); // switch mouse off #ifdef FEAT_TITLE - mch_restore_title(SAVE_RESTORE_BOTH); /* restore window titles */ + mch_restore_title(SAVE_RESTORE_BOTH); // restore window titles #endif #if defined(FEAT_XCLIPBOARD) && defined(FEAT_GUI) - /* When starting the GUI close the display opened for the clipboard. - * After restoring the title, because that will need the display. */ + // When starting the GUI close the display opened for the clipboard. + // After restoring the title, because that will need the display. if (gui.starting) clear_xterm_clip(); #endif - stoptermcap(); /* stop termcap mode */ + stoptermcap(); // stop termcap mode free_termoptions(); } @@ -4881,7 +4879,7 @@ set_term_defaults(void) if (p->flags & P_ALLOCED) { p->flags |= P_DEF_ALLOCED; - p->flags &= ~P_ALLOCED; /* don't free the value now */ + p->flags &= ~P_ALLOCED; // don't free the value now } } } @@ -4923,7 +4921,7 @@ unset_global_local_option(char_u *name, void *from) switch ((int)p->indir) { - /* global option with local value: use local value if it's been set */ + // global option with local value: use local value if it's been set case PV_EP: clear_string_option(&buf->b_p_ep); break; @@ -5071,7 +5069,7 @@ get_varp_scope(struct vimoption *p, int opt_flags) case PV_BKC: return (char_u *)&(curbuf->b_p_bkc); case PV_MENC: return (char_u *)&(curbuf->b_p_menc); } - return NULL; /* "cannot happen" */ + return NULL; // "cannot happen" } return get_varp(p); } @@ -5092,7 +5090,7 @@ get_option_varp_scope(int opt_idx, int opt_flags) static char_u * get_varp(struct vimoption *p) { - /* hidden option, always return NULL */ + // hidden option, always return NULL if (p->var == NULL) return NULL; @@ -5100,7 +5098,7 @@ get_varp(struct vimoption *p) { case PV_NONE: return p->var; - /* global option with local value: use local value if it's been set */ + // global option with local value: use local value if it's been set case PV_EP: return *curbuf->b_p_ep != NUL ? (char_u *)&curbuf->b_p_ep : p->var; case PV_KP: return *curbuf->b_p_kp != NUL @@ -5335,7 +5333,7 @@ get_varp(struct vimoption *p) #endif default: iemsg(_("E356: get_varp ERROR")); } - /* always return a valid pointer to avoid a crash! */ + // always return a valid pointer to avoid a crash! return (char_u *)&(curbuf->b_p_wm); } @@ -5486,7 +5484,7 @@ copy_winopt(winopt_T *from, winopt_T *to) mch_memmove(to->wo_script_ctx, from->wo_script_ctx, sizeof(to->wo_script_ctx)); #endif - check_winopt(to); /* don't want NULL pointers */ + check_winopt(to); // don't want NULL pointers } /* @@ -5627,7 +5625,7 @@ init_buf_opt_idx(void) buf_copy_options(buf_T *buf, int flags) { int should_copy = TRUE; - char_u *save_p_isk = NULL; /* init for GCC */ + char_u *save_p_isk = NULL; // init for GCC int dont_do_help; int did_isk = FALSE; @@ -5678,7 +5676,7 @@ buf_copy_options(buf_T *buf, int flags) if (!buf->b_p_initialized) { free_buf_options(buf, TRUE); - buf->b_p_ro = FALSE; /* don't copy readonly */ + buf->b_p_ro = FALSE; // don't copy readonly buf->b_p_tx = p_tx; buf->b_p_fenc = vim_strsave(p_fenc); switch (*p_ffs) @@ -5809,7 +5807,7 @@ buf_copy_options(buf_T *buf, int flags) COPY_OPT_SCTX(buf, BV_LISP); #endif #ifdef FEAT_SYN_HL - /* Don't copy 'syntax', it must be set */ + // Don't copy 'syntax', it must be set buf->b_p_syn = empty_option; buf->b_p_smc = p_smc; COPY_OPT_SCTX(buf, BV_SMC); @@ -5852,15 +5850,15 @@ buf_copy_options(buf_T *buf, int flags) buf->b_p_twsl = p_twsl; COPY_OPT_SCTX(buf, BV_TWSL); #endif - /* This isn't really an option, but copying the langmap and IME - * state from the current buffer is better than resetting it. */ + // This isn't really an option, but copying the langmap and IME + // state from the current buffer is better than resetting it. buf->b_p_iminsert = p_iminsert; COPY_OPT_SCTX(buf, BV_IMI); buf->b_p_imsearch = p_imsearch; COPY_OPT_SCTX(buf, BV_IMS); - /* options that are normally global but also have a local value - * are not copied, start using the global value */ + // options that are normally global but also have a local value + // are not copied, start using the global value buf->b_p_ar = -1; buf->b_p_ul = NO_LOCAL_UNDOLEVEL; buf->b_p_bkc = empty_option; @@ -5951,7 +5949,7 @@ buf_copy_options(buf_T *buf, int flags) buf->b_p_initialized = TRUE; } - check_buf_options(buf); /* make sure we don't have NULLs */ + check_buf_options(buf); // make sure we don't have NULLs if (did_isk) (void)buf_init_chartab(buf, FALSE); } @@ -5997,11 +5995,11 @@ static int expand_option_flags = 0; set_context_in_set_cmd( expand_T *xp, char_u *arg, - int opt_flags) /* OPT_GLOBAL and/or OPT_LOCAL */ + int opt_flags) // OPT_GLOBAL and/or OPT_LOCAL { int nextchar; - long_u flags = 0; /* init for GCC */ - int opt_idx = 0; /* init for GCC */ + long_u flags = 0; // init for GCC + int opt_idx = 0; // init for GCC char_u *p; char_u *s; int is_term_option = FALSE; @@ -6024,13 +6022,13 @@ set_context_in_set_cmd( while (p > arg) { s = p; - /* count number of backslashes before ' ' or ',' */ + // count number of backslashes before ' ' or ',' if (*p == ' ' || *p == ',') { while (s > arg && *(s - 1) == '\\') --s; } - /* break at a space with an even number of backslashes */ + // break at a space with an even number of backslashes if (*p == ' ' && ((p - s) & 1) == 0) { ++p; @@ -6052,10 +6050,10 @@ set_context_in_set_cmd( if (*arg == '<') { while (*p != '>') - if (*p++ == NUL) /* expand terminal option name */ + if (*p++ == NUL) // expand terminal option name return; key = get_special_key_code(arg + 1); - if (key == 0) /* unknown name */ + if (key == 0) // unknown name { xp->xp_context = EXPAND_NOTHING; return; @@ -6073,7 +6071,7 @@ set_context_in_set_cmd( if (*p != NUL) ++p; if (*p == NUL) - return; /* expand option name */ + return; // expand option name nextchar = *++p; is_term_option = TRUE; expand_option_name[2] = p[-2]; @@ -6081,7 +6079,7 @@ set_context_in_set_cmd( } else { - /* Allow * wildcard */ + // Allow * wildcard while (ASCII_ISALNUM(*p) || *p == '_' || *p == '*') p++; if (*p == NUL) @@ -6103,7 +6101,7 @@ set_context_in_set_cmd( } } } - /* handle "-=" and "+=" */ + // handle "-=" and "+=" if ((nextchar == '-' || nextchar == '+' || nextchar == '^') && p[1] == '=') { ++p; @@ -6160,7 +6158,7 @@ set_context_in_set_cmd( else { xp->xp_context = EXPAND_FILES; - /* for 'tags' need three backslashes for a space */ + // for 'tags' need three backslashes for a space if (p == (char_u *)&p_tags) xp->xp_backslash = XP_BS_THREE; else @@ -6168,11 +6166,11 @@ set_context_in_set_cmd( } } - /* For an option that is a list of file names, find the start of the - * last file name. */ + // For an option that is a list of file names, find the start of the + // last file name. for (p = arg + STRLEN(arg) - 1; p > xp->xp_pattern; --p) { - /* count number of backslashes before ' ' or ',' */ + // count number of backslashes before ' ' or ',' if (*p == ' ' || *p == ',') { s = p; @@ -6187,7 +6185,7 @@ set_context_in_set_cmd( } #ifdef FEAT_SPELL - /* for 'spellsuggest' start at "file:" */ + // for 'spellsuggest' start at "file:" if (options[opt_idx].var == (char_u *)&p_sps && STRNCMP(p, "file:", 5) == 0) { @@ -6207,8 +6205,8 @@ ExpandSettings( int *num_file, char_u ***file) { - int num_normal = 0; /* Nr of matching non-term-code settings */ - int num_term = 0; /* Nr of matching terminal code settings */ + int num_normal = 0; // Nr of matching non-term-code settings + int num_term = 0; // Nr of matching terminal code settings int opt_idx; int match; int count = 0; @@ -6217,12 +6215,11 @@ ExpandSettings( int is_term_opt; char_u name_buf[MAX_KEY_NAME_LEN]; static char *(names[]) = {"all", "termcap"}; - int ic = regmatch->rm_ic; /* remember the ignore-case flag */ + int ic = regmatch->rm_ic; // remember the ignore-case flag - /* do this loop twice: - * loop == 0: count the number of matching options - * loop == 1: copy the matching options into allocated memory - */ + // do this loop twice: + // loop == 0: count the number of matching options + // loop == 1: copy the matching options into allocated memory for (loop = 0; loop <= 1; ++loop) { regmatch->rm_ic = ic; @@ -6327,7 +6324,7 @@ ExpandSettings( /* * Check special key names. */ - regmatch->rm_ic = TRUE; /* ignore case here */ + regmatch->rm_ic = TRUE; // ignore case here for (opt_idx = 0; (str = get_key_name(opt_idx)) != NULL; opt_idx++) { name_buf[0] = '<'; @@ -6365,7 +6362,7 @@ ExpandSettings( int ExpandOldSetting(int *num_file, char_u ***file) { - char_u *var = NULL; /* init for GCC */ + char_u *var = NULL; // init for GCC char_u *buf; *num_file = 0; @@ -6385,15 +6382,15 @@ ExpandOldSetting(int *num_file, char_u ***file) if (expand_option_idx >= 0) { - /* put string of option value in NameBuff */ + // put string of option value in NameBuff option_value2string(&options[expand_option_idx], expand_option_flags); var = NameBuff; } else if (var == NULL) var = (char_u *)""; - /* A backslash is required before some characters. This is the reverse of - * what happens in do_set(). */ + // A backslash is required before some characters. This is the reverse of + // what happens in do_set(). buf = vim_strsave_escaped(var, escape_chars); if (buf == NULL) @@ -6403,8 +6400,8 @@ ExpandOldSetting(int *num_file, char_u ***file) } #ifdef BACKSLASH_IN_FILENAME - /* For MS-Windows et al. we don't double backslashes at the start and - * before a file name character. */ + // For MS-Windows et al. we don't double backslashes at the start and + // before a file name character. for (var = buf; *var != NUL; MB_PTR_ADV(var)) if (var[0] == '\\' && var[1] == '\\' && expand_option_idx >= 0 @@ -6426,7 +6423,7 @@ ExpandOldSetting(int *num_file, char_u ***file) static void option_value2string( struct vimoption *opp, - int opt_flags) /* OPT_GLOBAL and/or OPT_LOCAL */ + int opt_flags) // OPT_GLOBAL and/or OPT_LOCAL { char_u *varp; @@ -6443,19 +6440,19 @@ option_value2string( else sprintf((char *)NameBuff, "%ld", *(long *)varp); } - else /* P_STRING */ + else // P_STRING { varp = *(char_u **)(varp); - if (varp == NULL) /* just in case */ + if (varp == NULL) // just in case NameBuff[0] = NUL; #ifdef FEAT_CRYPT - /* don't show the actual value of 'key', only that it's set */ + // don't show the actual value of 'key', only that it's set else if (opp->var == (char_u *)&p_key && *varp) STRCPY(NameBuff, "*****"); #endif else if (opp->flags & P_EXPAND) home_replace(NULL, varp, NameBuff, MAXPATHL, FALSE); - /* Translate 'pastetoggle' into special key names */ + // Translate 'pastetoggle' into special key names else if ((char_u **)opp->var == &p_pt) str2specialbuf(p_pt, NameBuff, MAXPATHL); else @@ -6531,7 +6528,7 @@ paste_option_changed(void) */ if (!old_p_paste) { - /* save options for each buffer */ + // save options for each buffer FOR_ALL_BUFFERS(buf) { buf->b_p_tw_nopaste = buf->b_p_tw; @@ -6547,7 +6544,7 @@ paste_option_changed(void) #endif } - /* save global options */ + // save global options save_sm = p_sm; save_sta = p_sta; #ifdef FEAT_CMDL_INFO @@ -6557,7 +6554,7 @@ paste_option_changed(void) save_ri = p_ri; save_hkmap = p_hkmap; #endif - /* save global values for local buffer options */ + // save global values for local buffer options p_ai_nopaste = p_ai; p_et_nopaste = p_et; p_sts_nopaste = p_sts; @@ -6574,14 +6571,14 @@ paste_option_changed(void) * Always set the option values, also when 'paste' is set when it is * already on. */ - /* set options for each buffer */ + // set options for each buffer FOR_ALL_BUFFERS(buf) { - buf->b_p_tw = 0; /* textwidth is 0 */ - buf->b_p_wm = 0; /* wrapmargin is 0 */ - buf->b_p_sts = 0; /* softtabstop is 0 */ - buf->b_p_ai = 0; /* no auto-indent */ - buf->b_p_et = 0; /* no expandtab */ + buf->b_p_tw = 0; // textwidth is 0 + buf->b_p_wm = 0; // wrapmargin is 0 + buf->b_p_sts = 0; // softtabstop is 0 + buf->b_p_ai = 0; // no auto-indent + buf->b_p_et = 0; // no expandtab #ifdef FEAT_VARTABS if (buf->b_p_vsts) free_string_option(buf->b_p_vsts); @@ -6592,19 +6589,19 @@ paste_option_changed(void) #endif } - /* set global options */ - p_sm = 0; /* no showmatch */ - p_sta = 0; /* no smarttab */ + // set global options + p_sm = 0; // no showmatch + p_sta = 0; // no smarttab #ifdef FEAT_CMDL_INFO if (p_ru) - status_redraw_all(); /* redraw to remove the ruler */ - p_ru = 0; /* no ruler */ + status_redraw_all(); // redraw to remove the ruler + p_ru = 0; // no ruler #endif #ifdef FEAT_RIGHTLEFT - p_ri = 0; /* no reverse insert */ - p_hkmap = 0; /* no Hebrew keyboard */ + p_ri = 0; // no reverse insert + p_hkmap = 0; // no Hebrew keyboard #endif - /* set global values for local buffer options */ + // set global values for local buffer options p_tw = 0; p_wm = 0; p_sts = 0; @@ -6621,7 +6618,7 @@ paste_option_changed(void) */ else if (old_p_paste) { - /* restore options for each buffer */ + // restore options for each buffer FOR_ALL_BUFFERS(buf) { buf->b_p_tw = buf->b_p_tw_nopaste; @@ -6643,19 +6640,19 @@ paste_option_changed(void) #endif } - /* restore global options */ + // restore global options p_sm = save_sm; p_sta = save_sta; #ifdef FEAT_CMDL_INFO if (p_ru != save_ru) - status_redraw_all(); /* redraw to draw the ruler */ + status_redraw_all(); // redraw to draw the ruler p_ru = save_ru; #endif #ifdef FEAT_RIGHTLEFT p_ri = save_ri; p_hkmap = save_hkmap; #endif - /* set global values for local buffer options */ + // set global values for local buffer options p_ai = p_ai_nopaste; p_et = p_et_nopaste; p_sts = p_sts_nopaste; @@ -6701,7 +6698,7 @@ vimrc_found(char_u *fname, char_u *envname) p = vim_getenv(envname, &dofree); if (p == NULL) { - /* Set $MYVIMRC to the first vimrc file found. */ + // Set $MYVIMRC to the first vimrc file found. p = FullName_save(fname, FALSE); if (p != NULL) { @@ -6742,7 +6739,7 @@ option_was_set(char_u *name) int idx; idx = findoption(name); - if (idx < 0) /* unknown option */ + if (idx < 0) // unknown option return FALSE; if (options[idx].flags & P_WAS_SET) return TRUE; @@ -6811,7 +6808,7 @@ fill_breakat_flags(void) */ int can_bs( - int what) /* BS_INDENT, BS_EOL or BS_START */ + int what) // BS_INDENT, BS_EOL or BS_START { #ifdef FEAT_JOB_CHANNEL if (what == BS_START && bt_prompt(curbuf)) diff --git a/src/version.c b/src/version.c index c9d701ba1..93dc2a167 100644 --- a/src/version.c +++ b/src/version.c @@ -743,6 +743,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2392, +/**/ 2391, /**/ 2390, |