summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-01 21:11:22 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-01 21:11:22 +0100
commit5d18efecfd6c45d69f55268948a22cd0465bb955 (patch)
tree409afa09cb7fb8f4684e0399f2597ba5d16edbfa
parentfa5612c7d836eb789e0f8ff4b10461b8640a14b2 (diff)
downloadvim-git-5d18efecfd6c45d69f55268948a22cd0465bb955.tar.gz
patch 8.1.2378: using old C style commentsv8.1.2378
Problem: Using old C style comments. Solution: Use // comments where appropriate.
-rw-r--r--src/dict.c52
-rw-r--r--src/diff.c482
-rw-r--r--src/digraph.c796
-rw-r--r--src/dosinst.c398
-rw-r--r--src/edit.c1199
-rw-r--r--src/eval.c597
-rw-r--r--src/evalbuffer.c2
-rw-r--r--src/evalfunc.c490
-rw-r--r--src/version.c2
9 files changed, 2006 insertions, 2012 deletions
diff --git a/src/dict.c b/src/dict.c
index d26356928..5022a5fd0 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -15,10 +15,10 @@
#if defined(FEAT_EVAL) || defined(PROTO)
-/* List head for garbage collection. Although there can be a reference loop
- * from partial to dict to partial, we don't need to keep track of the partial,
- * since it will get freed when the dict is unused and gets freed. */
-static dict_T *first_dict = NULL; /* list of all dicts */
+// List head for garbage collection. Although there can be a reference loop
+// from partial to dict to partial, we don't need to keep track of the partial,
+// since it will get freed when the dict is unused and gets freed.
+static dict_T *first_dict = NULL;
/*
* Allocate an empty header for a dictionary.
@@ -31,7 +31,7 @@ dict_alloc(void)
d = ALLOC_CLEAR_ONE(dict_T);
if (d != NULL)
{
- /* Add the dict to the list of dicts for garbage collection. */
+ // Add the dict to the list of dicts for garbage collection.
if (first_dict != NULL)
first_dict->dv_used_prev = d;
d->dv_used_next = first_dict;
@@ -109,15 +109,15 @@ dict_free_contents(dict_T *d)
hashitem_T *hi;
dictitem_T *di;
- /* Lock the hashtab, we don't want it to resize while freeing items. */
+ // Lock the hashtab, we don't want it to resize while freeing items.
hash_lock(&d->dv_hashtab);
todo = (int)d->dv_hashtab.ht_used;
for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
{
- /* Remove the item before deleting it, just in case there is
- * something recursive causing trouble. */
+ // Remove the item before deleting it, just in case there is
+ // something recursive causing trouble.
di = HI2DI(hi);
hash_remove(&d->dv_hashtab, hi);
dictitem_free(di);
@@ -125,14 +125,14 @@ dict_free_contents(dict_T *d)
}
}
- /* The hashtab is still locked, it has to be re-initialized anyway */
+ // The hashtab is still locked, it has to be re-initialized anyway
hash_clear(&d->dv_hashtab);
}
static void
dict_free_dict(dict_T *d)
{
- /* Remove the dict from the list of dicts for garbage collection. */
+ // Remove the dict from the list of dicts for garbage collection.
if (d->dv_used_prev == NULL)
first_dict = d->dv_used_next;
else
@@ -176,9 +176,9 @@ dict_free_nonref(int copyID)
for (dd = first_dict; dd != NULL; dd = dd->dv_used_next)
if ((dd->dv_copyID & COPYID_MASK) != (copyID & COPYID_MASK))
{
- /* Free the Dictionary and ordinary items it contains, but don't
- * recurse into Lists and Dictionaries, they will be in the list
- * of dicts or list of lists. */
+ // Free the Dictionary and ordinary items it contains, but don't
+ // recurse into Lists and Dictionaries, they will be in the list
+ // of dicts or list of lists.
dict_free_contents(dd);
did_free = TRUE;
}
@@ -577,7 +577,7 @@ dict_find(dict_T *d, char_u *key, int len)
}
else
{
- /* Avoid a malloc/free by using buf[]. */
+ // Avoid a malloc/free by using buf[].
vim_strncpy(buf, key, len);
akey = buf;
}
@@ -764,7 +764,7 @@ dict_get_tv(char_u **arg, typval_T *rettv, int evaluate, int literal)
*/
if (*start != '}')
{
- if (eval1(&start, &tv, FALSE) == FAIL) /* recursive! */
+ if (eval1(&start, &tv, FALSE) == FAIL) // recursive!
return FAIL;
if (*start == '}')
return NOTDONE;
@@ -798,14 +798,14 @@ dict_get_tv(char_u **arg, typval_T *rettv, int evaluate, int literal)
key = tv_get_string_buf_chk(&tvkey, buf);
if (key == NULL)
{
- /* "key" is NULL when tv_get_string_buf_chk() gave an errmsg */
+ // "key" is NULL when tv_get_string_buf_chk() gave an errmsg
clear_tv(&tvkey);
goto failret;
}
}
*arg = skipwhite(*arg + 1);
- if (eval1(arg, &tv, evaluate) == FAIL) /* recursive! */
+ if (eval1(arg, &tv, evaluate) == FAIL) // recursive!
{
if (evaluate)
clear_tv(&tvkey);
@@ -881,8 +881,8 @@ dict_extend(dict_T *d1, dict_T *d2, char_u *action)
di1 = dict_find(d1, hi2->hi_key, -1);
if (d1->dv_scope != 0)
{
- /* Disallow replacing a builtin function in l: and g:.
- * Check the key to be valid when adding to any scope. */
+ // Disallow replacing a builtin function in l: and g:.
+ // Check the key to be valid when adding to any scope.
if (d1->dv_scope == VAR_DEF_SCOPE
&& HI2DI(hi2)->di_tv.v_type == VAR_FUNC
&& var_check_func_name(hi2->hi_key, di1 == NULL))
@@ -929,8 +929,8 @@ dict_lookup(hashitem_T *hi)
dict_equal(
dict_T *d1,
dict_T *d2,
- int ic, /* ignore case for strings */
- int recursive) /* TRUE when used recursively */
+ int ic, // ignore case for strings
+ int recursive) // TRUE when used recursively
{
hashitem_T *hi;
dictitem_T *item2;
@@ -1004,19 +1004,19 @@ dict_list(typval_T *argvars, typval_T *rettv, int what)
if (what == 0)
{
- /* keys() */
+ // keys()
li->li_tv.v_type = VAR_STRING;
li->li_tv.v_lock = 0;
li->li_tv.vval.v_string = vim_strsave(di->di_key);
}
else if (what == 1)
{
- /* values() */
+ // values()
copy_tv(&di->di_tv, &li->li_tv);
}
else
{
- /* items() */
+ // items()
l2 = list_alloc();
li->li_tv.v_type = VAR_LIST;
li->li_tv.v_lock = 0;
@@ -1079,7 +1079,7 @@ dict_set_items_ro(dict_T *di)
int todo = (int)di->dv_hashtab.ht_used;
hashitem_T *hi;
- /* Set readonly */
+ // Set readonly
for (hi = di->dv_hashtab.ht_array; todo > 0 ; ++hi)
{
if (HASHITEM_EMPTY(hi))
@@ -1139,4 +1139,4 @@ dict_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg)
}
}
-#endif /* defined(FEAT_EVAL) */
+#endif // defined(FEAT_EVAL)
diff --git a/src/diff.c b/src/diff.c
index dd5fb22f4..f99690454 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -24,7 +24,7 @@
static int diff_busy = FALSE; // using diff structs, don't change them
static int diff_need_update = FALSE; // ex_diffupdate needs to be called
-/* flags obtained from the 'diffopt' option */
+// flags obtained from the 'diffopt' option
#define DIFF_FILLER 0x001 // display filler lines
#define DIFF_IBLANK 0x002 // ignore empty lines
#define DIFF_ICASE 0x004 // ignore case
@@ -41,14 +41,14 @@ static int diff_flags = DIFF_INTERNAL | DIFF_FILLER | DIFF_CLOSE_OFF;
static long diff_algorithm = 0;
-#define LBUFLEN 50 /* length of line in diff file */
+#define LBUFLEN 50 // length of line in diff file
-static int diff_a_works = MAYBE; /* TRUE when "diff -a" works, FALSE when it
- doesn't work, MAYBE when not checked yet */
+static int diff_a_works = MAYBE; // TRUE when "diff -a" works, FALSE when it
+ // doesn't work, MAYBE when not checked yet
#if defined(MSWIN)
-static int diff_bin_works = MAYBE; /* TRUE when "diff --binary" works, FALSE
- when it doesn't work, MAYBE when not
- checked yet */
+static int diff_bin_works = MAYBE; // TRUE when "diff --binary" works, FALSE
+ // when it doesn't work, MAYBE when not
+ // checked yet
#endif
// used for diff input
@@ -124,8 +124,8 @@ diff_buf_adjust(win_T *win)
if (!win->w_p_diff)
{
- /* When there is no window showing a diff for this buffer, remove
- * it from the diffs. */
+ // When there is no window showing a diff for this buffer, remove
+ // it from the diffs.
FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == win->w_buffer && wp->w_p_diff)
break;
@@ -158,7 +158,7 @@ diff_buf_add(buf_T *buf)
int i;
if (diff_buf_idx(buf) != DB_COUNT)
- return; /* It's already there. */
+ return; // It's already there.
for (i = 0; i < DB_COUNT; ++i)
if (curtab->tp_diffbuf[i] == NULL)
@@ -254,7 +254,7 @@ diff_mark_adjust(
int idx;
tabpage_T *tp;
- /* Handle all tab pages that use the current buffer in a diff. */
+ // Handle all tab pages that use the current buffer in a diff.
FOR_ALL_TABPAGES(tp)
{
idx = diff_buf_idx_tp(curbuf, tp);
@@ -286,7 +286,7 @@ diff_mark_adjust_tp(
int inserted, deleted;
int n, off;
linenr_T last;
- linenr_T lnum_deleted = line1; /* lnum of remaining deletion */
+ linenr_T lnum_deleted = line1; // lnum of remaining deletion
int check_unchanged;
if (diff_internal())
@@ -301,19 +301,19 @@ diff_mark_adjust_tp(
if (line2 == MAXLNUM)
{
- /* mark_adjust(99, MAXLNUM, 9, 0): insert lines */
+ // mark_adjust(99, MAXLNUM, 9, 0): insert lines
inserted = amount;
deleted = 0;
}
else if (amount_after > 0)
{
- /* mark_adjust(99, 98, MAXLNUM, 9): a change that inserts lines*/
+ // mark_adjust(99, 98, MAXLNUM, 9): a change that inserts lines
inserted = amount_after;
deleted = 0;
}
else
{
- /* mark_adjust(98, 99, MAXLNUM, -2): delete lines */
+ // mark_adjust(98, 99, MAXLNUM, -2): delete lines
inserted = 0;
deleted = -amount_after;
}
@@ -322,9 +322,9 @@ diff_mark_adjust_tp(
dp = tp->tp_first_diff;
for (;;)
{
- /* If the change is after the previous diff block and before the next
- * diff block, thus not touching an existing change, create a new diff
- * block. Don't do this when ex_diffgetput() is busy. */
+ // If the change is after the previous diff block and before the next
+ // diff block, thus not touching an existing change, create a new diff
+ // block. Don't do this when ex_diffgetput() is busy.
if ((dp == NULL || dp->df_lnum[idx] - 1 > line2
|| (line2 == MAXLNUM && dp->df_lnum[idx] > line1))
&& (dprev == NULL
@@ -350,7 +350,7 @@ diff_mark_adjust_tp(
}
}
- /* if at end of the list, quit */
+ // if at end of the list, quit
if (dp == NULL)
break;
@@ -365,25 +365,25 @@ diff_mark_adjust_tp(
* 3 5 6
* 3 5 6
*/
- /* compute last line of this change */
+ // compute last line of this change
last = dp->df_lnum[idx] + dp->df_count[idx] - 1;
- /* 1. change completely above line1: nothing to do */
+ // 1. change completely above line1: nothing to do
if (last >= line1 - 1)
{
- /* 6. change below line2: only adjust for amount_after; also when
- * "deleted" became zero when deleted all lines between two diffs */
+ // 6. change below line2: only adjust for amount_after; also when
+ // "deleted" became zero when deleted all lines between two diffs
if (dp->df_lnum[idx] - (deleted + inserted != 0) > line2)
{
if (amount_after == 0)
- break; /* nothing left to change */
+ break; // nothing left to change
dp->df_lnum[idx] += amount_after;
}
else
{
check_unchanged = FALSE;
- /* 2. 3. 4. 5.: inserted/deleted lines touching this diff. */
+ // 2. 3. 4. 5.: inserted/deleted lines touching this diff.
if (deleted > 0)
{
if (dp->df_lnum[idx] >= line1)
@@ -391,12 +391,12 @@ diff_mark_adjust_tp(
off = dp->df_lnum[idx] - lnum_deleted;
if (last <= line2)
{
- /* 4. delete all lines of diff */
+ // 4. delete all lines of diff
if (dp->df_next != NULL
&& dp->df_next->df_lnum[idx] - 1 <= line2)
{
- /* delete continues in next diff, only do
- * lines until that one */
+ // delete continues in next diff, only do
+ // lines until that one
n = dp->df_next->df_lnum[idx] - lnum_deleted;
deleted -= n;
n -= dp->df_count[idx];
@@ -408,7 +408,7 @@ diff_mark_adjust_tp(
}
else
{
- /* 5. delete lines at or just before top of diff */
+ // 5. delete lines at or just before top of diff
n = off;
dp->df_count[idx] -= line2 - dp->df_lnum[idx] + 1;
check_unchanged = TRUE;
@@ -420,13 +420,13 @@ diff_mark_adjust_tp(
off = 0;
if (last < line2)
{
- /* 2. delete at end of diff */
+ // 2. delete at end of diff
dp->df_count[idx] -= last - lnum_deleted + 1;
if (dp->df_next != NULL
&& dp->df_next->df_lnum[idx] - 1 <= line2)
{
- /* delete continues in next diff, only do
- * lines until that one */
+ // delete continues in next diff, only do
+ // lines until that one
n = dp->df_next->df_lnum[idx] - 1 - last;
deleted -= dp->df_next->df_lnum[idx]
- lnum_deleted;
@@ -438,7 +438,7 @@ diff_mark_adjust_tp(
}
else
{
- /* 3. delete lines inside the diff */
+ // 3. delete lines inside the diff
n = 0;
dp->df_count[idx] -= deleted;
}
@@ -455,24 +455,24 @@ diff_mark_adjust_tp(
{
if (dp->df_lnum[idx] <= line1)
{
- /* inserted lines somewhere in this diff */
+ // inserted lines somewhere in this diff
dp->df_count[idx] += inserted;
check_unchanged = TRUE;
}
else
- /* inserted lines somewhere above this diff */
+ // inserted lines somewhere above this diff
dp->df_lnum[idx] += inserted;
}
if (check_unchanged)
- /* Check if inserted lines are equal, may reduce the
- * size of the diff. TODO: also check for equal lines
- * in the middle and perhaps split the block. */
+ // Check if inserted lines are equal, may reduce the
+ // size of the diff. TODO: also check for equal lines
+ // in the middle and perhaps split the block.
diff_check_unchanged(tp, dp);
}
}
- /* check if this block touches the previous one, may merge them. */
+ // check if this block touches the previous one, may merge them.
if (dprev != NULL && dprev->df_lnum[idx] + dprev->df_count[idx]
== dp->df_lnum[idx])
{
@@ -485,7 +485,7 @@ diff_mark_adjust_tp(
}
else
{
- /* Advance to next entry. */
+ // Advance to next entry.
dprev = dp;
dp = dp->df_next;
}
@@ -495,7 +495,7 @@ diff_mark_adjust_tp(
dp = tp->tp_first_diff;
while (dp != NULL)
{
- /* All counts are zero, remove this entry. */
+ // All counts are zero, remove this entry.
for (i = 0; i < DB_COUNT; ++i)
if (tp->tp_diffbuf[i] != NULL && dp->df_count[i] != 0)
break;
@@ -511,7 +511,7 @@ diff_mark_adjust_tp(
}
else
{
- /* Advance to next entry. */
+ // Advance to next entry.
dprev = dp;
dp = dp->df_next;
}
@@ -523,9 +523,9 @@ diff_mark_adjust_tp(
// Don't redraw right away, this updates the diffs, which can be slow.
need_diff_redraw = TRUE;
- /* Need to recompute the scroll binding, may remove or add filler
- * lines (e.g., when adding lines above w_topline). But it's slow when
- * making many changes, postpone until redrawing. */
+ // Need to recompute the scroll binding, may remove or add filler
+ // lines (e.g., when adding lines above w_topline). But it's slow when
+ // making many changes, postpone until redrawing.
diff_need_scrollbind = TRUE;
}
}
@@ -565,27 +565,27 @@ diff_check_unchanged(tabpage_T *tp, diff_T *dp)
char_u *line_org;
int dir = FORWARD;
- /* Find the first buffers, use it as the original, compare the other
- * buffer lines against this one. */
+ // Find the first buffers, use it as the original, compare the other
+ // buffer lines against this one.
for (i_org = 0; i_org < DB_COUNT; ++i_org)
if (tp->tp_diffbuf[i_org] != NULL)
break;
- if (i_org == DB_COUNT) /* safety check */
+ if (i_org == DB_COUNT) // safety check
return;
if (diff_check_sanity(tp, dp) == FAIL)
return;
- /* First check lines at the top, then at the bottom. */
+ // First check lines at the top, then at the bottom.
off_org = 0;
off_new = 0;
for (;;)
{
- /* Repeat until a line is found which is different or the number of
- * lines has become zero. */
+ // Repeat until a line is found which is different or the number of
+ // lines has become zero.
while (dp->df_count[i_org] > 0)
{
- /* Copy the line, the next ml_get() will invalidate it. */
+ // Copy the line, the next ml_get() will invalidate it.
if (dir == BACKWARD)
off_org = dp->df_count[i_org] - 1;
line_org = vim_strsave(ml_get_buf(tp->tp_diffbuf[i_org],
@@ -598,7 +598,7 @@ diff_check_unchanged(tabpage_T *tp, diff_T *dp)
continue;
if (dir == BACKWARD)
off_new = dp->df_count[i_new] - 1;
- /* if other buffer doesn't have this line, it was inserted */
+ // if other buffer doesn't have this line, it was inserted
if (off_new < 0 || off_new >= dp->df_count[i_new])
break;
if (diff_cmp(line_org, ml_get_buf(tp->tp_diffbuf[i_new],
@@ -607,11 +607,11 @@ diff_check_unchanged(tabpage_T *tp, diff_T *dp)
}
vim_free(line_org);
- /* Stop when a line isn't equal in all diff buffers. */
+ // Stop when a line isn't equal in all diff buffers.
if (i_new != DB_COUNT)
break;
- /* Line matched in all buffers, remove it from the diff. */
+ // Line matched in all buffers, remove it from the diff.
for (i_new = i_org; i_new < DB_COUNT; ++i_new)
if (tp->tp_diffbuf[i_new] != NULL)
{
@@ -662,8 +662,8 @@ diff_redraw(
if (dofold && foldmethodIsDiff(wp))
foldUpdateAll(wp);
#endif
- /* A change may have made filler lines invalid, need to take care
- * of that for other windows. */
+ // A change may have made filler lines invalid, need to take care
+ // of that for other windows.
n = diff_check(wp, wp->w_topline);
if ((wp != curwin && wp->w_topfill > 0) || n > 0)
{
@@ -1003,7 +1003,7 @@ check_external_diff(diffio_T *diffio)
for (;;)
{
- /* There must be a line that contains "1c1". */
+ // There must be a line that contains "1c1".
if (vim_fgets(linebuf, LBUFLEN, fd))
break;
if (STRNCMP(linebuf, "1c1", 3) == 0)
@@ -1018,13 +1018,13 @@ check_external_diff(diffio_T *diffio)
}
#ifdef FEAT_EVAL
- /* When using 'diffexpr' break here. */
+ // When using 'diffexpr' break here.
if (*p_dex != NUL)
break;
#endif
#if defined(MSWIN)
- /* If the "-a" argument works, also check if "--binary" works. */
+ // If the "-a" argument works, also check if "--binary" works.
if (ok && diff_a_works == MAYBE && diff_bin_works == MAYBE)
{
diff_a_works = TRUE;
@@ -1033,18 +1033,18 @@ check_external_diff(diffio_T *diffio)
}
if (!ok && diff_a_works == TRUE && diff_bin_works == TRUE)
{
- /* Tried --binary, but it failed. "-a" works though. */
+ // Tried --binary, but it failed. "-a" works though.
diff_bin_works = FALSE;
ok = TRUE;
}
#endif
- /* If we checked if "-a" works already, break here. */
+ // If we checked if "-a" works already, break here.
if (diff_a_works != MAYBE)
break;
diff_a_works = ok;
- /* If "-a" works break here, otherwise retry without "-a". */
+ // If "-a" works break here, otherwise retry without "-a".
if (ok)
break;
}
@@ -1172,12 +1172,12 @@ diff_file(diffio_T *dio)
void
ex_diffpatch(exarg_T *eap)
{
- char_u *tmp_orig; /* name of original temp file */
- char_u *tmp_new; /* name of patched temp file */
+ char_u *tmp_orig; // name of original temp file
+ char_u *tmp_new; // name of patched temp file
char_u *buf = NULL;
size_t buflen;
win_T *old_curwin = curwin;
- char_u *newname = NULL; /* name of patched file buffer */
+ char_u *newname = NULL; // name of patched file buffer
#ifdef UNIX
char_u dirbuf[MAXPATHL];
char_u *fullname = NULL;
@@ -1196,26 +1196,26 @@ ex_diffpatch(exarg_T *eap)
eap->arg, NULL, NULL,
(char_u *)_(BROWSE_FILTER_ALL_FILES), NULL);
if (browseFile == NULL)
- return; /* operation cancelled */
+ return; // operation cancelled
eap->arg = browseFile;
- cmdmod.browse = FALSE; /* don't let do_ecmd() browse again */
+ cmdmod.browse = FALSE; // don't let do_ecmd() browse again
}
#endif
- /* We need two temp file names. */
+ // We need two temp file names.
tmp_orig = vim_tempname('o', FALSE);
tmp_new = vim_tempname('n', FALSE);
if (tmp_orig == NULL || tmp_new == NULL)
goto theend;
- /* Write the current buffer to "tmp_orig". */
+ // Write the current buffer to "tmp_orig".
if (buf_write(curbuf, tmp_orig, NULL,
(linenr_T)1, curbuf->b_ml.ml_line_count,
NULL, FALSE, FALSE, FALSE, TRUE) == FAIL)
goto theend;
#ifdef UNIX
- /* Get the absolute path of the patchfile, changing directory below. */
+ // Get the absolute path of the patchfile, changing directory below.
fullname = FullName_save(eap->arg, FALSE);
#endif
esc_name = vim_strsave_shellescape(
@@ -1231,11 +1231,11 @@ ex_diffpatch(exarg_T *eap)
goto theend;
#ifdef UNIX
- /* Temporarily chdir to /tmp, to avoid patching files in the current
- * directory when the patch file contains more than one patch. When we
- * have our own temp dir use that instead, it will be cleaned up when we
- * exit (any .rej files created). Don't change directory if we can't
- * return to the current. */
+ // Temporarily chdir to /tmp, to avoid patching files in the current
+ // directory when the patch file contains more than one patch. When we
+ // have our own temp dir use that instead, it will be cleaned up when we
+ // exit (any .rej files created). Don't change directory if we can't
+ // return to the current.
if (mch_dirname(dirbuf, MAXPATHL) != OK || mch_chdir((char *)dirbuf) != 0)
dirbuf[0] = NUL;
else
@@ -1252,7 +1252,7 @@ ex_diffpatch(exarg_T *eap)
#ifdef FEAT_EVAL
if (*p_pex != NUL)
- /* Use 'patchexpr' to generate the new file. */
+ // Use 'patchexpr' to generate the new file.
eval_patch(tmp_orig,
# ifdef UNIX
fullname != NULL ? fullname :
@@ -1261,11 +1261,11 @@ ex_diffpatch(exarg_T *eap)
else
#endif
{
- /* Build the patch command and execute it. Ignore errors. Switch to
- * cooked mode to allow the user to respond to prompts. */
+ // Build the patch command and execute it. Ignore errors. Switch to
+ // cooked mode to allow the user to respond to prompts.
vim_snprintf((char *)buf, buflen, "patch -o %s %s < %s",
tmp_new, tmp_orig, esc_name);
- block_autocmds(); /* Avoid ShellCmdPost stuff */
+ block_autocmds(); // Avoid ShellCmdPost stuff
(void)call_shell(buf, SHELL_FILTER | SHELL_COOKED);
unblock_autocmds();
}
@@ -1279,10 +1279,10 @@ ex_diffpatch(exarg_T *eap)
}
#endif
- /* patch probably has written over the screen */
+ // patch probably has written over the screen
redraw_later(CLEAR);
- /* Delete any .orig or .rej file created. */
+ // Delete any .orig or .rej file created.
STRCPY(buf, tmp_new);
STRCAT(buf, ".orig");
mch_remove(buf);
@@ -1290,7 +1290,7 @@ ex_diffpatch(exarg_T *eap)
STRCAT(buf, ".rej");
mch_remove(buf);
- /* Only continue if the output file was created. */
+ // Only continue if the output file was created.
if (mch_stat((char *)tmp_new, &st) < 0 || st.st_size == 0)
emsg(_("E816: Cannot read patch output"));
else
@@ -1306,30 +1306,30 @@ ex_diffpatch(exarg_T *eap)
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
- /* don't use a new tab page, each tab page has its own diffs */
+ // don't use a new tab page, each tab page has its own diffs
cmdmod.tab = 0;
if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL)
{
- /* Pretend it was a ":split fname" command */
+ // Pretend it was a ":split fname" command
eap->cmdidx = CMD_split;
eap->arg = tmp_new;
do_exedit(eap, old_curwin);
- /* check that split worked and editing tmp_new */
+ // check that split worked and editing tmp_new
if (curwin != old_curwin && win_valid(old_curwin))
{
- /* Set 'diff', 'scrollbind' on and 'wrap' off. */
+ // Set 'diff', 'scrollbind' on and 'wrap' off.
diff_win_options(curwin, TRUE);
diff_win_options(old_curwin, TRUE);
if (newname != NULL)
{
- /* do a ":file filename.new" on the patched buffer */
+ // do a ":file filename.new" on the patched buffer
eap->arg = newname;
ex_file(eap);
- /* Do filetype detection with the new name. */
+ // Do filetype detection with the new name.
if (au_has_group((char_u *)"filetypedetect"))
do_cmdline_cmd((char_u *)":doau filetypedetect BufRead");
}
@@ -1369,35 +1369,35 @@ ex_diffsplit(exarg_T *eap)
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
- /* Need to compute w_fraction when no redraw happened yet. */
+ // Need to compute w_fraction when no redraw happened yet.
validate_cursor();
set_fraction(curwin);
- /* don't use a new tab page, each tab page has its own diffs */
+ // don't use a new tab page, each tab page has its own diffs
cmdmod.tab = 0;
if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL)
{
- /* Pretend it was a ":split fname" command */
+ // Pretend it was a ":split fname" command
eap->cmdidx = CMD_split;
curwin->w_p_diff = TRUE;
do_exedit(eap, old_curwin);
- if (curwin != old_curwin) /* split must have worked */
+ if (curwin != old_curwin) // split must have worked
{
- /* Set 'diff', 'scrollbind' on and 'wrap' off. */
+ // Set 'diff', 'scrollbind' on and 'wrap' off.
diff_win_options(curwin, TRUE);
if (win_valid(old_curwin))
{
diff_win_options(old_curwin, TRUE);
if (bufref_valid(&old_curbuf))
- /* Move the cursor position to that of the old window. */
+ // Move the cursor position to that of the old window.
curwin->w_cursor.lnum = diff_get_corresponding_line(
old_curbuf.br_buf, old_curwin->w_cursor.lnum);
}
- /* Now that lines are folded scroll to show the cursor at the same
- * relative position. */
+ // Now that lines are folded scroll to show the cursor at the same
+ // relative position.
scroll_to_fraction(curwin, curwin->w_height);
}
}
@@ -1409,7 +1409,7 @@ ex_diffsplit(exarg_T *eap)
void
ex_diffthis(exarg_T *eap UNUSED)
{
- /* Set 'diff', 'scrollbind' on and 'wrap' off. */
+ // Set 'diff', 'scrollbind' on and 'wrap' off.
diff_win_options(curwin, TRUE);
}
@@ -1433,18 +1433,18 @@ set_diff_option(win_T *wp, int value)
void
diff_win_options(
win_T *wp,
- int addbuf) /* Add buffer to diff. */
+ int addbuf) // Add buffer to diff.
{
# ifdef FEAT_FOLDING
win_T *old_curwin = curwin;
- /* close the manually opened folds */
+ // close the manually opened folds
curwin = wp;
newFoldLevel();
curwin = old_curwin;
# endif
- /* Use 'scrollbind' and 'cursorbind' when available */
+ // Use 'scrollbind' and 'cursorbind' when available
if (!wp->w_p_diff)
wp->w_p_scb_save = wp->w_p_scb;
wp->w_p_scb = TRUE;
@@ -1473,12 +1473,12 @@ diff_win_options(
wp->w_p_fen = TRUE;
wp->w_p_fdl = 0;
foldUpdateAll(wp);
- /* make sure topline is not halfway a fold */
+ // make sure topline is not halfway a fold
changed_window_setting_win(wp);
# endif
if (vim_strchr(p_sbo, 'h') == NULL)
do_cmdline_cmd((char_u *)"set sbo+=hor");
- /* Save the current values, to be restored in ex_diffoff(). */
+ // Save the current values, to be restored in ex_diffoff().
wp->w_p_diff_saved = TRUE;
set_diff_option(wp, TRUE);
@@ -1502,9 +1502,9 @@ ex_diffoff(exarg_T *eap)
{
if (eap->forceit ? wp->w_p_diff : wp == curwin)
{
- /* Set 'diff' off. If option values were saved in
- * diff_win_options(), restore the ones whose settings seem to have
- * been left over from diff mode. */
+ // Set 'diff' off. If option values were saved in
+ // diff_win_options(), restore the ones whose settings seem to have
+ // been left over from diff mode.
set_diff_option(wp, FALSE);
if (wp->w_p_diff_saved)
@@ -1526,8 +1526,8 @@ ex_diffoff(exarg_T *eap)
if (wp->w_p_fdl == 0)
wp->w_p_fdl = wp->w_p_fdl_save;
- /* Only restore 'foldenable' when 'foldmethod' is not
- * "manual", otherwise we continue to show the diff folds. */
+ // Only restore 'foldenable' when 'foldmethod' is not
+ // "manual", otherwise we continue to show the diff folds.
if (wp->w_p_fen)
wp->w_p_fen = foldmethodIsManual(wp) ? FALSE
: wp->w_p_fen_save;
@@ -1535,20 +1535,20 @@ ex_diffoff(exarg_T *eap)
foldUpdateAll(wp);
#endif
}
- /* remove filler lines */
+ // remove filler lines
wp->w_topfill = 0;
- /* make sure topline is not halfway a fold and cursor is
- * invalidated */
+ // make sure topline is not halfway a fold and cursor is
+ // invalidated
changed_window_setting_win(wp);
- /* Note: 'sbo' is not restored, it's a global option. */
+ // Note: 'sbo' is not restored, it's a global option.
diff_buf_adjust(wp);
}
diffwin |= wp->w_p_diff;
}
- /* Also remove hidden buffers from the list. */
+ // Also remove hidden buffers from the list.
if (eap->forceit)
diff_buf_clear();
@@ -1560,7 +1560,7 @@ ex_diffoff(exarg_T *eap)
diff_clear(curtab);
}
- /* Remove "hor" from from 'scrollopt' if there are no diff windows left. */
+ // Remove "hor" from from 'scrollopt' if there are no diff windows left.
if (!diffwin && vim_strchr(p_sbo, 'h') != NULL)
do_cmdline_cmd((char_u *)"set sbo-=hor");
}
@@ -1579,13 +1579,13 @@ diff_read(
diff_T *dprev = NULL;
diff_T *dp = curtab->tp_first_diff;
diff_T *dn, *dpl;
- char_u linebuf[LBUFLEN]; /* only need to hold the diff line */
+ char_u linebuf[LBUFLEN]; // only need to hold the diff line
char_u *line;
long off;
int i;
linenr_T lnum_orig, lnum_new;
long count_orig, count_new;
- int notset = TRUE; /* block "*dp" not set yet */
+ int notset = TRUE; // block "*dp" not set yet
enum {
DIFF_ED,
DIFF_UNIFIED,
@@ -1829,7 +1829,7 @@ diff_clear(tabpage_T *tp)
int
diff_check(win_T *wp, linenr_T lnum)
{
- int idx; /* index in tp_diffbuf[] for this buffer */
+ int idx; // index in tp_diffbuf[] for this buffer
diff_T *dp;
int maxcount;
int i;
@@ -1837,26 +1837,26 @@ diff_check(win_T *wp, linenr_T lnum)
int cmp;
if (curtab->tp_diff_invalid)
- ex_diffupdate(NULL); /* update after a big change */
+ ex_diffupdate(NULL); // update after a big change
- if (curtab->tp_first_diff == NULL || !wp->w_p_diff) /* no diffs at all */
+ if (curtab->tp_first_diff == NULL || !wp->w_p_diff) // no diffs at all
return 0;
- /* safety check: "lnum" must be a buffer line */
+ // safety check: "lnum" must be a buffer line
if (lnum < 1 || lnum > buf->b_ml.ml_line_count + 1)
return 0;
idx = diff_buf_idx(buf);
if (idx == DB_COUNT)
- return 0; /* no diffs for buffer "buf" */
+ return 0; // no diffs for buffer "buf"
#ifdef FEAT_FOLDING
- /* A closed fold never has filler lines. */
+ // A closed fold never has filler lines.
if (hasFoldingWin(wp, lnum, NULL, NULL, TRUE, NULL))
return 0;
#endif
- /* search for a change that includes "lnum" in the list of diffblocks. */
+ // search for a change that includes "lnum" in the list of diffblocks.
for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next)
if (lnum <= dp->df_lnum[idx] + dp->df_count[idx])
break;
@@ -1867,9 +1867,9 @@ diff_check(win_T *wp, linenr_T lnum)
{
int zero = FALSE;
- /* Changed or inserted line. If the other buffers have a count of
- * zero, the lines were inserted. If the other buffers have the same
- * count, check if the lines are identical. */
+ // Changed or inserted line. If the other buffers have a count of
+ // zero, the lines were inserted. If the other buffers have the same
+ // count, check if the lines are identical.
cmp = FALSE;
for (i = 0; i < DB_COUNT; ++i)
if (i != idx && curtab->tp_diffbuf[i] != NULL)
@@ -1879,36 +1879,36 @@ diff_check(win_T *wp, linenr_T lnum)
else
{
if (dp->df_count[i] != dp->df_count[idx])
- return -1; /* nr of lines changed. */
+ return -1; // nr of lines changed.
cmp = TRUE;
}
}
if (cmp)
{
- /* Compare all lines. If they are equal the lines were inserted
- * in some buffers, deleted in others, but not changed. */
+ // Compare all lines. If they are equal the lines were inserted
+ // in some buffers, deleted in others, but not changed.
for (i = 0; i < DB_COUNT; ++i)
if (i != idx && curtab->tp_diffbuf[i] != NULL
&& dp->df_count[i] != 0)
if (!diff_equal_entry(dp, idx, i))
return -1;
}
- /* If there is no buffer with zero lines then there is no difference
- * any longer. Happens when making a change (or undo) that removes
- * the difference. Can't remove the entry here, we might be halfway
- * updating the window. Just report the text as unchanged. Other
- * windows might still show the change though. */
+ // If there is no buffer with zero lines then there is no difference
+ // any longer. Happens when making a change (or undo) that removes
+ // the difference. Can't remove the entry here, we might be halfway
+ // updating the window. Just report the text as unchanged. Other
+ // windows might still show the change though.
if (zero == FALSE)
return 0;
return -2;
}
- /* If 'diffopt' doesn't contain "filler", return 0. */
+ // If 'diffopt' doesn't contain "filler", return 0.
if (!(diff_flags & DIFF_FILLER))
return 0;
- /* Insert filler lines above the line just below the change. Will return
- * 0 when this buf had the max count. */
+ // Insert filler lines above the line just below the change. Will return
+ // 0 when this buf had the max count.
maxcount = 0;
for (i = 0; i < DB_COUNT; ++i)
if (curtab->tp_diffbuf[i] != NULL && dp->df_count[i] > maxcount)
@@ -2035,7 +2035,7 @@ diff_check_fill(win_T *wp, linenr_T lnum)
{
int n;
- /* be quick when there are no filler lines */
+ // be quick when there are no filler lines
if (!(diff_flags & DIFF_FILLER))
return 0;
n = diff_check(wp, lnum);
@@ -2061,36 +2061,36 @@ diff_set_topline(win_T *fromwin, win_T *towin)
fromidx = diff_buf_idx(frombuf);
if (fromidx == DB_COUNT)
- return; /* safety check */
+ return; // safety check
if (curtab->tp_diff_invalid)
- ex_diffupdate(NULL); /* update after a big change */
+ ex_diffupdate(NULL); // update after a big change
towin->w_topfill = 0;
- /* search for a change that includes "lnum" in the list of diffblocks. */
+ // search for a change that includes "lnum" in the list of diffblocks.
for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next)
if (lnum <= dp->df_lnum[fromidx] + dp->df_count[fromidx])
break;
if (dp == NULL)
{
- /* After last change, compute topline relative to end of file; no
- * filler lines. */
+ // After last change, compute topline relative to end of file; no
+ // filler lines.
towin->w_topline = towin->w_buffer->b_ml.ml_line_count
- (frombuf->b_ml.ml_line_count - lnum);
}
else
{
- /* Find index for "towin". */
+ // Find index for "towin".
toidx = diff_buf_idx(towin->w_buffer);
if (toidx == DB_COUNT)
- return; /* safety check */
+ return; // safety check
towin->w_topline = lnum + (dp->df_lnum[toidx] - dp->df_lnum[fromidx]);
if (lnum >= dp->df_lnum[fromidx])
{
- /* Inside a change: compute filler lines. With three or more
- * buffers we need to know the largest count. */
+ // Inside a change: compute filler lines. With three or more
+ // buffers we need to know the largest count.
max_count = 0;
for (i = 0; i < DB_COUNT; ++i)
if (curtab->tp_diffbuf[i] != NULL
@@ -2099,24 +2099,24 @@ diff_set_topline(win_T *fromwin, win_T *towin)
if (dp->df_count[toidx] == dp->df_count[fromidx])
{
- /* same number of lines: use same filler count */
+ // same number of lines: use same filler count
towin->w_topfill = fromwin->w_topfill;
}
else if (dp->df_count[toidx] > dp->df_count[fromidx])
{
if (lnum == dp->df_lnum[fromidx] + dp->df_count[fromidx])
{
- /* more lines in towin and fromwin doesn't show diff
- * lines, only filler lines */
+ // more lines in towin and fromwin doesn't show diff
+ // lines, only filler lines
if (max_count - fromwin->w_topfill >= dp->df_count[toidx])
{
- /* towin also only shows filler lines */
+ // towin also only shows filler lines
towin->w_topline = dp->df_lnum[toidx]
+ dp->df_count[toidx];
towin->w_topfill = fromwin->w_topfill;
}
else
- /* towin still has some diff lines to show */
+ // towin still has some diff lines to show
towin->w_topline = dp->df_lnum[toidx]
+ max_count - fromwin->w_topfill;
}
@@ -2124,16 +2124,16 @@ diff_set_topline(win_T *fromwin, win_T *towin)
else if (towin->w_topline >= dp->df_lnum[toidx]
+ dp->df_count[toidx])
{
- /* less lines in towin and no diff lines to show: compute
- * filler lines */
+ // less lines in towin and no diff lines to show: compute
+ // filler lines
towin->w_topline = dp->df_lnum[toidx] + dp->df_count[toidx];
if (diff_flags & DIFF_FILLER)
{
if (lnum == dp->df_lnum[fromidx] + dp->df_count[fromidx])
- /* fromwin is also out of diff lines */
+ // fromwin is also out of diff lines
towin->w_topfill = fromwin->w_topfill;
else
- /* fromwin has some diff lines */
+ // fromwin has some diff lines
towin->w_topfill = dp->df_lnum[fromidx]
+ max_count - lnum;
}
@@ -2141,7 +2141,7 @@ diff_set_topline(win_T *fromwin, win_T *towin)
}
}
- /* safety check (if diff info gets outdated strange things may happen) */
+ // safety check (if diff info gets outdated strange things may happen)
towin->w_botfill = FALSE;
if (towin->w_topline > towin->w_buffer->b_ml.ml_line_count)
{
@@ -2154,7 +2154,7 @@ diff_set_topline(win_T *fromwin, win_T *towin)
towin->w_topfill = 0;
}
- /* When w_topline changes need to recompute w_botline and cursor position */
+ // When w_topline changes need to recompute w_botline and cursor position
invalidate_botline_win(towin);
changed_line_abv_curs_win(towin);
@@ -2287,7 +2287,7 @@ diffopt_changed(void)
diff_algorithm_new |= diff_indent_heuristic;
- /* Can't have both "horizontal" and "vertical". */
+ // Can't have both "horizontal" and "vertical".
if ((diff_flags_new & DIFF_HORIZONTAL) && (diff_flags_new & DIFF_VERTICAL))
return FAIL;
@@ -2304,8 +2304,8 @@ diffopt_changed(void)
diff_redraw(TRUE);
- /* recompute the scroll binding with the new option value, may
- * remove or add filler lines */
+ // recompute the scroll binding with the new option value, may
+ // remove or add filler lines
check_scrollbind((linenr_T)0, 0L);
return OK;
@@ -2346,8 +2346,8 @@ diffopt_closeoff(void)
diff_find_change(
win_T *wp,
linenr_T lnum,
- int *startp, /* first char of the change */
- int *endp) /* last char of the change */
+ int *startp, // first char of the change
+ int *endp) // last char of the change
{
char_u *line_org;
char_u *line_new;
@@ -2361,19 +2361,19 @@ diff_find_change(
char_u *p1, *p2;
int l;
- /* Make a copy of the line, the next ml_get() will invalidate it. */
+ // Make a copy of the line, the next ml_get() will invalidate it.
line_org = vim_strsave(ml_get_buf(wp->w_buffer, lnum, FALSE));
if (line_org == NULL)
return FALSE;
idx = diff_buf_idx(wp->w_buffer);
- if (idx == DB_COUNT) /* cannot happen */
+ if (idx == DB_COUNT) // cannot happen
{
vim_free(line_org);
return FALSE;
}
- /* search for a change that includes "lnum" in the list of diffblocks. */
+ // search for a change that includes "lnum" in the list of diffblocks.
for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next)
if (lnum <= dp->df_lnum[idx] + dp->df_count[idx])
break;
@@ -2388,14 +2388,14 @@ diff_find_change(
for (i = 0; i < DB_COUNT; ++i)
if (curtab->tp_diffbuf[i] != NULL && i != idx)
{
- /* Skip lines that are not in the other change (filler lines). */
+ // Skip lines that are not in the other change (filler lines).
if (off >= dp->df_count[i])
continue;
added = FALSE;
line_new = ml_get_buf(curtab->tp_diffbuf[i],
dp->df_lnum[i] + off, FALSE);
- /* Search for start of difference */
+ // Search for start of difference
si_org = si_new = 0;
while (line_org[si_org] != NUL)
{
@@ -2420,15 +2420,15 @@ diff_find_change(
}
if (has_mbyte)
{
- /* Move back to first byte of character in both lines (may
- * have "nn^" in line_org and "n^ in line_new). */
+ // Move back to first byte of character in both lines (may
+ // have "nn^" in line_org and "n^ in line_new).
si_org -= (*mb_head_off)(line_org, line_org + si_org);
si_new -= (*mb_head_off)(line_new, line_new + si_new);
}
if (*startp > si_org)
*startp = si_org;
- /* Search for end of difference, if any. */
+ // Search for end of difference, if any.
if (line_org[si_org] != NUL || line_new[si_new] != NUL)
{
ei_org = (int)STRLEN(line_org);
@@ -2485,7 +2485,7 @@ diff_infold(win_T *wp, linenr_T lnum)
int other = FALSE;
diff_T *dp;
- /* Return if 'diff' isn't set. */
+ // Return if 'diff' isn't set.
if (!wp->w_p_diff)
return FALSE;
@@ -2497,23 +2497,23 @@ diff_infold(win_T *wp, linenr_T lnum)
other = TRUE;
}
- /* return here if there are no diffs in the window */
+ // return here if there are no diffs in the window
if (idx == -1 || !other)
return FALSE;
if (curtab->tp_diff_invalid)
- ex_diffupdate(NULL); /* update after a big change */
+ ex_diffupdate(NULL); // update after a big change
- /* Return if there are no diff blocks. All lines will be folded. */
+ // Return if there are no diff blocks. All lines will be folded.
if (curtab->tp_first_diff == NULL)
return TRUE;
for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next)
{
- /* If this change is below the line there can't be any further match. */
+ // If this change is below the line there can't be any further match.
if (dp->df_lnum[idx] - diff_context > lnum)
break;
- /* If this change ends before the line we have a match. */
+ // If this change ends before the line we have a match.
if (dp->df_lnum[idx] + dp->df_count[idx] + diff_context > lnum)
return FALSE;
}
@@ -2581,7 +2581,7 @@ ex_diffgetput(exarg_T *eap)
int buf_empty;
int found_not_ma = FALSE;
- /* Find the current buffer in the list of diff buffers. */
+ // Find the current buffer in the list of diff buffers.
idx_cur = diff_buf_idx(curbuf);
if (idx_cur == DB_COUNT)
{
@@ -2591,7 +2591,7 @@ ex_diffgetput(exarg_T *eap)
if (*eap->arg == NUL)
{
- /* No argument: Find the other buffer in the list of diff buffers. */
+ // No argument: Find the other buffer in the list of diff buffers.
for (idx_other = 0; idx_other < DB_COUNT; ++idx_other)
if (curtab->tp_diffbuf[idx_other] != curbuf
&& curtab->tp_diffbuf[idx_other] != NULL)
@@ -2610,7 +2610,7 @@ ex_diffgetput(exarg_T *eap)
return;
}
- /* Check that there isn't a third buffer in the list */
+ // Check that there isn't a third buffer in the list
for (i = idx_other + 1; i < DB_COUNT; ++i)
if (curtab->tp_diffbuf[i] != curbuf
&& curtab->tp_diffbuf[i] != NULL
@@ -2622,19 +2622,19 @@ ex_diffgetput(exarg_T *eap)
}
else
{
- /* Buffer number or pattern given. Ignore trailing white space. */
+ // Buffer number or pattern given. Ignore trailing white space.
p = eap->arg + STRLEN(eap->arg);
while (p > eap->arg && VIM_ISWHITE(p[-1]))
--p;
for (i = 0; vim_isdigit(eap->arg[i]) && eap->arg + i < p; ++i)
;
- if (eap->arg + i == p) /* digits only */
+ if (eap->arg + i == p) // digits only
i = atol((char *)eap->arg);
else
{
i = buflist_findpat(eap->arg, p, FALSE, TRUE, FALSE);
if (i < 0)
- return; /* error message already given */
+ return; // error message already given
}
buf = buflist_findnr(i);
if (buf == NULL)
@@ -2643,7 +2643,7 @@ ex_diffgetput(exarg_T *eap)
return;
}
if (buf == curbuf)
- return; /* nothing to do */
+ return; // nothing to do
idx_other = diff_buf_idx(buf);
if (idx_other == DB_COUNT)
{
@@ -2654,11 +2654,11 @@ ex_diffgetput(exarg_T *eap)
diff_busy = TRUE;
- /* When no range given include the line above or below the cursor. */
+ // When no range given include the line above or below the cursor.
if (eap->addr_count == 0)
{
- /* Make it possible that ":diffget" on the last line gets line below
- * the cursor line when there is no difference above the cursor. */
+ // Make it possible that ":diffget" on the last line gets line below
+ // the cursor line when there is no difference above the cursor.
if (eap->cmdidx == CMD_diffget
&& eap->line1 == curbuf->b_ml.ml_line_count
&& diff_check(curwin, eap->line1) == 0
@@ -2677,15 +2677,15 @@ ex_diffgetput(exarg_T *eap)
{
idx_from = idx_cur;
idx_to = idx_other;
- /* Need to make the other buffer the current buffer to be able to make
- * changes in it. */
- /* set curwin/curbuf to buf and save a few things */
+ // Need to make the other buffer the current buffer to be able to make
+ // changes in it.
+ // set curwin/curbuf to buf and save a few things
aucmd_prepbuf(&aco, curtab->tp_diffbuf[idx_other]);
}
- /* May give the warning for a changed buffer here, which can trigger the
- * FileChangedRO autocommand, which may do nasty things and mess
- * everything up. */
+ // May give the warning for a changed buffer here, which can trigger the
+ // FileChangedRO autocommand, which may do nasty things and mess
+ // everything up.
if (!curbuf->b_changed)
{
change_warning(0);
@@ -2700,7 +2700,7 @@ ex_diffgetput(exarg_T *eap)
for (dp = curtab->tp_first_diff; dp != NULL; )
{
if (dp->df_lnum[idx_cur] > eap->line2 + off)
- break; /* past the range that was specified */
+ break; // past the range that was specified
dfree = NULL;
lnum = dp->df_lnum[idx_to];
@@ -2708,16 +2708,16 @@ ex_diffgetput(exarg_T *eap)
if (dp->df_lnum[idx_cur] + dp->df_count[idx_cur] > eap->line1 + off
&& u_save(lnum - 1, lnum + count) != FAIL)
{
- /* Inside the specified range and saving for undo worked. */
+ // Inside the specified range and saving for undo worked.
start_skip = 0;
end_skip = 0;
if (eap->addr_count > 0)
{
- /* A range was specified: check if lines need to be skipped. */
+ // A range was specified: check if lines need to be skipped.
start_skip = eap->line1 + off - dp->df_lnum[idx_cur];
if (start_skip > 0)
{
- /* range starts below start of current diff block */
+ // range starts below start of current diff block
if (start_skip > count)
{
lnum += count;
@@ -2736,14 +2736,14 @@ ex_diffgetput(exarg_T *eap)
- (eap->line2 + off);
if (end_skip > 0)
{
- /* range ends above end of current/from diff block */
- if (idx_cur == idx_from) /* :diffput */
+ // range ends above end of current/from diff block
+ if (idx_cur == idx_from) // :diffput
{
i = dp->df_count[idx_cur] - start_skip - end_skip;
if (count > i)
count = i;
}
- else /* :diffget */
+ else // :diffget
{
count -= end_skip;
end_skip = dp->df_count[idx_from] - start_skip - count;
@@ -2759,7 +2759,7 @@ ex_diffgetput(exarg_T *eap)
added = 0;
for (i = 0; i < count; ++i)
{
- /* remember deleting the last line of the buffer */
+ // remember deleting the last line of the buffer
buf_empty = curbuf->b_ml.ml_line_count == 1;
ml_delete(lnum, FALSE);
--added;
@@ -2780,8 +2780,8 @@ ex_diffgetput(exarg_T *eap)
++added;
if (buf_empty && curbuf->b_ml.ml_line_count == 2)
{
- /* Added the first line into an empty buffer, need to
- * delete the dummy empty line. */
+ // Added the first line into an empty buffer, need to
+ // delete the dummy empty line.
buf_empty = FALSE;
ml_delete((linenr_T)2, FALSE);
}
@@ -2792,8 +2792,8 @@ ex_diffgetput(exarg_T *eap)
if (start_skip == 0 && end_skip == 0)
{
- /* Check if there are any other buffers and if the diff is
- * equal in them. */
+ // Check if there are any other buffers and if the diff is
+ // equal in them.
for (i = 0; i < DB_COUNT; ++i)
if (curtab->tp_diffbuf[i] != NULL && i != idx_from
&& i != idx_to
@@ -2801,7 +2801,7 @@ ex_diffgetput(exarg_T *eap)
break;
if (i == DB_COUNT)
{
- /* delete the diff entry, the buffers are now equal here */
+ // delete the diff entry, the buffers are now equal here
dfree = dp;
dp = dp->df_next;
if (dprev == NULL)
@@ -2811,14 +2811,14 @@ ex_diffgetput(exarg_T *eap)
}
}
- /* Adjust marks. This will change the following entries! */
+ // Adjust marks. This will change the following entries!
if (added != 0)
{
mark_adjust(lnum, lnum + count - 1, (long)MAXLNUM, (long)added);
if (curwin->w_cursor.lnum >= lnum)
{
- /* Adjust the cursor position if it's in/after the changed
- * lines. */
+ // Adjust the cursor position if it's in/after the changed
+ // lines.
if (curwin->w_cursor.lnum >= lnum + count)
curwin->w_cursor.lnum += added;
else if (added < 0)
@@ -2829,22 +2829,22 @@ ex_diffgetput(exarg_T *eap)
if (dfree != NULL)
{
- /* Diff is deleted, update folds in other windows. */
+ // Diff is deleted, update folds in other windows.
#ifdef FEAT_FOLDING
diff_fold_update(dfree, idx_to);
#endif
vim_free(dfree);
}
else
- /* mark_adjust() may have changed the count in a wrong way */
+ // mark_adjust() may have changed the count in a wrong way
dp->df_count[idx_to] = new_count;
- /* When changing the current buffer, keep track of line numbers */
+ // When changing the current buffer, keep track of line numbers
if (idx_cur == idx_to)
off += added;
}
- /* If before the range or not deleted, go to next diff. */
+ // If before the range or not deleted, go to next diff.
if (dfree == NULL)
{
dprev = dp;
@@ -2852,12 +2852,12 @@ ex_diffgetput(exarg_T *eap)
}
}
- /* restore curwin/curbuf and a few other things */
+ // restore curwin/curbuf and a few other things
if (eap->cmdidx != CMD_diffget)
{
- /* Syncing undo only works for the current buffer, but we change
- * another buffer. Sync undo if the command was typed. This isn't
- * 100% right when ":diffput" is used in a function or mapping. */
+ // Syncing undo only works for the current buffer, but we change
+ // another buffer. Sync undo if the command was typed. This isn't
+ // 100% right when ":diffput" is used in a function or mapping.
if (KeyTyped)
u_sync(FALSE);
aucmd_restbuf(&aco);
@@ -2935,14 +2935,14 @@ diff_move_to(int dir, long count)
return FAIL;
if (curtab->tp_diff_invalid)
- ex_diffupdate(NULL); /* update after a big change */
+ ex_diffupdate(NULL); // update after a big change
- if (curtab->tp_first_diff == NULL) /* no diffs today */
+ if (curtab->tp_first_diff == NULL) // no diffs today
return FAIL;
while (--count >= 0)
{
- /* Check if already before first diff. */
+ // Check if already before first diff.
if (dir == BACKWARD && lnum <= curtab->tp_first_diff->df_lnum[idx])
break;
@@ -2961,11 +2961,11 @@ diff_move_to(int dir, long count)
}
}
- /* don't end up past the end of the file */
+ // don't end up past the end of the file
if (lnum > curbuf->b_ml.ml_line_count)
lnum = curbuf->b_ml.ml_line_count;
- /* When the cursor didn't move at all we fail. */
+ // When the cursor didn't move at all we fail.
if (lnum == curwin->w_cursor.lnum)
return FAIL;
@@ -2996,9 +2996,9 @@ diff_get_corresponding_line_int(
return lnum1;
if (curtab->tp_diff_invalid)
- ex_diffupdate(NULL); /* update after a big change */
+ ex_diffupdate(NULL); // update after a big change
- if (curtab->tp_first_diff == NULL) /* no diffs today */
+ if (curtab->tp_first_diff == NULL) // no diffs today
return lnum1;
for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next)
@@ -3007,7 +3007,7 @@ diff_get_corresponding_line_int(
return lnum1 - baseline;
if ((dp->df_lnum[idx1] + dp->df_count[idx1]) > lnum1)
{
- /* Inside the diffblock */
+ // Inside the diffblock
baseline = lnum1 - dp->df_lnum[idx1];
if (baseline > dp->df_count[idx2])
baseline = dp->df_count[idx2];
@@ -3031,7 +3031,7 @@ diff_get_corresponding_line_int(
- (dp->df_lnum[idx2] + dp->df_count[idx2]);
}
- /* If we get here then the cursor is after the last diff */
+ // If we get here then the cursor is after the last diff
return lnum1 - baseline;
}
@@ -3044,7 +3044,7 @@ diff_get_corresponding_line(buf_T *buf1, linenr_T lnum1)
{
linenr_T lnum = diff_get_corresponding_line_int(buf1, lnum1);
- /* don't end up past the end of the file */
+ // don't end up past the end of the file
if (lnum > curbuf->b_ml.ml_line_count)
return curbuf->b_ml.ml_line_count;
return lnum;
@@ -3063,25 +3063,25 @@ diff_lnum_win(linenr_T lnum, win_T *wp)
linenr_T n;
idx = diff_buf_idx(curbuf);
- if (idx == DB_COUNT) /* safety check */
+ if (idx == DB_COUNT) // safety check
return (linenr_T)0;
if (curtab->tp_diff_invalid)
- ex_diffupdate(NULL); /* update after a big change */
+ ex_diffupdate(NULL); // update after a big change
- /* search for a change that includes "lnum" in the list of diffblocks. */
+ // search for a change that includes "lnum" in the list of diffblocks.
for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next)
if (lnum <= dp->df_lnum[idx] + dp->df_count[idx])
break;
- /* When after the last change, compute relative to the last line number. */
+ // When after the last change, compute relative to the last line number.
if (dp == NULL)
return wp->w_buffer->b_ml.ml_line_count
- (curbuf->b_ml.ml_line_count - lnum);
- /* Find index for "wp". */
+ // Find index for "wp".
i = diff_buf_idx(wp->w_buffer);
- if (i == DB_COUNT) /* safety check */
+ if (i == DB_COUNT) // safety check
return (linenr_T)0;
n = lnum + (dp->df_lnum[i] - dp->df_lnum[idx]);
@@ -3276,13 +3276,13 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
int filler_lines;
int col;
- if (lnum < 0) /* ignore type error in {lnum} arg */
+ if (lnum < 0) // ignore type error in {lnum} arg
lnum = 0;
if (lnum != prev_lnum
|| changedtick != CHANGEDTICK(curbuf)
|| fnum != curbuf->b_fnum)
{
- /* New line, buffer, change: need to get the values. */
+ // New line, buffer, change: need to get the values.
filler_lines = diff_check(curwin, lnum);
if (filler_lines < 0)
{
@@ -3291,12 +3291,12 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
change_start = MAXCOL;
change_end = -1;
if (diff_find_change(curwin, lnum, &change_start, &change_end))
- hlID = HLF_ADD; /* added line */
+ hlID = HLF_ADD; // added line
else
- hlID = HLF_CHD; /* changed line */
+ hlID = HLF_CHD; // changed line
}
else
- hlID = HLF_ADD; /* added line */
+ hlID = HLF_ADD; // added line
}
else
hlID = (hlf_T)0;
@@ -3307,11 +3307,11 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
if (hlID == HLF_CHD || hlID == HLF_TXD)
{
- col = tv_get_number(&argvars[1]) - 1; /* ignore type error in {col} */
+ col = tv_get_number(&argvars[1]) - 1; // ignore type error in {col}
if (col >= change_start && col <= change_end)
- hlID = HLF_TXD; /* changed text */
+ hlID = HLF_TXD; // changed text
else
- hlID = HLF_CHD; /* changed line */
+ hlID = HLF_CHD; // changed line
}
rettv->vval.v_number = hlID == (hlf_T)0 ? 0 : (int)hlID;
#endif
diff --git a/src/digraph.c b/src/digraph.c
index 758c23d36..dd5920a24 100644
--- a/src/digraph.c
+++ b/src/digraph.c
@@ -26,7 +26,7 @@ typedef struct digraph
static void printdigraph(digr_T *dp, result_T *previous);
-/* digraphs added by the user */
+// digraphs added by the user
static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL};
/*
@@ -39,171 +39,171 @@ static digr_T digraphdefault[] =
/*
* ATARI digraphs
*/
- {{'C', ',', 128}, /* ~@ XX */
- {'u', '"', 129}, /*  */
- {'e', '\'', 130}, /* ‚ */
- {'a', '^', 131}, /* ƒ */
- {'a', '"', 132}, /* „ */
- {'a', '`', 133}, /* … */
- {'a', '@', 134}, /* † */
- {'c', ',', 135}, /* ~G XX */
- {'e', '^', 136}, /* ~H XX */
- {'e', '"', 137}, /* ‰ */
- {'e', '`', 138}, /* Š */
- {'i', '"', 139}, /* ‹ */
- {'i', '^', 140}, /* Π*/
- {'i', '`', 141}, /*  */
- {'A', '"', 142}, /* Ž */
- {'A', '@', 143}, /*  */
- {'E', '\'', 144}, /*  */
- {'a', 'e', 145}, /* ‘ */
- {'A', 'E', 146}, /* ’ */
- {'o', '^', 147}, /* “ */
- {'o', '"', 148}, /* ” */
- {'o', '`', 149}, /* • */
- {'u', '^', 150}, /* – */
- {'u', '`', 151}, /* — */
- {'y', '"', 152}, /* ˜ */
- {'O', '"', 153}, /* ™ */
- {'U', '"', 154}, /* š */
- {'c', '|', 155}, /* › */
- {'$', '$', 156}, /* œ */
- {'Y', '-', 157}, /* ~] XX */
- {'s', 's', 158}, /* ž */
- {'f', 'f', 159}, /* Ÿ */
- {'a', '\'', 160}, /*   */
- {'i', '\'', 161}, /* ¡ */
- {'o', '\'', 162}, /* ¢ */
- {'u', '\'', 163}, /* £ */
- {'n', '~', 164}, /* ¤ */
- {'N', '~', 165}, /* ¥ */
- {'a', 'a', 166}, /* ¦ */
- {'o', 'o', 167}, /* § */
- {'~', '?', 168}, /* ¨ */
- {'-', 'a', 169}, /* © */
- {'a', '-', 170}, /* ª */
- {'1', '2', 171}, /* « */
- {'1', '4', 172}, /* ¬ */
- {'~', '!', 173}, /* ­ */
- {'<', '<', 174}, /* ® */
- {'>', '>', 175}, /* ¯ */
- {'j', 'u', 230}, /* æ */
- {'o', '/', 237}, /* í */
- {'+', '-', 241}, /* ñ */
- {'>', '=', 242}, /* ò */
- {'<', '=', 243}, /* ó */
- {':', '-', 246}, /* ö */
- {'~', '~', 247}, /* ÷ */
- {'~', 'o', 248}, /* ø */
- {'2', '2', 253}, /* ý */
+ {{'C', ',', 128}, // ~@ XX
+ {'u', '"', 129}, // 
+ {'e', '\'', 130}, // ‚
+ {'a', '^', 131}, // ƒ
+ {'a', '"', 132}, // „
+ {'a', '`', 133}, // …
+ {'a', '@', 134}, // †
+ {'c', ',', 135}, // ~G XX
+ {'e', '^', 136}, // ~H XX
+ {'e', '"', 137}, // ‰
+ {'e', '`', 138}, // Š
+ {'i', '"', 139}, // ‹
+ {'i', '^', 140}, // Œ
+ {'i', '`', 141}, // 
+ {'A', '"', 142}, // Ž
+ {'A', '@', 143}, // 
+ {'E', '\'', 144}, // 
+ {'a', 'e', 145}, // ‘
+ {'A', 'E', 146}, // ’
+ {'o', '^', 147}, // “
+ {'o', '"', 148}, // ”
+ {'o', '`', 149}, // •
+ {'u', '^', 150}, // –
+ {'u', '`', 151}, // —
+ {'y', '"', 152}, // ˜
+ {'O', '"', 153}, // ™
+ {'U', '"', 154}, // š
+ {'c', '|', 155}, // ›
+ {'$', '$', 156}, // œ
+ {'Y', '-', 157}, // ~] XX
+ {'s', 's', 158}, // ž
+ {'f', 'f', 159}, // Ÿ
+ {'a', '\'', 160}, //  
+ {'i', '\'', 161}, // ¡
+ {'o', '\'', 162}, // ¢
+ {'u', '\'', 163}, // £
+ {'n', '~', 164}, // ¤
+ {'N', '~', 165}, // ¥
+ {'a', 'a', 166}, // ¦
+ {'o', 'o', 167}, // §
+ {'~', '?', 168}, // ¨
+ {'-', 'a', 169}, // ©
+ {'a', '-', 170}, // ª
+ {'1', '2', 171}, // «
+ {'1', '4', 172}, // ¬
+ {'~', '!', 173}, // ­
+ {'<', '<', 174}, // ®
+ {'>', '>', 175}, // ¯
+ {'j', 'u', 230}, // æ
+ {'o', '/', 237}, // í
+ {'+', '-', 241}, // ñ
+ {'>', '=', 242}, // ò
+ {'<', '=', 243}, // ó
+ {':', '-', 246}, // ö
+ {'~', '~', 247}, // ÷
+ {'~', 'o', 248}, // ø
+ {'2', '2', 253}, // ý
{NUL, NUL, NUL}
};
-#else /* !__MINT__ */
+#else // !__MINT__
# ifdef HPUX_DIGRAPHS
/*
* different HPUX digraphs
*/
- {{'A', '`', 161}, /* ¡ */
- {'A', '^', 162}, /* ¢ */
- {'E', '`', 163}, /* £ */
- {'E', '^', 164}, /* ¤ */
- {'E', '"', 165}, /* ¥ */
- {'I', '^', 166}, /* ¦ */
- {'I', '"', 167}, /* § */
- {'\'', '\'', 168}, /* ¨ */
- {'`', '`', 169}, /* © */
- {'^', '^', 170}, /* ª */
- {'"', '"', 171}, /* « */
- {'~', '~', 172}, /* ¬ */
- {'U', '`', 173}, /* ­ */
- {'U', '^', 174}, /* ® */
- {'L', '=', 175}, /* ¯ */
- {'~', '_', 176}, /* ° */
- {'Y', '\'', 177}, /* ± */
- {'y', '\'', 178}, /* ² */
- {'~', 'o', 179}, /* ³ */
- {'C', ',', 180}, /* ´ */
- {'c', ',', 181}, /* µ */
- {'N', '~', 182}, /* ¶ */
- {'n', '~', 183}, /* · */
- {'~', '!', 184}, /* ¸ */
- {'~', '?', 185}, /* ¹ */
- {'o', 'x', 186}, /* º */
- {'L', '-', 187}, /* » */
- {'Y', '=', 188}, /* ¼ */
- {'p', 'p', 189}, /* ½ */
- {'f', 'l', 190}, /* ¾ */
- {'c', '|', 191}, /* ¿ */
- {'a', '^', 192}, /* À */
- {'e', '^', 193}, /* Á */
- {'o', '^', 194}, /* Â */
- {'u', '^', 195}, /* Ã */
- {'a', '\'', 196}, /* Ä */
- {'e', '\'', 197}, /* Å */
- {'o', '\'', 198}, /* Æ */
- {'u', '\'', 199}, /* Ç */
- {'a', '`', 200}, /* È */
- {'e', '`', 201}, /* É */
- {'o', '`', 202}, /* Ê */
- {'u', '`', 203}, /* Ë */
- {'a', '"', 204}, /* Ì */
- {'e', '"', 205}, /* Í */
- {'o', '"', 206}, /* Î */
- {'u', '"', 207}, /* Ï */
- {'A', 'o', 208}, /* Ð */
- {'i', '^', 209}, /* Ñ */
- {'O', '/', 210}, /* Ò */
- {'A', 'E', 211}, /* Ó */
- {'a', 'o', 212}, /* Ô */
- {'i', '\'', 213}, /* Õ */
- {'o', '/', 214}, /* Ö */
- {'a', 'e', 215}, /* × */
- {'A', '"', 216}, /* Ø */
- {'i', '`', 217}, /* Ù */
- {'O', '"', 218}, /* Ú */
- {'U', '"', 219}, /* Û */
- {'E', '\'', 220}, /* Ü */
- {'i', '"', 221}, /* Ý */
- {'s', 's', 222}, /* Þ */
- {'O', '^', 223}, /* ß */
- {'A', '\'', 224}, /* à */
- {'A', '~', 225}, /* á */
- {'a', '~', 226}, /* â */
- {'D', '-', 227}, /* ã */
- {'d', '-', 228}, /* ä */
- {'I', '\'', 229}, /* å */
- {'I', '`', 230}, /* æ */
- {'O', '\'', 231}, /* ç */
- {'O', '`', 232}, /* è */
- {'O', '~', 233}, /* é */
- {'o', '~', 234}, /* ê */
- {'S', '~', 235}, /* ë */
- {'s', '~', 236}, /* ì */
- {'U', '\'', 237}, /* í */
- {'Y', '"', 238}, /* î */
- {'y', '"', 239}, /* ï */
- {'p', '-', 240}, /* ð */
- {'p', '~', 241}, /* ñ */
- {'~', '.', 242}, /* ò */
- {'j', 'u', 243}, /* ó */
- {'P', 'p', 244}, /* ô */
- {'3', '4', 245}, /* õ */
- {'-', '-', 246}, /* ö */
- {'1', '4', 247}, /* ÷ */
- {'1', '2', 248}, /* ø */
- {'a', '_', 249}, /* ù */
- {'o', '_', 250}, /* ú */
- {'<', '<', 251}, /* û */
- {'x', 'x', 252}, /* ü */
- {'>', '>', 253}, /* ý */
- {'+', '-', 254}, /* þ */
- {'n', 'u', 255}, /* x XX */
+ {{'A', '`', 161}, // ¡
+ {'A', '^', 162}, // ¢
+ {'E', '`', 163}, // £
+ {'E', '^', 164}, // ¤
+ {'E', '"', 165}, // ¥
+ {'I', '^', 166}, // ¦
+ {'I', '"', 167}, // §
+ {'\'', '\'', 168}, // ¨
+ {'`', '`', 169}, // ©
+ {'^', '^', 170}, // ª
+ {'"', '"', 171}, // «
+ {'~', '~', 172}, // ¬
+ {'U', '`', 173}, // ­
+ {'U', '^', 174}, // ®
+ {'L', '=', 175}, // ¯
+ {'~', '_', 176}, // °
+ {'Y', '\'', 177}, // ±
+ {'y', '\'', 178}, // ²
+ {'~', 'o', 179}, // ³
+ {'C', ',', 180}, // ´
+ {'c', ',', 181}, // µ
+ {'N', '~', 182}, // ¶
+ {'n', '~', 183}, // ·
+ {'~', '!', 184}, // ¸
+ {'~', '?', 185}, // ¹
+ {'o', 'x', 186}, // º
+ {'L', '-', 187}, // »
+ {'Y', '=', 188}, // ¼
+ {'p', 'p', 189}, // ½
+ {'f', 'l', 190}, // ¾
+ {'c', '|', 191}, // ¿
+ {'a', '^', 192}, // À
+ {'e', '^', 193}, // Á
+ {'o', '^', 194}, // Â
+ {'u', '^', 195}, // Ã
+ {'a', '\'', 196}, // Ä
+ {'e', '\'', 197}, // Å
+ {'o', '\'', 198}, // Æ
+ {'u', '\'', 199}, // Ç
+ {'a', '`', 200}, // È
+ {'e', '`', 201}, // É
+ {'o', '`', 202}, // Ê
+ {'u', '`', 203}, // Ë
+ {'a', '"', 204}, // Ì
+ {'e', '"', 205}, // Í
+ {'o', '"', 206}, // Î
+ {'u', '"', 207}, // Ï
+ {'A', 'o', 208}, // Ð
+ {'i', '^', 209}, // Ñ
+ {'O', '/', 210}, // Ò
+ {'A', 'E', 211}, // Ó
+ {'a', 'o', 212}, // Ô
+ {'i', '\'', 213}, // Õ
+ {'o', '/', 214}, // Ö
+ {'a', 'e', 215}, // ×
+ {'A', '"', 216}, // Ø
+ {'i', '`', 217}, // Ù
+ {'O', '"', 218}, // Ú
+ {'U', '"', 219}, // Û
+ {'E', '\'', 220}, // Ü
+ {'i', '"', 221}, // Ý
+ {'s', 's', 222}, // Þ
+ {'O', '^', 223}, // ß
+ {'A', '\'', 224}, // à
+ {'A', '~', 225}, // á
+ {'a', '~', 226}, // â
+ {'D', '-', 227}, // ã
+ {'d', '-', 228}, // ä
+ {'I', '\'', 229}, // å
+ {'I', '`', 230}, // æ
+ {'O', '\'', 231}, // ç
+ {'O', '`', 232}, // è
+ {'O', '~', 233}, // é
+ {'o', '~', 234}, // ê
+ {'S', '~', 235}, // ë
+ {'s', '~', 236}, // ì
+ {'U', '\'', 237}, // í
+ {'Y', '"', 238}, // î
+ {'y', '"', 239}, // ï
+ {'p', '-', 240}, // ð
+ {'p', '~', 241}, // ñ
+ {'~', '.', 242}, // ò
+ {'j', 'u', 243}, // ó
+ {'P', 'p', 244}, // ô
+ {'3', '4', 245}, // õ
+ {'-', '-', 246}, // ö
+ {'1', '4', 247}, // ÷
+ {'1', '2', 248}, // ø
+ {'a', '_', 249}, // ù
+ {'o', '_', 250}, // ú
+ {'<', '<', 251}, // û
+ {'x', 'x', 252}, // ü
+ {'>', '>', 253}, // ý
+ {'+', '-', 254}, // þ
+ {'n', 'u', 255}, // x XX
{NUL, NUL, NUL}
};
-# else /* !HPUX_DIGRAPHS */
+# else // !HPUX_DIGRAPHS
# ifdef EBCDIC
@@ -211,107 +211,107 @@ static digr_T digraphdefault[] =
* EBCDIC - ISO digraphs
* TODO: EBCDIC Table is Code-Page 1047
*/
- {{'a', '^', 66}, /* â */
- {'a', '"', 67}, /* ä */
- {'a', '`', 68}, /* à */
- {'a', '\'', 69}, /* á */
- {'a', '~', 70}, /* ã */
- {'a', '@', 71}, /* å */
- {'a', 'a', 71}, /* å */
- {'c', ',', 72}, /* ç */
- {'n', '~', 73}, /* ñ */
- {'c', '|', 74}, /* ¢ */
- {'e', '\'', 81}, /* é */
- {'e', '^', 82}, /* ê */
- {'e', '"', 83}, /* ë */
- {'e', '`', 84}, /* è */
- {'i', '\'', 85}, /* í */
- {'i', '^', 86}, /* î */
- {'i', '"', 87}, /* ï */
- {'i', '`', 88}, /* ì */
- {'s', 's', 89}, /* ß */
- {'A', '^', 98}, /* Â */
- {'A', '"', 99}, /* Ä */
- {'A', '`', 100}, /* À */
- {'A', '\'', 101}, /* Á */
- {'A', '~', 102}, /* Ã */
- {'A', '@', 103}, /* Å */
- {'A', 'A', 103}, /* Å */
- {'C', ',', 104}, /* Ç */
- {'N', '~', 105}, /* Ñ */
- {'|', '|', 106}, /* ¦ */
- {'o', '/', 112}, /* ø */
- {'E', '\'', 113}, /* É */
- {'E', '^', 114}, /* Ê */
- {'E', '"', 115}, /* Ë */
- {'E', '`', 116}, /* È */
- {'I', '\'', 117}, /* Í */
- {'I', '^', 118}, /* Î */
- {'I', '"', 119}, /* Ï */
- {'I', '`', 120}, /* Ì */
- {'O', '/', 128}, /* 0/ XX */
- {'<', '<', 138}, /* « */
- {'>', '>', 139}, /* » */
- {'d', '-', 140}, /* ð */
- {'y', '\'', 141}, /* ý */
- {'i', 'p', 142}, /* þ */
- {'+', '-', 143}, /* ± */
- {'~', 'o', 144}, /* ° */
- {'a', '-', 154}, /* ª */
- {'o', '-', 155}, /* º */
- {'a', 'e', 156}, /* æ */
- {',', ',', 157}, /* , XX */
- {'A', 'E', 158}, /* Æ */
- {'o', 'x', 159}, /* ¤ - currency symbol in ISO 8859-1 */
- {'e', '=', 159}, /* ¤ - euro symbol in ISO 8859-15 */
- {'E', 'u', 159}, /* ¤ - euro symbol in ISO 8859-15 */
- {'j', 'u', 160}, /* µ */
- {'y', '"', 167}, /* x XX */
- {'~', '!', 170}, /* ¡ */
- {'~', '?', 171}, /* ¿ */
- {'D', '-', 172}, /* Ð */
- {'I', 'p', 174}, /* Þ */
- {'r', 'O', 175}, /* ® */
- {'-', ',', 176}, /* ¬ */
- {'$', '$', 177}, /* £ */
- {'Y', '-', 178}, /* ¥ */
- {'~', '.', 179}, /* · */
- {'c', 'O', 180}, /* © */
- {'p', 'a', 181}, /* § */
- {'p', 'p', 182}, /* ¶ */
- {'1', '4', 183}, /* ¼ */
- {'1', '2', 184}, /* ½ */
- {'3', '4', 185}, /* ¾ */
- {'Y', '\'', 186}, /* Ý */
- {'"', '"', 187}, /* ¨ */
- {'-', '=', 188}, /* ¯ */
- {'\'', '\'', 190}, /* ´ */
- {'O', 'E', 191}, /* × - OE in ISO 8859-15 */
- {'/', '\\', 191}, /* × - multiplication symbol in ISO 8859-1 */
- {'-', '-', 202}, /* ­ */
- {'o', '^', 203}, /* ô */
- {'o', '"', 204}, /* ö */
- {'o', '`', 205}, /* ò */
- {'o', '\'', 206}, /* ó */
- {'o', '~', 207}, /* õ */
- {'1', '1', 218}, /* ¹ */
- {'u', '^', 219}, /* û */
- {'u', '"', 220}, /* ü */
- {'u', '`', 221}, /* ù */
- {'u', '\'', 222}, /* ú */
- {':', '-', 225}, /* ÷ - division symbol in ISO 8859-1 */
- {'o', 'e', 225}, /* ÷ - oe in ISO 8859-15 */
- {'2', '2', 234}, /* ² */
- {'O', '^', 235}, /* Ô */
- {'O', '"', 236}, /* Ö */
- {'O', '`', 237}, /* Ò */
- {'O', '\'', 238}, /* Ó */
- {'O', '~', 239}, /* Õ */
- {'3', '3', 250}, /* ³ */
- {'U', '^', 251}, /* Û */
- {'U', '"', 252}, /* Ü */
- {'U', '`', 253}, /* Ù */
- {'U', '\'', 254}, /* Ú */
+ {{'a', '^', 66}, // â
+ {'a', '"', 67}, // ä
+ {'a', '`', 68}, // à
+ {'a', '\'', 69}, // á
+ {'a', '~', 70}, // ã
+ {'a', '@', 71}, // å
+ {'a', 'a', 71}, // å
+ {'c', ',', 72}, // ç
+ {'n', '~', 73}, // ñ
+ {'c', '|', 74}, // ¢
+ {'e', '\'', 81}, // é
+ {'e', '^', 82}, // ê
+ {'e', '"', 83}, // ë
+ {'e', '`', 84}, // è
+ {'i', '\'', 85}, // í
+ {'i', '^', 86}, // î
+ {'i', '"', 87}, // ï
+ {'i', '`', 88}, // ì
+ {'s', 's', 89}, // ß
+ {'A', '^', 98}, // Â
+ {'A', '"', 99}, // Ä
+ {'A', '`', 100}, // À
+ {'A', '\'', 101}, // Á
+ {'A', '~', 102}, // Ã
+ {'A', '@', 103}, // Å
+ {'A', 'A', 103}, // Å
+ {'C', ',', 104}, // Ç
+ {'N', '~', 105}, // Ñ
+ {'|', '|', 106}, // ¦
+ {'o', '/', 112}, // ø
+ {'E', '\'', 113}, // É
+ {'E', '^', 114}, // Ê
+ {'E', '"', 115}, // Ë
+ {'E', '`', 116}, // È
+ {'I', '\'', 117}, // Í
+ {'I', '^', 118}, // Î
+ {'I', '"', 119}, // Ï
+ {'I', '`', 120}, // Ì
+ {'O', '/', 128}, // 0/ XX
+ {'<', '<', 138}, // «
+ {'>', '>', 139}, // »
+ {'d', '-', 140}, // ð
+ {'y', '\'', 141}, // ý
+ {'i', 'p', 142}, // þ
+ {'+', '-', 143}, // ±
+ {'~', 'o', 144}, // °
+ {'a', '-', 154}, // ª
+ {'o', '-', 155}, // º
+ {'a', 'e', 156}, // æ
+ {',', ',', 157}, // , XX
+ {'A', 'E', 158}, // Æ
+ {'o', 'x', 159}, // ¤ - currency symbol in ISO 8859-1
+ {'e', '=', 159}, // ¤ - euro symbol in ISO 8859-15
+ {'E', 'u', 159}, // ¤ - euro symbol in ISO 8859-15
+ {'j', 'u', 160}, // µ
+ {'y', '"', 167}, // x XX
+ {'~', '!', 170}, // ¡
+ {'~', '?', 171}, // ¿
+ {'D', '-', 172}, // Ð
+ {'I', 'p', 174}, // Þ
+ {'r', 'O', 175}, // ®
+ {'-', ',', 176}, // ¬
+ {'$', '$', 177}, // £
+ {'Y', '-', 178}, // ¥
+ {'~', '.', 179}, // ·
+ {'c', 'O', 180}, // ©
+ {'p', 'a', 181}, // §
+ {'p', 'p', 182}, // ¶
+ {'1', '4', 183}, // ¼
+ {'1', '2', 184}, // ½
+ {'3', '4', 185}, // ¾
+ {'Y', '\'', 186}, // Ý
+ {'"', '"', 187}, // ¨
+ {'-', '=', 188}, // ¯
+ {'\'', '\'', 190}, // ´
+ {'O', 'E', 191}, // × - OE in ISO 8859-15
+ {'/', '\\', 191}, // × - multiplication symbol in ISO 8859-1
+ {'-', '-', 202}, // ­
+ {'o', '^', 203}, // ô
+ {'o', '"', 204}, // ö
+ {'o', '`', 205}, // ò
+ {'o', '\'', 206}, // ó
+ {'o', '~', 207}, // õ
+ {'1', '1', 218}, // ¹
+ {'u', '^', 219}, // û
+ {'u', '"', 220}, // ü
+ {'u', '`', 221}, // ù
+ {'u', '\'', 222}, // ú
+ {':', '-', 225}, // ÷ - division symbol in ISO 8859-1
+ {'o', 'e', 225}, // ÷ - oe in ISO 8859-15
+ {'2', '2', 234}, // ²
+ {'O', '^', 235}, // Ô
+ {'O', '"', 236}, // Ö
+ {'O', '`', 237}, // Ò
+ {'O', '\'', 238}, // Ó
+ {'O', '~', 239}, // Õ
+ {'3', '3', 250}, // ³
+ {'U', '^', 251}, // Û
+ {'U', '"', 252}, // Ü
+ {'U', '`', 253}, // Ù
+ {'U', '\'', 254}, // Ú
{NUL, NUL, NUL}
};
@@ -321,116 +321,116 @@ static digr_T digraphdefault[] =
/*
* digraphs compatible with Vim 5.x
*/
- {{'~', '!', 161}, /* ¡ */
- {'c', '|', 162}, /* ¢ */
- {'$', '$', 163}, /* £ */
- {'o', 'x', 164}, /* ¤ - currency symbol in ISO 8859-1 */
- {'e', '=', 164}, /* ¤ - euro symbol in ISO 8859-15 */
- {'Y', '-', 165}, /* ¥ */
- {'|', '|', 166}, /* ¦ */
- {'p', 'a', 167}, /* § */
- {'"', '"', 168}, /* ¨ */
- {'c', 'O', 169}, /* © */
- {'a', '-', 170}, /* ª */
- {'<', '<', 171}, /* « */
- {'-', ',', 172}, /* ¬ */
- {'-', '-', 173}, /* ­ */
- {'r', 'O', 174}, /* ® */
- {'-', '=', 175}, /* ¯ */
- {'~', 'o', 176}, /* ° */
- {'+', '-', 177}, /* ± */
- {'2', '2', 178}, /* ² */
- {'3', '3', 179}, /* ³ */
- {'\'', '\'', 180}, /* ´ */
- {'j', 'u', 181}, /* µ */
- {'p', 'p', 182}, /* ¶ */
- {'~', '.', 183}, /* · */
- {',', ',', 184}, /* ¸ */
- {'1', '1', 185}, /* ¹ */
- {'o', '-', 186}, /* º */
- {'>', '>', 187}, /* » */
- {'1', '4', 188}, /* ¼ */
- {'1', '2', 189}, /* ½ */
- {'3', '4', 190}, /* ¾ */
- {'~', '?', 191}, /* ¿ */
- {'A', '`', 192}, /* À */
- {'A', '\'', 193}, /* Á */
- {'A', '^', 194}, /* Â */
- {'A', '~', 195}, /* Ã */
- {'A', '"', 196}, /* Ä */
- {'A', '@', 197}, /* Å */
- {'A', 'A', 197}, /* Å */
- {'A', 'E', 198}, /* Æ */
- {'C', ',', 199}, /* Ç */
- {'E', '`', 200}, /* È */
- {'E', '\'', 201}, /* É */
- {'E', '^', 202}, /* Ê */
- {'E', '"', 203}, /* Ë */
- {'I', '`', 204}, /* Ì */
- {'I', '\'', 205}, /* Í */
- {'I', '^', 206}, /* Î */
- {'I', '"', 207}, /* Ï */
- {'D', '-', 208}, /* Ð */
- {'N', '~', 209}, /* Ñ */
- {'O', '`', 210}, /* Ò */
- {'O', '\'', 211}, /* Ó */
- {'O', '^', 212}, /* Ô */
- {'O', '~', 213}, /* Õ */
- {'O', '"', 214}, /* Ö */
- {'/', '\\', 215}, /* × - multiplication symbol in ISO 8859-1 */
- {'O', 'E', 215}, /* × - OE in ISO 8859-15 */
- {'O', '/', 216}, /* Ø */
- {'U', '`', 217}, /* Ù */
- {'U', '\'', 218}, /* Ú */
- {'U', '^', 219}, /* Û */
- {'U', '"', 220}, /* Ü */
- {'Y', '\'', 221}, /* Ý */
- {'I', 'p', 222}, /* Þ */
- {'s', 's', 223}, /* ß */
- {'a', '`', 224}, /* à */
- {'a', '\'', 225}, /* á */
- {'a', '^', 226}, /* â */
- {'a', '~', 227}, /* ã */
- {'a', '"', 228}, /* ä */
- {'a', '@', 229}, /* å */
- {'a', 'a', 229}, /* å */
- {'a', 'e', 230}, /* æ */
- {'c', ',', 231}, /* ç */
- {'e', '`', 232}, /* è */
- {'e', '\'', 233}, /* é */
- {'e', '^', 234}, /* ê */
- {'e', '"', 235}, /* ë */
- {'i', '`', 236}, /* ì */
- {'i', '\'', 237}, /* í */
- {'i', '^', 238}, /* î */
- {'i', '"', 239}, /* ï */
- {'d', '-', 240}, /* ð */
- {'n', '~', 241}, /* ñ */
- {'o', '`', 242}, /* ò */
- {'o', '\'', 243}, /* ó */
- {'o', '^', 244}, /* ô */
- {'o', '~', 245}, /* õ */
- {'o', '"', 246}, /* ö */
- {':', '-', 247}, /* ÷ - division symbol in ISO 8859-1 */
- {'o', 'e', 247}, /* ÷ - oe in ISO 8859-15 */
- {'o', '/', 248}, /* ø */
- {'u', '`', 249}, /* ù */
- {'u', '\'', 250}, /* ú */
- {'u', '^', 251}, /* û */
- {'u', '"', 252}, /* ü */
- {'y', '\'', 253}, /* ý */
- {'i', 'p', 254}, /* þ */
- {'y', '"', 255}, /* x XX */
+ {{'~', '!', 161}, // ¡
+ {'c', '|', 162}, // ¢
+ {'$', '$', 163}, // £
+ {'o', 'x', 164}, // ¤ - currency symbol in ISO 8859-1
+ {'e', '=', 164}, // ¤ - euro symbol in ISO 8859-15
+ {'Y', '-', 165}, // ¥
+ {'|', '|', 166}, // ¦
+ {'p', 'a', 167}, // §
+ {'"', '"', 168}, // ¨
+ {'c', 'O', 169}, // ©
+ {'a', '-', 170}, // ª
+ {'<', '<', 171}, // «
+ {'-', ',', 172}, // ¬
+ {'-', '-', 173}, // ­
+ {'r', 'O', 174}, // ®
+ {'-', '=', 175}, // ¯
+ {'~', 'o', 176}, // °
+ {'+', '-', 177}, // ±
+ {'2', '2', 178}, // ²
+ {'3', '3', 179}, // ³
+ {'\'', '\'', 180}, // ´
+ {'j', 'u', 181}, // µ
+ {'p', 'p', 182}, // ¶
+ {'~', '.', 183}, // ·
+ {',', ',', 184}, // ¸
+ {'1', '1', 185}, // ¹
+ {'o', '-', 186}, // º
+ {'>', '>', 187}, // »
+ {'1', '4', 188}, // ¼
+ {'1', '2', 189}, // ½
+ {'3', '4', 190}, // ¾
+ {'~', '?', 191}, // ¿
+ {'A', '`', 192}, // À
+ {'A', '\'', 193}, // Á
+ {'A', '^', 194}, // Â
+ {'A', '~', 195}, // Ã
+ {'A', '"', 196}, // Ä
+ {'A', '@', 197}, // Å
+ {'A', 'A', 197}, // Å
+ {'A', 'E', 198}, // Æ
+ {'C', ',', 199}, // Ç
+ {'E', '`', 200}, // È
+ {'E', '\'', 201}, // É
+ {'E', '^', 202}, // Ê
+ {'E', '"', 203}, // Ë
+ {'I', '`', 204}, // Ì
+ {'I', '\'', 205}, // Í
+ {'I', '^', 206}, // Î
+ {'I', '"', 207}, // Ï
+ {'D', '-', 208}, // Ð
+ {'N', '~', 209}, // Ñ
+ {'O', '`', 210}, // Ò
+ {'O', '\'', 211}, // Ó
+ {'O', '^', 212}, // Ô
+ {'O', '~', 213}, // Õ
+ {'O', '"', 214}, // Ö
+ {'/', '\\', 215}, // × - multiplication symbol in ISO 8859-1
+ {'O', 'E', 215}, // × - OE in ISO 8859-15
+ {'O', '/', 216}, // Ø
+ {'U', '`', 217}, // Ù
+ {'U', '\'', 218}, // Ú
+ {'U', '^', 219}, // Û
+ {'U', '"', 220}, // Ü
+ {'Y', '\'', 221}, // Ý
+ {'I', 'p', 222}, // Þ
+ {'s', 's', 223}, // ß
+ {'a', '`', 224}, // à
+ {'a', '\'', 225}, // á
+ {'a', '^', 226}, // â
+ {'a', '~', 227}, // ã
+ {'a', '"', 228}, // ä
+ {'a', '@', 229}, // å
+ {'a', 'a', 229}, // å
+ {'a', 'e', 230}, // æ
+ {'c', ',', 231}, // ç
+ {'e', '`', 232}, // è
+ {'e', '\'', 233}, // é
+ {'e', '^', 234}, // ê
+ {'e', '"', 235}, // ë
+ {'i', '`', 236}, // ì
+ {'i', '\'', 237}, // í
+ {'i', '^', 238}, // î
+ {'i', '"', 239}, // ï
+ {'d', '-', 240}, // ð
+ {'n', '~', 241}, // ñ
+ {'o', '`', 242}, // ò
+ {'o', '\'', 243}, // ó
+ {'o', '^', 244}, // ô
+ {'o', '~', 245}, // õ
+ {'o', '"', 246}, // ö
+ {':', '-', 247}, // ÷ - division symbol in ISO 8859-1
+ {'o', 'e', 247}, // ÷ - oe in ISO 8859-15
+ {'o', '/', 248}, // ø
+ {'u', '`', 249}, // ù
+ {'u', '\'', 250}, // ú
+ {'u', '^', 251}, // û
+ {'u', '"', 252}, // ü
+ {'y', '\'', 253}, // ý
+ {'i', 'p', 254}, // þ
+ {'y', '"', 255}, // x XX
{NUL, NUL, NUL}
};
-# else /* OLD_DIGRAPHS */
+# else // OLD_DIGRAPHS
/*
* digraphs for Unicode from RFC1345
* (also work for ISO-8859-1 aka latin1)
*/
{
- {'N', 'U', 0x0a}, /* LF for NUL */
+ {'N', 'U', 0x0a}, // LF for NUL
{'S', 'H', 0x01},
{'S', 'X', 0x02},
{'E', 'X', 0x03},
@@ -1287,10 +1287,10 @@ static digr_T digraphdefault[] =
{'L', 'i', 0x20a4},
{'P', 't', 0x20a7},
{'W', '=', 0x20a9},
- {'=', 'e', 0x20ac}, /* euro */
- {'E', 'u', 0x20ac}, /* euro */
- {'=', 'R', 0x20bd}, /* rouble */
- {'=', 'P', 0x20bd}, /* rouble */
+ {'=', 'e', 0x20ac}, // euro
+ {'E', 'u', 0x20ac}, // euro
+ {'=', 'R', 0x20bd}, // rouble
+ {'=', 'P', 0x20bd}, // rouble
#define DG_START_OTHER1 0x2103
{'o', 'C', 0x2103},
{'c', 'o', 0x2105},
@@ -1815,8 +1815,8 @@ static digr_T digraphdefault[] =
{'7', 'c', 0x3226},
{'8', 'c', 0x3227},
{'9', 'c', 0x3228},
- /* code points 0xe000 - 0xefff excluded, they have no assigned
- * characters, only used in proposals. */
+ // code points 0xe000 - 0xefff excluded, they have no assigned
+ // characters, only used in proposals.
{'f', 'f', 0xfb00},
{'f', 'i', 0xfb01},
{'f', 'l', 0xfb02},
@@ -1826,10 +1826,10 @@ static digr_T digraphdefault[] =
{NUL, NUL, NUL}
};
-# endif /* OLD_DIGRAPHS */
-# endif /* EBCDIC */
-# endif /* !HPUX_DIGRAPHS */
-#endif /* !__MINT__ */
+# endif // OLD_DIGRAPHS
+# endif // EBCDIC
+# endif // !HPUX_DIGRAPHS
+#endif // !__MINT__
/*
* handle digraphs after typing a character
@@ -1837,10 +1837,10 @@ static digr_T digraphdefault[] =
int
do_digraph(int c)
{
- static int backspaced; /* character before K_BS */
- static int lastchar; /* last typed character */
+ static int backspaced; // character before K_BS
+ static int lastchar; // last typed character
- if (c == -1) /* init values */
+ if (c == -1) // init values
{
backspaced = -1;
}
@@ -1921,7 +1921,7 @@ get_digraph_for_char(int val_arg)
*/
int
get_digraph(
- int cmdline) /* TRUE when called from the cmdline */
+ int cmdline) // TRUE when called from the cmdline
{
int c, cc;
@@ -1930,9 +1930,9 @@ get_digraph(
c = plain_vgetc();
--no_mapping;
--allow_keys;
- if (c != ESC) /* ESC cancels CTRL-K */
+ if (c != ESC) // ESC cancels CTRL-K
{
- if (IS_SPECIAL(c)) /* insert special key code */
+ if (IS_SPECIAL(c)) // insert special key code
return c;
if (cmdline)
{
@@ -1952,7 +1952,7 @@ get_digraph(
cc = plain_vgetc();
--no_mapping;
--allow_keys;
- if (cc != ESC) /* ESC cancels CTRL-K */
+ if (cc != ESC) // ESC cancels CTRL-K
return getdigraph(c, cc, TRUE);
}
return NUL;
@@ -2029,13 +2029,13 @@ getexactdigraph(int char1, int char2, int meta_char)
}
#endif
- /* Ignore multi-byte characters when not in multi-byte mode. */
+ // Ignore multi-byte characters when not in multi-byte mode.
if (!has_mbyte && retval > 0xff)
retval = 0;
- if (retval == 0) /* digraph deleted or not found */
+ if (retval == 0) // digraph deleted or not found
{
- if (char1 == ' ' && meta_char) /* <space> <char> --> meta-char */
+ if (char1 == ' ' && meta_char) // <space> <char> --> meta-char
return (char2 | 0x80);
return char2;
}
@@ -2094,7 +2094,7 @@ putdigraph(char_u *str)
}
n = getdigits(&str);
- /* If the digraph already exists, replace the result. */
+ // If the digraph already exists, replace the result.
dp = (digr_T *)user_digraphs.ga_data;
for (i = 0; i < user_digraphs.ga_len; ++i)
{
@@ -2106,7 +2106,7 @@ putdigraph(char_u *str)
++dp;
}
- /* Add a new digraph to the table. */
+ // Add a new digraph to the table.
if (i == user_digraphs.ga_len)
{
if (ga_grow(&user_digraphs, 1) == OK)
@@ -2147,7 +2147,7 @@ listdigraphs(int use_headers)
#if defined(USE_UNICODE_DIGRAPHS)
digr_T tmp;
- /* May need to convert the result to 'encoding'. */
+ // May need to convert the result to 'encoding'.
tmp.char1 = dp->char1;
tmp.char2 = dp->char2;
tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE);
@@ -2176,8 +2176,8 @@ listdigraphs(int use_headers)
ui_breakcheck();
++dp;
}
- must_redraw = CLEAR; /* clear screen, because some digraphs may be
- wrong, in which case we messed up ScreenLines */
+ must_redraw = CLEAR; // clear screen, because some digraphs may be
+ // wrong, in which case we messed up ScreenLines
}
static struct dg_header_entry {
@@ -2259,7 +2259,7 @@ printdigraph(digr_T *dp, result_T *previous)
p = buf;
if (has_mbyte)
{
- /* add a space to draw a composing char on */
+ // add a space to draw a composing char on
if (enc_utf8 && utf_iscomposing(dp->result))
*p++ = ' ';
p += (*mb_char2bytes)(dp->result, p);
@@ -2276,18 +2276,18 @@ printdigraph(digr_T *dp, result_T *previous)
}
}
-#endif /* FEAT_DIGRAPHS */
+#endif // FEAT_DIGRAPHS
#if defined(FEAT_KEYMAP) || defined(PROTO)
-/* structure used for b_kmap_ga.ga_data */
+// structure used for b_kmap_ga.ga_data
typedef struct
{
char_u *from;
char_u *to;
} kmap_T;
-#define KMAP_MAXLEN 20 /* maximum length of "from" or "to" */
+#define KMAP_MAXLEN 20 // maximum length of "from" or "to"
static void keymap_unload(void);
@@ -2304,8 +2304,8 @@ keymap_init(void)
if (*curbuf->b_p_keymap == NUL)
{
- /* Stop any active keymap and clear the table. Also remove
- * b:keymap_name, as no keymap is active now. */
+ // Stop any active keymap and clear the table. Also remove
+ // b:keymap_name, as no keymap is active now.
keymap_unload();
do_cmdline_cmd((char_u *)"unlet! b:keymap_name");
}
@@ -2314,19 +2314,19 @@ keymap_init(void)
char_u *buf;
size_t buflen;
- /* Source the keymap file. It will contain a ":loadkeymap" command
- * which will call ex_loadkeymap() below. */
+ // Source the keymap file. It will contain a ":loadkeymap" command
+ // which will call ex_loadkeymap() below.
buflen = STRLEN(curbuf->b_p_keymap) + STRLEN(p_enc) + 14;
buf = alloc(buflen);
if (buf == NULL)
return e_outofmem;
- /* try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' */
+ // try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath'
vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim",
curbuf->b_p_keymap, p_enc);
if (source_runtime(buf, 0) == FAIL)
{
- /* try finding "keymap/'keymap'.vim" in 'runtimepath' */
+ // try finding "keymap/'keymap'.vim" in 'runtimepath'
vim_snprintf((char *)buf, buflen, "keymap/%s.vim",
curbuf->b_p_keymap);
if (source_runtime(buf, 0) == FAIL)
@@ -2351,7 +2351,7 @@ ex_loadkeymap(exarg_T *eap)
char_u *p;
char_u *s;
kmap_T *kp;
-#define KMAP_LLEN 200 /* max length of "to" and "from" together */
+#define KMAP_LLEN 200 // max length of "to" and "from" together
char_u buf[KMAP_LLEN + 11];
int i;
char_u *save_cpo = p_cpo;
@@ -2370,7 +2370,7 @@ ex_loadkeymap(exarg_T *eap)
curbuf->b_kmap_state = 0;
ga_init2(&curbuf->b_kmap_ga, (int)sizeof(kmap_T), 20);
- /* Set 'cpoptions' to "C" to avoid line continuation. */
+ // Set 'cpoptions' to "C" to avoid line continuation.
p_cpo = (char_u *)"C";
/*
@@ -2438,10 +2438,10 @@ keymap_unload(void)
if (!(curbuf->b_kmap_state & KEYMAP_LOADED))
return;
- /* Set 'cpoptions' to "C" to avoid line continuation. */
+ // Set 'cpoptions' to "C" to avoid line continuation.
p_cpo = (char_u *)"C";
- /* clear the ":lmap"s */
+ // clear the ":lmap"s
kp = (kmap_T *)curbuf->b_kmap_ga.ga_data;
for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i)
{
@@ -2469,4 +2469,4 @@ keymap_clear(garray_T *kmap)
vim_free(kp[i].to);
}
}
-#endif /* FEAT_KEYMAP */
+#endif // FEAT_KEYMAP
diff --git a/src/dosinst.c b/src/dosinst.c
index 2ff08420e..2ded88ef3 100644
--- a/src/dosinst.c
+++ b/src/dosinst.c
@@ -23,7 +23,7 @@
#define GVIMEXT64_PATH "GvimExt64\\gvimext.dll"
#define GVIMEXT32_PATH "GvimExt32\\gvimext.dll"
-/* Macro to do an error check I was typing over and over */
+// Macro to do an error check I was typing over and over
#define CHECK_REG_ERROR(code) \
do { \
if (code != ERROR_SUCCESS) \
@@ -33,31 +33,31 @@
} \
} while (0)
-int has_vim = 0; /* installable vim.exe exists */
-int has_gvim = 0; /* installable gvim.exe exists */
+int has_vim = 0; // installable vim.exe exists
+int has_gvim = 0; // installable gvim.exe exists
-char oldvimrc[BUFSIZE]; /* name of existing vimrc file */
-char vimrc[BUFSIZE]; /* name of vimrc file to create */
+char oldvimrc[BUFSIZE]; // name of existing vimrc file
+char vimrc[BUFSIZE]; // name of vimrc file to create
-char *default_bat_dir = NULL; /* when not NULL, use this as the default
- directory to write .bat files in */
-char *default_vim_dir = NULL; /* when not NULL, use this as the default
- install dir for NSIS */
+char *default_bat_dir = NULL; // when not NULL, use this as the default
+ // directory to write .bat files in
+char *default_vim_dir = NULL; // when not NULL, use this as the default
+ // install dir for NSIS
/*
* Structure used for each choice the user can make.
*/
struct choice
{
- int active; /* non-zero when choice is active */
- char *text; /* text displayed for this choice */
- void (*changefunc)(int idx); /* function to change this choice */
- int arg; /* argument for function */
- void (*installfunc)(int idx); /* function to install this choice */
+ int active; // non-zero when choice is active
+ char *text; // text displayed for this choice
+ void (*changefunc)(int idx); // function to change this choice
+ int arg; // argument for function
+ void (*installfunc)(int idx); // function to install this choice
};
-struct choice choices[30]; /* choices the user can make */
-int choice_count = 0; /* number of choices available */
+struct choice choices[30]; // choices the user can make
+int choice_count = 0; // number of choices available
#define TABLE_SIZE(s) (int)(sizeof(s) / sizeof(*s))
@@ -123,13 +123,13 @@ static char *(vimfiles_dir_choices[]) =
"In your HOME directory",
};
-/* non-zero when selected to install the popup menu entry. */
+// non-zero when selected to install the popup menu entry.
static int install_popup = 0;
-/* non-zero when selected to install the "Open with" entry. */
+// non-zero when selected to install the "Open with" entry.
static int install_openwith = 0;
-/* non-zero when need to add an uninstall entry in the registry */
+// non-zero when need to add an uninstall entry in the registry
static int need_uninstall_entry = 0;
/*
@@ -191,7 +191,7 @@ check_unpack(void)
FILE *fd;
struct stat st;
- /* check for presence of the correct version number in installdir[] */
+ // check for presence of the correct version number in installdir[]
runtimeidx = strlen(installdir) - strlen(VIM_VERSION_NODOT);
if (runtimeidx <= 0
|| stricmp(installdir + runtimeidx, VIM_VERSION_NODOT) != 0
@@ -204,8 +204,8 @@ check_unpack(void)
myexit(1);
}
- /* check if filetype.vim is present, which means the runtime archive has
- * been unpacked */
+ // check if filetype.vim is present, which means the runtime archive has
+ // been unpacked
sprintf(buf, "%s\\filetype.vim", installdir);
if (stat(buf, &st) < 0)
{
@@ -216,7 +216,7 @@ check_unpack(void)
myexit(1);
}
- /* Check if vim.exe or gvim.exe is in the current directory. */
+ // Check if vim.exe or gvim.exe is in the current directory.
if ((fd = fopen("gvim.exe", "r")) != NULL)
{
fclose(fd);
@@ -251,32 +251,32 @@ pathcmp(char *p, int plen, char *q, int qlen)
qlen = strlen(q);
for (i = 0; ; ++i)
{
- /* End of "p": check if "q" also ends or just has a slash. */
+ // End of "p": check if "q" also ends or just has a slash.
if (i == plen)
{
- if (i == qlen) /* match */
+ if (i == qlen) // match
return 0;
if (i == qlen - 1 && (q[i] == '\\' || q[i] == '/'))
- return 0; /* match with trailing slash */
- return 1; /* no match */
+ return 0; // match with trailing slash
+ return 1; // no match
}
- /* End of "q": check if "p" also ends or just has a slash. */
+ // End of "q": check if "p" also ends or just has a slash.
if (i == qlen)
{
- if (i == plen) /* match */
+ if (i == plen) // match
return 0;
if (i == plen - 1 && (p[i] == '\\' || p[i] == '/'))
- return 0; /* match with trailing slash */
- return 1; /* no match */
+ return 0; // match with trailing slash
+ return 1; // no match
}
if (!(mytoupper(p[i]) == mytoupper(q[i])
|| ((p[i] == '/' || p[i] == '\\')
&& (q[i] == '/' || q[i] == '\\'))))
- return 1; /* no match */
+ return 1; // no match
}
- /*NOTREACHED*/
+ //NOTREACHED
}
/*
@@ -308,7 +308,7 @@ findoldfile(char **destination)
tmpname = alloc(strlen(cp) + 1);
strcpy(tmpname, cp);
- tmpname[strlen(tmpname) - 1] = 'x'; /* .exe -> .exx */
+ tmpname[strlen(tmpname) - 1] = 'x'; // .exe -> .exx
if (access(tmpname, 0) == 0)
{
@@ -347,7 +347,7 @@ find_bat_exe(int check_bat_only)
{
int i;
- /* avoid looking in the "installdir" by chdir to system root */
+ // avoid looking in the "installdir" by chdir to system root
mch_chdir(sysdrive);
mch_chdir("\\");
@@ -386,7 +386,7 @@ get_vim_env(void)
FILE *fd;
char fname[BUFSIZE];
- /* First get $VIMRUNTIME. If it's set, remove the tail. */
+ // First get $VIMRUNTIME. If it's set, remove the tail.
vim = getenv("VIMRUNTIME");
if (vim != NULL && *vim != 0 && strlen(vim) < sizeof(buf))
{
@@ -399,18 +399,18 @@ get_vim_env(void)
vim = getenv("VIM");
if (vim == NULL || *vim == 0)
{
- /* Use the directory from an old uninstall entry. */
+ // Use the directory from an old uninstall entry.
if (default_vim_dir != NULL)
vim = default_vim_dir;
else
- /* Let NSIS know there is no default, it should use
- * $PROGRAMFILES. */
+ // Let NSIS know there is no default, it should use
+ // $PROGRAMFILES.
vim = "";
}
}
- /* NSIS also uses GetTempPath(), thus we should get the same directory
- * name as where NSIS will look for vimini.ini. */
+ // NSIS also uses GetTempPath(), thus we should get the same directory
+ // name as where NSIS will look for vimini.ini.
GetTempPath(sizeof(fname) - 12, fname);
add_pathsep(fname);
strcat(fname, "vimini.ini");
@@ -418,8 +418,8 @@ get_vim_env(void)
fd = fopen(fname, "w");
if (fd != NULL)
{
- /* Make it look like an .ini file, so that NSIS can read it with a
- * ReadINIStr command. */
+ // Make it look like an .ini file, so that NSIS can read it with a
+ // ReadINIStr command.
fprintf(fd, "[vimini]\n");
fprintf(fd, "dir=\"%s\"\n", vim);
fclose(fd);
@@ -437,7 +437,7 @@ static int num_windows;
* Callback used for EnumWindows():
* Count the window if the title looks like it is for the uninstaller.
*/
-/*ARGSUSED*/
+//ARGSUSED
static BOOL CALLBACK
window_cb(HWND hwnd, LPARAM lparam)
{
@@ -469,7 +469,7 @@ run_silent_uninstall(char *uninst_exe)
if (!GetTempPath(sizeof(temp_dir), temp_dir))
return FAIL;
- /* Copy the uninstaller to a temporary exe. */
+ // Copy the uninstaller to a temporary exe.
tick = GetTickCount();
for (i = 0; ; i++)
{
@@ -483,7 +483,7 @@ run_silent_uninstall(char *uninst_exe)
return FAIL;
}
- /* Run the copied uninstaller silently. */
+ // Run the copied uninstaller silently.
if (strchr(temp_uninst, ' ') != NULL)
sprintf(buf, "\"%s\" /S _?=%s", temp_uninst, vimrt_dir);
else
@@ -531,12 +531,12 @@ uninstall_check(int skip_question)
if (strncmp("Vim", subkey_name_buff, 3) == 0)
{
- /* Open the key named Vim* */
+ // Open the key named Vim*
code = RegOpenKeyEx(key_handle, subkey_name_buff, 0,
KEY_WOW64_64KEY | KEY_READ, &uninstall_key_handle);
CHECK_REG_ERROR(code);
- /* get the DisplayName out of it to show the user */
+ // get the DisplayName out of it to show the user
local_bufsize = sizeof(temp_string_buffer);
code = RegQueryValueEx(uninstall_key_handle, "displayname", 0,
&value_type, (LPBYTE)temp_string_buffer,
@@ -569,13 +569,13 @@ uninstall_check(int skip_question)
printf("\nDo you want to uninstall \"%s\" now?\n(y)es/(n)o) ", temp_string_buffer);
fflush(stdout);
- /* get the UninstallString */
+ // get the UninstallString
local_bufsize = sizeof(temp_string_buffer);
code = RegQueryValueEx(uninstall_key_handle, "uninstallstring", 0,
&value_type, (LPBYTE)temp_string_buffer, &local_bufsize);
CHECK_REG_ERROR(code);
- /* Remember the directory, it is used as the default for NSIS. */
+ // Remember the directory, it is used as the default for NSIS.
default_vim_dir = alloc(strlen(temp_string_buffer) + 1);
strcpy(default_vim_dir, temp_string_buffer);
remove_tail(default_vim_dir);
@@ -598,25 +598,25 @@ uninstall_check(int skip_question)
{
case 'y':
case 'Y':
- /* save the number of uninstall keys so we can know if
- * it changed */
+ // save the number of uninstall keys so we can know if
+ // it changed
RegQueryInfoKey(key_handle, NULL, NULL, NULL,
&orig_num_keys, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
- /* Find existing .bat files before deleting them. */
+ // Find existing .bat files before deleting them.
find_bat_exe(TRUE);
if (allow_silent)
{
if (run_silent_uninstall(temp_string_buffer)
== FAIL)
- allow_silent = 0; /* Retry with non silent. */
+ allow_silent = 0; // Retry with non silent.
}
if (!allow_silent)
{
- /* Execute the uninstall program. Put it in double
- * quotes if there is an embedded space. */
+ // Execute the uninstall program. Put it in double
+ // quotes if there is an embedded space.
{
char buf[BUFSIZE];
@@ -627,18 +627,18 @@ uninstall_check(int skip_question)
run_command(buf);
}
- /* Count the number of windows with a title that match
- * the installer, so that we can check when it's done.
- * The uninstaller copies itself, executes the copy
- * and exits, thus we can't wait for the process to
- * finish. */
- sleep(1); /* wait for uninstaller to start up */
+ // Count the number of windows with a title that
+ // match the installer, so that we can check when
+ // it's done. The uninstaller copies itself,
+ // executes the copy and exits, thus we can't wait
+ // for the process to finish.
+ sleep(1); // wait for uninstaller to start up
num_windows = 0;
EnumWindows(window_cb, 0);
if (num_windows == 0)
{
- /* Did not find the uninstaller, ask user to press
- * Enter when done. Just in case. */
+ // Did not find the uninstaller, ask user to
+ // press Enter when done. Just in case.
printf("Press Enter when the uninstaller is finished\n");
rewind(stdin);
(void)getchar();
@@ -650,7 +650,8 @@ uninstall_check(int skip_question)
{
printf(".");
fflush(stdout);
- sleep(1); /* wait for the uninstaller to finish */
+ sleep(1); // wait for the uninstaller to
+ // finish
num_windows = 0;
EnumWindows(window_cb, 0);
} while (num_windows > 0);
@@ -658,10 +659,10 @@ uninstall_check(int skip_question)
}
printf("\nDone!\n");
- /* Check if an uninstall reg key was deleted.
- * if it was, we want to decrement key_index.
- * if we don't do this, we will skip the key
- * immediately after any key that we delete. */
+ // Check if an uninstall reg key was deleted.
+ // if it was, we want to decrement key_index.
+ // if we don't do this, we will skip the key
+ // immediately after any key that we delete.
RegQueryInfoKey(key_handle, NULL, NULL, NULL,
&new_num_keys, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
@@ -673,11 +674,11 @@ uninstall_check(int skip_question)
case 'n':
case 'N':
- /* Do not uninstall */
+ // Do not uninstall
input = 'n';
break;
- default: /* just drop through and redo the loop */
+ default: // just drop through and redo the loop
break;
}
@@ -705,7 +706,7 @@ inspect_system(void)
int i;
int foundone;
- /* This may take a little while, let the user know what we're doing. */
+ // This may take a little while, let the user know what we're doing.
printf("Inspecting system...\n");
/*
@@ -785,7 +786,7 @@ inspect_system(void)
strcpy(oldvimrc + runtimeidx, "_vimrc");
if ((fd = fopen(oldvimrc, "r")) == NULL)
{
- strcpy(oldvimrc + runtimeidx, "vimrc~1"); /* short version of .vimrc */
+ strcpy(oldvimrc + runtimeidx, "vimrc~1"); // short version of .vimrc
if ((fd = fopen(oldvimrc, "r")) == NULL)
{
strcpy(oldvimrc + runtimeidx, ".vimrc");
@@ -814,9 +815,8 @@ add_dummy_choice(void)
++choice_count;
}
-/***********************************************
- * stuff for creating the batch files.
- */
+////////////////////////////////////////////////
+// stuff for creating the batch files.
/*
* Install the vim.bat, gvim.bat, etc. files.
@@ -844,7 +844,8 @@ install_bat_choice(int idx)
fprintf(fd, "\n");
fprintf(fd, "setlocal\n");
- /* Don't use double quotes for the "set" argument, also when it
+ /*
+ * Don't use double quotes for the "set" argument, also when it
* contains a space. The quotes would be included in the value
* for MSDOS and NT.
* The order of preference is:
@@ -858,7 +859,7 @@ install_bat_choice(int idx)
fprintf(fd, "if exist \"%%VIMRUNTIME%%\\%s\" set VIM_EXE_DIR=%%VIMRUNTIME%%\n", exename);
fprintf(fd, "\n");
- /* Give an error message when the executable could not be found. */
+ // Give an error message when the executable could not be found.
fprintf(fd, "if exist \"%%VIM_EXE_DIR%%\\%s\" goto havevim\n",
exename);
fprintf(fd, "echo \"%%VIM_EXE_DIR%%\\%s\" not found\n", exename);
@@ -890,15 +891,15 @@ install_bat_choice(int idx)
fprintf(fd, "if .%%OS%%==.Windows_NT goto ntaction\n");
fprintf(fd, "\n");
- /* For gvim.exe use "start" to avoid that the console window stays
- * open. */
+ // For gvim.exe use "start" to avoid that the console window stays
+ // open.
if (*exename == 'g')
{
fprintf(fd, "if .%%VIMNOFORK%%==.1 goto nofork\n");
fprintf(fd, "start ");
}
- /* Always use quotes, $VIM or $VIMRUNTIME might have a space. */
+ // Always use quotes, $VIM or $VIMRUNTIME might have a space.
fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%VIMARGS%%\n",
exename, vimarg);
fprintf(fd, "goto eof\n");
@@ -908,7 +909,7 @@ install_bat_choice(int idx)
{
fprintf(fd, ":nofork\n");
fprintf(fd, "start /w ");
- /* Always use quotes, $VIM or $VIMRUNTIME might have a space. */
+ // Always use quotes, $VIM or $VIMRUNTIME might have a space.
fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%VIMARGS%%\n",
exename, vimarg);
fprintf(fd, "goto eof\n");
@@ -918,15 +919,15 @@ install_bat_choice(int idx)
fprintf(fd, ":ntaction\n");
fprintf(fd, "rem for WinNT we can use %%*\n");
- /* For gvim.exe use "start /b" to avoid that the console window
- * stays open. */
+ // For gvim.exe use "start /b" to avoid that the console window
+ // stays open.
if (*exename == 'g')
{
fprintf(fd, "if .%%VIMNOFORK%%==.1 goto noforknt\n");
fprintf(fd, "start \"dummy\" /b ");
}
- /* Always use quotes, $VIM or $VIMRUNTIME might have a space. */
+ // Always use quotes, $VIM or $VIMRUNTIME might have a space.
fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%*\n", exename, vimarg);
fprintf(fd, "goto eof\n");
fprintf(fd, "\n");
@@ -935,7 +936,7 @@ install_bat_choice(int idx)
{
fprintf(fd, ":noforknt\n");
fprintf(fd, "start \"dummy\" /b /wait ");
- /* Always use quotes, $VIM or $VIMRUNTIME might have a space. */
+ // Always use quotes, $VIM or $VIMRUNTIME might have a space.
fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%*\n",
exename, vimarg);
}
@@ -1064,15 +1065,15 @@ change_bat_choice(int idx)
if (n == count)
{
- /* Selected last item, don't create bat file. */
+ // Selected last item, don't create bat file.
*batpath = NUL;
if (choices[idx].arg != 0)
alloc_text(idx, " Do NOT create %s", name);
}
else
{
- /* Selected one of the paths. For the first item only keep the path,
- * for the others append the batch file name. */
+ // Selected one of the paths. For the first item only keep the path,
+ // for the others append the batch file name.
strcpy(batpath, names[n]);
add_pathsep(batpath);
if (choices[idx].arg != 0)
@@ -1092,7 +1093,7 @@ change_main_bat_choice(int idx)
{
int i;
- /* let the user select a default directory or NONE */
+ // let the user select a default directory or NONE
change_bat_choice(idx);
if (targets[0].batpath[0] != NUL)
@@ -1100,11 +1101,11 @@ change_main_bat_choice(int idx)
else
choices[idx].text = bat_text_no;
- /* update the individual batch file selections */
+ // update the individual batch file selections
for (i = 1; i < TARGET_COUNT; ++i)
{
- /* Only make it active when the first item has a path and the vim.exe
- * or gvim.exe exists (there is a changefunc then). */
+ // Only make it active when the first item has a path and the vim.exe
+ // or gvim.exe exists (there is a changefunc then).
if (targets[0].batpath[0] != NUL
&& choices[idx + i].changefunc != NULL)
{
@@ -1135,10 +1136,10 @@ init_bat_choice(int target)
choices[choice_count].arg = target;
choices[choice_count].installfunc = install_bat_choice;
choices[choice_count].active = 1;
- choices[choice_count].text = NULL; /* will be set below */
+ choices[choice_count].text = NULL; // will be set below
if (oldbat != NULL)
{
- /* A [g]vim.bat exists: Only choice is to overwrite it or not. */
+ // A [g]vim.bat exists: Only choice is to overwrite it or not.
choices[choice_count].changefunc = toggle_bat_choice;
*batpath = NUL;
toggle_bat_choice(choice_count);
@@ -1146,19 +1147,19 @@ init_bat_choice(int target)
else
{
if (default_bat_dir != NULL)
- /* Prefer using the same path as an existing .bat file. */
+ // Prefer using the same path as an existing .bat file.
strcpy(batpath, default_bat_dir);
else
{
- /* No [g]vim.bat exists: Write it to a directory in $PATH. Use
- * $WINDIR by default, if it's empty the first item in $PATH. */
+ // No [g]vim.bat exists: Write it to a directory in $PATH. Use
+ // $WINDIR by default, if it's empty the first item in $PATH.
p = getenv("WINDIR");
if (p != NULL && *p != NUL)
strcpy(batpath, p);
else
{
p = getenv("PATH");
- if (p == NULL || *p == NUL) /* "cannot happen" */
+ if (p == NULL || *p == NUL) // "cannot happen"
strcpy(batpath, "C:/Windows");
else
{
@@ -1186,8 +1187,8 @@ init_bat_choices(void)
{
int i;
- /* The first item is used to switch installing batch files on/off and
- * setting the default path. */
+ // The first item is used to switch installing batch files on/off and
+ // setting the default path.
choices[choice_count].text = bat_text_yes;
choices[choice_count].changefunc = change_main_bat_choice;
choices[choice_count].installfunc = NULL;
@@ -1195,8 +1196,8 @@ init_bat_choices(void)
choices[choice_count].arg = 0;
++choice_count;
- /* Add items for each batch file target. Only used when not disabled by
- * the first item. When a .exe exists, don't offer to create a .bat. */
+ // Add items for each batch file target. Only used when not disabled by
+ // the first item. When a .exe exists, don't offer to create a .bat.
for (i = 1; i < TARGET_COUNT; ++i)
if (targets[i].oldexe == NULL
&& (targets[i].exenamearg[0] == 'g' ? has_gvim : has_vim))
@@ -1214,8 +1215,8 @@ install_vimrc(int idx)
FILE *fd, *tfd;
char *fname;
- /* If an old vimrc file exists, overwrite it.
- * Otherwise create a new one. */
+ // If an old vimrc file exists, overwrite it.
+ // Otherwise create a new one.
if (*oldvimrc != NUL)
fname = oldvimrc;
else
@@ -1275,7 +1276,7 @@ install_vimrc(int idx)
}
if ((tfd = fopen("diff.exe", "r")) != NULL)
{
- /* Use the diff.exe that comes with the self-extracting gvim.exe. */
+ // Use the diff.exe that comes with the self-extracting gvim.exe.
fclose(tfd);
fprintf(fd, "\n");
fprintf(fd, "\" Use the internal diff if available.\n");
@@ -1287,8 +1288,8 @@ install_vimrc(int idx)
fprintf(fd, " let opt = '-a --binary '\n");
fprintf(fd, " if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif\n");
fprintf(fd, " if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif\n");
- /* Use quotes only when needed, they may cause trouble.
- * Always escape "!". */
+ // Use quotes only when needed, they may cause trouble.
+ // Always escape "!".
fprintf(fd, " let arg1 = v:fname_in\n");
fprintf(fd, " if arg1 =~ ' ' | let arg1 = '\"' . arg1 . '\"' | endif\n");
fprintf(fd, " let arg1 = substitute(arg1, '!', '\\!', 'g')\n");
@@ -1299,13 +1300,13 @@ install_vimrc(int idx)
fprintf(fd, " if arg3 =~ ' ' | let arg3 = '\"' . arg3 . '\"' | endif\n");
fprintf(fd, " let arg3 = substitute(arg3, '!', '\\!', 'g')\n");
- /* If the path has a space: When using cmd.exe (Win NT/2000/XP) put
- * quotes around the diff command and rely on the default value of
- * shellxquote to solve the quoting problem for the whole command.
- *
- * Otherwise put a double quote just before the space and at the
- * end of the command. Putting quotes around the whole thing
- * doesn't work on Win 95/98/ME. This is mostly guessed! */
+ // If the path has a space: When using cmd.exe (Win NT/2000/XP) put
+ // quotes around the diff command and rely on the default value of
+ // shellxquote to solve the quoting problem for the whole command.
+ //
+ // Otherwise put a double quote just before the space and at the
+ // end of the command. Putting quotes around the whole thing
+ // doesn't work on Win 95/98/ME. This is mostly guessed!
fprintf(fd, " if $VIMRUNTIME =~ ' '\n");
fprintf(fd, " if &sh =~ '\\<cmd'\n");
fprintf(fd, " if empty(&shellxquote)\n");
@@ -1336,7 +1337,7 @@ change_vimrc_choice(int idx)
{
if (choices[idx].installfunc != NULL)
{
- /* Switch to NOT change or create a vimrc file. */
+ // Switch to NOT change or create a vimrc file.
if (*oldvimrc != NUL)
alloc_text(idx, "Do NOT change startup file %s", oldvimrc);
else
@@ -1348,7 +1349,7 @@ change_vimrc_choice(int idx)
}
else
{
- /* Switch to change or create a vimrc file. */
+ // Switch to change or create a vimrc file.
if (*oldvimrc != NUL)
alloc_text(idx, "Overwrite startup file %s with:", oldvimrc);
else
@@ -1393,11 +1394,11 @@ change_mouse_choice(int idx)
static void
init_vimrc_choices(void)
{
- /* set path for a new _vimrc file (also when not used) */
+ // set path for a new _vimrc file (also when not used)
strcpy(vimrc, installdir);
strcpy(vimrc + runtimeidx, "_vimrc");
- /* Set opposite value and then toggle it by calling change_vimrc_choice() */
+ // Set opposite value and then toggle it by calling change_vimrc_choice()
if (*oldvimrc == NUL)
choices[choice_count].installfunc = NULL;
else
@@ -1408,21 +1409,21 @@ init_vimrc_choices(void)
choices[choice_count].active = 1;
++choice_count;
- /* default way to run Vim */
+ // default way to run Vim
alloc_text(choice_count, compat_text, compat_choices[compat_choice]);
choices[choice_count].changefunc = change_run_choice;
choices[choice_count].installfunc = NULL;
choices[choice_count].active = (*oldvimrc == NUL);
++choice_count;
- /* Whether to remap keys */
+ // Whether to remap keys
alloc_text(choice_count, remap_text , remap_choices[remap_choice]);
choices[choice_count].changefunc = change_remap_choice;
choices[choice_count].installfunc = NULL;
choices[choice_count].active = (*oldvimrc == NUL);
++choice_count;
- /* default way to use the mouse */
+ // default way to use the mouse
alloc_text(choice_count, mouse_text, mouse_choices[mouse_choice]);
choices[choice_count].changefunc = change_mouse_choice;
choices[choice_count].installfunc = NULL;
@@ -1608,7 +1609,7 @@ register_uninstall(
* - to add Vim to the "Open with..." list
* - to uninstall Vim
*/
-/*ARGSUSED*/
+//ARGSUSED
static int
install_registry(void)
{
@@ -1684,7 +1685,7 @@ install_registry(void)
#endif
);
- /* For the NSIS installer use the generated uninstaller. */
+ // For the NSIS installer use the generated uninstaller.
if (interactive)
sprintf(uninstall_string, "%s\\uninstall.exe", installdir);
else
@@ -1737,7 +1738,7 @@ init_popup_choice(void)
choices[choice_count].changefunc = change_popup_choice;
choices[choice_count].installfunc = NULL;
choices[choice_count].active = 1;
- change_popup_choice(choice_count); /* set the text */
+ change_popup_choice(choice_count); // set the text
++choice_count;
}
else
@@ -1771,15 +1772,14 @@ init_openwith_choice(void)
choices[choice_count].changefunc = change_openwith_choice;
choices[choice_count].installfunc = NULL;
choices[choice_count].active = 1;
- change_openwith_choice(choice_count); /* set the text */
+ change_openwith_choice(choice_count); // set the text
++choice_count;
}
else
add_dummy_choice();
}
-/* create_shortcut
- *
+/*
* Create a shell link.
*
* returns 0 on failure, non-zero on successful completion.
@@ -1800,7 +1800,7 @@ create_shortcut(
HRESULT hres;
IPersistFile *persistfile_ptr;
- /* Initialize COM library */
+ // Initialize COM library
hres = CoInitialize(NULL);
if (!SUCCEEDED(hres))
{
@@ -1808,18 +1808,18 @@ create_shortcut(
return FAIL;
}
- /* Instantiate a COM object for the ShellLink, store a pointer to it
- * in shelllink_ptr. */
+ // Instantiate a COM object for the ShellLink, store a pointer to it
+ // in shelllink_ptr.
hres = CoCreateInstance(&CLSID_ShellLink,
NULL,
CLSCTX_INPROC_SERVER,
&IID_IShellLink,
(void **) &shelllink_ptr);
- if (SUCCEEDED(hres)) /* If the instantiation was successful... */
+ if (SUCCEEDED(hres)) // If the instantiation was successful...
{
- /* ...Then build a PersistFile interface for the ShellLink so we can
- * save it as a file after we build it. */
+ // ...Then build a PersistFile interface for the ShellLink so we can
+ // save it as a file after we build it.
hres = shelllink_ptr->lpVtbl->QueryInterface(shelllink_ptr,
&IID_IPersistFile, (void **) &persistfile_ptr);
@@ -1827,12 +1827,11 @@ create_shortcut(
{
wchar_t wsz[BUFSIZE];
- /* translate the (possibly) multibyte shortcut filename to windows
- * Unicode so it can be used as a file name.
- */
+ // translate the (possibly) multibyte shortcut filename to windows
+ // Unicode so it can be used as a file name.
MultiByteToWideChar(CP_ACP, 0, shortcut_name, -1, wsz, sizeof(wsz)/sizeof(wsz[0]));
- /* set the attributes */
+ // set the attributes
shelllink_ptr->lpVtbl->SetPath(shelllink_ptr, shortcut_target);
shelllink_ptr->lpVtbl->SetWorkingDirectory(shelllink_ptr,
workingdir);
@@ -1840,7 +1839,7 @@ create_shortcut(
iconfile_path, iconindex);
shelllink_ptr->lpVtbl->SetArguments(shelllink_ptr, shortcut_args);
- /* save the shortcut to a file and return the PersistFile object*/
+ // save the shortcut to a file and return the PersistFile object
persistfile_ptr->lpVtbl->Save(persistfile_ptr, wsz, 1);
persistfile_ptr->lpVtbl->Release(persistfile_ptr);
}
@@ -1850,7 +1849,7 @@ create_shortcut(
return FAIL;
}
- /* Return the ShellLink object */
+ // Return the ShellLink object
shelllink_ptr->lpVtbl->Release(shelllink_ptr);
}
else
@@ -1882,11 +1881,11 @@ build_link_name(
return FAIL;
}
- /* Make sure the directory exists (create Start Menu\Programs\Vim).
- * Ignore errors if it already exists. */
+ // Make sure the directory exists (create Start Menu\Programs\Vim).
+ // Ignore errors if it already exists.
vim_mkdir(shell_folder_path, 0755);
- /* build the path to the shortcut and the path to gvim.exe */
+ // build the path to the shortcut and the path to gvim.exe
sprintf(link_path, "%s\\%s.lnk", shell_folder_path, link_name);
return OK;
@@ -1894,8 +1893,8 @@ build_link_name(
static int
build_shortcut(
- const char *name, /* Name of the shortcut */
- const char *exename, /* Name of the executable (e.g., vim.exe) */
+ const char *name, // Name of the shortcut
+ const char *exename, // Name of the executable (e.g., vim.exe)
const char *args,
const char *shell_folder,
const char *workingdir)
@@ -1913,7 +1912,7 @@ build_shortcut(
return FAIL;
}
- /* Create the shortcut: */
+ // Create the shortcut:
return create_shortcut(link_name, executable_path, 0,
executable_path, args, workingdir);
}
@@ -1965,8 +1964,8 @@ install_start_menu(int idx)
interactive ? "uninstall.exe" : "uninstall-gui.exe", "",
VIM_STARTMENU, installdir) == FAIL)
return;
- /* For Windows NT the working dir of the vimtutor.bat must be right,
- * otherwise gvim.exe won't be found and using gvimbat doesn't work. */
+ // For Windows NT the working dir of the vimtutor.bat must be right,
+ // otherwise gvim.exe won't be found and using gvimbat doesn't work.
if (build_shortcut("Vim tutor", "vimtutor.bat", "",
VIM_STARTMENU, installdir) == FAIL)
return;
@@ -1976,7 +1975,7 @@ install_start_menu(int idx)
{
char shell_folder_path[BUFSIZE];
- /* Creating the URL shortcut works a bit differently... */
+ // Creating the URL shortcut works a bit differently...
if (get_shell_folder_path(shell_folder_path, VIM_STARTMENU) == FAIL)
{
printf("Finding the path of the Start menu failed\n");
@@ -2020,7 +2019,7 @@ toggle_startmenu_choice(int idx)
void
install_shortcut_gvim(int idx)
{
- /* Create shortcut(s) on the desktop */
+ // Create shortcut(s) on the desktop
if (choices[idx].arg)
{
(void)build_shortcut(icon_names[0], "gvim.exe",
@@ -2077,11 +2076,11 @@ toggle_shortcut_choice(int idx)
static void
init_startmenu_choice(void)
{
- /* Start menu */
+ // Start menu
choices[choice_count].changefunc = toggle_startmenu_choice;
choices[choice_count].installfunc = NULL;
choices[choice_count].active = 1;
- toggle_startmenu_choice(choice_count); /* set the text */
+ toggle_startmenu_choice(choice_count); // set the text
++choice_count;
}
@@ -2091,7 +2090,7 @@ init_startmenu_choice(void)
static void
init_shortcut_choices(void)
{
- /* Shortcut to gvim */
+ // Shortcut to gvim
choices[choice_count].text = NULL;
choices[choice_count].arg = 0;
choices[choice_count].active = has_gvim;
@@ -2100,7 +2099,7 @@ init_shortcut_choices(void)
toggle_shortcut_choice(choice_count);
++choice_count;
- /* Shortcut to evim */
+ // Shortcut to evim
choices[choice_count].text = NULL;
choices[choice_count].arg = 0;
choices[choice_count].active = has_gvim;
@@ -2109,7 +2108,7 @@ init_shortcut_choices(void)
toggle_shortcut_choice(choice_count);
++choice_count;
- /* Shortcut to gview */
+ // Shortcut to gview
choices[choice_count].text = NULL;
choices[choice_count].arg = 0;
choices[choice_count].active = has_gvim;
@@ -2145,7 +2144,7 @@ dir_remove_last(const char *path, char to[MAX_PATH])
long last_char_to_copy;
long path_length = strlen(path);
- /* skip the last character just in case it is a '\\' */
+ // skip the last character just in case it is a '\\'
last_char_to_copy = path_length - 2;
c = path[last_char_to_copy];
@@ -2264,7 +2263,7 @@ change_directories_choice(int idx)
{
int choice_count = TABLE_SIZE(vimfiles_dir_choices);
- /* Don't offer the $HOME choice if $HOME isn't set. */
+ // Don't offer the $HOME choice if $HOME isn't set.
if (homedir == NULL)
--choice_count;
choices[idx].arg = get_choice(vimfiles_dir_choices, choice_count);
@@ -2274,7 +2273,7 @@ change_directories_choice(int idx)
/*
* Create the plugin directories...
*/
-/*ARGSUSED*/
+//ARGSUSED
static void
install_vimfilesdir(int idx)
{
@@ -2285,18 +2284,18 @@ install_vimfilesdir(int idx)
char vimfiles_path[MAX_PATH + 9];
char tmp_dirname[BUFSIZE];
- /* switch on the location that the user wants the plugin directories
- * built in */
+ // switch on the location that the user wants the plugin directories
+ // built in
switch (vimfiles_dir_choice)
{
case vimfiles_dir_vim:
{
- /* Go to the %VIM% directory - check env first, then go one dir
- * below installdir if there is no %VIM% environment variable.
- * The accuracy of $VIM is checked in inspect_system(), so we
- * can be sure it is ok to use here. */
+ // Go to the %VIM% directory - check env first, then go one dir
+ // below installdir if there is no %VIM% environment variable.
+ // The accuracy of $VIM is checked in inspect_system(), so we
+ // can be sure it is ok to use here.
p = getenv("VIM");
- if (p == NULL) /* No $VIM in path */
+ if (p == NULL) // No $VIM in path
dir_remove_last(installdir, vimdir_path);
else
strcpy(vimdir_path, p);
@@ -2321,8 +2320,8 @@ install_vimfilesdir(int idx)
}
}
- /* Now, just create the directory. If it already exists, it will fail
- * silently. */
+ // Now, just create the directory. If it already exists, it will fail
+ // silently.
sprintf(vimfiles_path, "%s\\vimfiles", vimdir_path);
vim_mkdir(vimfiles_path, 0755);
@@ -2386,25 +2385,25 @@ init_directories_choice(void)
static void
setup_choices(void)
{
- /* install the batch files */
+ // install the batch files
init_bat_choices();
- /* (over) write _vimrc file */
+ // (over) write _vimrc file
init_vimrc_choices();
- /* Whether to add Vim to the popup menu */
+ // Whether to add Vim to the popup menu
init_popup_choice();
- /* Whether to add Vim to the "Open With..." menu */
+ // Whether to add Vim to the "Open With..." menu
init_openwith_choice();
- /* Whether to add Vim to the Start Menu. */
+ // Whether to add Vim to the Start Menu.
init_startmenu_choice();
- /* Whether to add shortcuts to the Desktop. */
+ // Whether to add shortcuts to the Desktop.
init_shortcut_choices();
- /* Whether to create the runtime directories. */
+ // Whether to create the runtime directories.
init_directories_choice();
}
@@ -2473,9 +2472,8 @@ command_line_setup_choices(int argc, char **argv)
}
else if (strcmp(argv[i], "-create-vimrc") == 0)
{
- /* Setup default vimrc choices. If there is already a _vimrc file,
- * it will NOT be overwritten.
- */
+ // Setup default vimrc choices. If there is already a _vimrc file,
+ // it will NOT be overwritten.
init_vimrc_choices();
}
else if (strcmp(argv[i], "-vimrc-remap") == 0)
@@ -2554,15 +2552,15 @@ command_line_setup_choices(int argc, char **argv)
print_cmd_line_help();
}
}
- else /* No choice specified, default to vim directory */
+ else // No choice specified, default to vim directory
vimfiles_dir_choice = (int)vimfiles_dir_vim;
choices[choice_count - 1].arg = vimfiles_dir_choice;
}
else if (strcmp(argv[i], "-register-OLE") == 0)
{
- /* This is always done when gvim is found */
+ // This is always done when gvim is found
}
- else /* Unknown switch */
+ else // Unknown switch
{
printf("Got unknown argument argv[%d] = %s\n", i, argv[i]);
print_cmd_line_help();
@@ -2707,19 +2705,19 @@ install(void)
{
int i;
- /* Install the selected choices. */
+ // Install the selected choices.
for (i = 0; i < choice_count; ++i)
if (choices[i].installfunc != NULL && choices[i].active)
(choices[i].installfunc)(i);
- /* Add some entries to the registry, if needed. */
+ // Add some entries to the registry, if needed.
if (install_popup
|| install_openwith
|| (need_uninstall_entry && interactive)
|| !interactive)
install_registry();
- /* Register gvim with OLE. */
+ // Register gvim with OLE.
if (has_gvim)
install_OLE_register();
}
@@ -2754,21 +2752,21 @@ main(int argc, char **argv)
else
interactive = 1;
- /* Initialize this program. */
+ // Initialize this program.
do_inits(argv);
init_homedir();
if (argc > 1 && strcmp(argv[1], "-uninstall-check") == 0)
{
- /* Only check for already installed Vims. Used by NSIS installer. */
+ // Only check for already installed Vims. Used by NSIS installer.
i = uninstall_check(1);
- /* Find the value of $VIM, because NSIS isn't able to do this by
- * itself. */
+ // Find the value of $VIM, because NSIS isn't able to do this by
+ // itself.
get_vim_env();
- /* When nothing found exit quietly. If something found wait for
- * a little while, so that the user can read the messages. */
+ // When nothing found exit quietly. If something found wait for
+ // a little while, so that the user can read the messages.
if (i && _isatty(1))
sleep(3);
exit(0);
@@ -2777,22 +2775,22 @@ main(int argc, char **argv)
printf("This program sets up the installation of Vim "
VIM_VERSION_MEDIUM "\n\n");
- /* Check if the user unpacked the archives properly. */
+ // Check if the user unpacked the archives properly.
check_unpack();
- /* Check for already installed Vims. */
+ // Check for already installed Vims.
if (interactive)
uninstall_check(0);
- /* Find out information about the system. */
+ // Find out information about the system.
inspect_system();
if (interactive)
{
- /* Setup all the choices. */
+ // Setup all the choices.
setup_choices();
- /* Let the user change choices and finally install (or quit). */
+ // Let the user change choices and finally install (or quit).
for (;;)
{
request_choice();
@@ -2801,7 +2799,7 @@ main(int argc, char **argv)
{
if (isdigit(buf[0]))
{
- /* Change a choice. */
+ // Change a choice.
i = atoi(buf);
if (i > 0 && i <= choice_count && choices[i - 1].active)
(choices[i - 1].changefunc)(i - 1);
@@ -2810,19 +2808,19 @@ main(int argc, char **argv)
}
else if (buf[0] == 'h' || buf[0] == 'H')
{
- /* Help */
+ // Help
show_help();
}
else if (buf[0] == 'd' || buf[0] == 'D')
{
- /* Install! */
+ // Install!
install();
printf("\nThat finishes the installation. Happy Vimming!\n");
break;
}
else if (buf[0] == 'q' || buf[0] == 'Q')
{
- /* Quit */
+ // Quit
printf("\nExiting without anything done\n");
break;
}
@@ -2841,8 +2839,8 @@ main(int argc, char **argv)
command_line_setup_choices(argc, argv);
install();
- /* Avoid that the user has to hit Enter, just wait a little bit to
- * allow reading the messages. */
+ // Avoid that the user has to hit Enter, just wait a little bit to
+ // allow reading the messages.
sleep(2);
}
diff --git a/src/edit.c b/src/edit.c
index 4f53333cd..c67f67cb3 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -18,8 +18,8 @@
#define BACKSPACE_WORD_NOT_SPACE 3
#define BACKSPACE_LINE 4
-/* Set when doing something for completion that may call edit() recursively,
- * which is not allowed. */
+// Set when doing something for completion that may call edit() recursively,
+// which is not allowed.
static int compl_busy = FALSE;
@@ -79,30 +79,30 @@ static int ins_ctrl_ey(int tc);
static char_u *do_insert_char_pre(int c);
#endif
-static colnr_T Insstart_textlen; /* length of line when insert started */
-static colnr_T Insstart_blank_vcol; /* vcol for first inserted blank */
-static int update_Insstart_orig = TRUE; /* set Insstart_orig to Insstart */
+static colnr_T Insstart_textlen; // length of line when insert started
+static colnr_T Insstart_blank_vcol; // vcol for first inserted blank
+static int update_Insstart_orig = TRUE; // set Insstart_orig to Insstart
-static char_u *last_insert = NULL; /* the text of the previous insert,
- K_SPECIAL and CSI are escaped */
-static int last_insert_skip; /* nr of chars in front of previous insert */
-static int new_insert_skip; /* nr of chars in front of current insert */
-static int did_restart_edit; /* "restart_edit" when calling edit() */
+static char_u *last_insert = NULL; // the text of the previous insert,
+ // K_SPECIAL and CSI are escaped
+static int last_insert_skip; // nr of chars in front of previous insert
+static int new_insert_skip; // nr of chars in front of current insert
+static int did_restart_edit; // "restart_edit" when calling edit()
#ifdef FEAT_CINDENT
-static int can_cindent; /* may do cindenting on this line */
+static int can_cindent; // may do cindenting on this line
#endif
#ifdef FEAT_RIGHTLEFT
-static int revins_on; /* reverse insert mode on */
-static int revins_chars; /* how much to skip after edit */
-static int revins_legal; /* was the last char 'legal'? */
-static int revins_scol; /* start column of revins session */
+static int revins_on; // reverse insert mode on
+static int revins_chars; // how much to skip after edit
+static int revins_legal; // was the last char 'legal'?
+static int revins_scol; // start column of revins session
#endif
-static int ins_need_undo; /* call u_save() before inserting a
- char. Set when edit() is called.
- after that arrow_used is used. */
+static int ins_need_undo; // call u_save() before inserting a
+ // char. Set when edit() is called.
+ // after that arrow_used is used.
static int did_add_space = FALSE; // auto_format() added an extra space
// under the cursor
@@ -131,7 +131,7 @@ static int dont_sync_undo = FALSE; // CTRL-G U prevents syncing undo for
int
edit(
int cmdchar,
- int startln, /* if set, insert at start of line */
+ int startln, // if set, insert at start of line
long count)
{
int c = 0;
@@ -140,54 +140,54 @@ edit(
int mincol;
static linenr_T o_lnum = 0;
int i;
- int did_backspace = TRUE; /* previous char was backspace */
+ int did_backspace = TRUE; // previous char was backspace
#ifdef FEAT_CINDENT
- int line_is_white = FALSE; /* line is empty before insert */
+ int line_is_white = FALSE; // line is empty before insert
#endif
- linenr_T old_topline = 0; /* topline before insertion */
+ linenr_T old_topline = 0; // topline before insertion
#ifdef FEAT_DIFF
int old_topfill = -1;
#endif
- int inserted_space = FALSE; /* just inserted a space */
+ int inserted_space = FALSE; // just inserted a space
int replaceState = REPLACE;
- int nomove = FALSE; /* don't move cursor on return */
+ int nomove = FALSE; // don't move cursor on return
#ifdef FEAT_JOB_CHANNEL
int cmdchar_todo = cmdchar;
#endif
- /* Remember whether editing was restarted after CTRL-O. */
+ // Remember whether editing was restarted after CTRL-O.
did_restart_edit = restart_edit;
- /* sleep before redrawing, needed for "CTRL-O :" that results in an
- * error message */
+ // sleep before redrawing, needed for "CTRL-O :" that results in an
+ // error message
check_for_delay(TRUE);
- /* set Insstart_orig to Insstart */
+ // set Insstart_orig to Insstart
update_Insstart_orig = TRUE;
#ifdef HAVE_SANDBOX
- /* Don't allow inserting in the sandbox. */
+ // Don't allow inserting in the sandbox.
if (sandbox != 0)
{
emsg(_(e_sandbox));
return FALSE;
}
#endif
- /* Don't allow changes in the buffer while editing the cmdline. The
- * caller of getcmdline() may get confused. */
+ // Don't allow changes in the buffer while editing the cmdline. The
+ // caller of getcmdline() may get confused.
if (textlock != 0)
{
emsg(_(e_secure));
return FALSE;
}
- /* Don't allow recursive insert mode when busy with completion. */
+ // Don't allow recursive insert mode when busy with completion.
if (ins_compl_active() || compl_busy || pum_visible())
{
emsg(_(e_secure));
return FALSE;
}
- ins_compl_clear(); /* clear stuff for CTRL-X mode */
+ ins_compl_clear(); // clear stuff for CTRL-X mode
/*
* Trigger InsertEnter autocommands. Do not do this for "r<CR>" or "grx".
@@ -204,16 +204,16 @@ edit(
else
ptr = (char_u *)"i";
set_vim_var_string(VV_INSERTMODE, ptr, 1);
- set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */
+ set_vim_var_string(VV_CHAR, NULL, -1); // clear v:char
#endif
ins_apply_autocmds(EVENT_INSERTENTER);
- /* Make sure the cursor didn't move. Do call check_cursor_col() in
- * case the text was modified. Since Insert mode was not started yet
- * a call to check_cursor_col() may move the cursor, especially with
- * the "A" command, thus set State to avoid that. Also check that the
- * line number is still valid (lines may have been deleted).
- * Do not restore if v:char was set to a non-empty string. */
+ // Make sure the cursor didn't move. Do call check_cursor_col() in
+ // case the text was modified. Since Insert mode was not started yet
+ // a call to check_cursor_col() may move the cursor, especially with
+ // the "A" command, thus set State to avoid that. Also check that the
+ // line number is still valid (lines may have been deleted).
+ // Do not restore if v:char was set to a non-empty string.
if (!EQUAL_POS(curwin->w_cursor, save_cursor)
#ifdef FEAT_EVAL
&& *get_vim_var_str(VV_CHAR) == NUL
@@ -230,8 +230,8 @@ edit(
}
#ifdef FEAT_CONCEAL
- /* Check if the cursor line needs redrawing before changing State. If
- * 'concealcursor' is "n" it needs to be redrawn without concealing. */
+ // Check if the cursor line needs redrawing before changing State. If
+ // 'concealcursor' is "n" it needs to be redrawn without concealing.
conceal_check_cursor_line();
#endif
@@ -258,7 +258,7 @@ edit(
AppendNumberToRedobuff(count);
if (cmdchar == 'V' || cmdchar == 'v')
{
- /* "gR" or "gr" command */
+ // "gR" or "gr" command
AppendCharToRedobuff('g');
AppendCharToRedobuff((cmdchar == 'v') ? 'r' : 'R');
}
@@ -268,10 +268,10 @@ edit(
AppendCharToRedobuff('a');
else
AppendCharToRedobuff(cmdchar);
- if (cmdchar == 'g') /* "gI" command */
+ if (cmdchar == 'g') // "gI" command
AppendCharToRedobuff('I');
- else if (cmdchar == 'r') /* "r<CR>" command */
- count = 1; /* insert only one <CR> */
+ else if (cmdchar == 'r') // "r<CR>" command
+ count = 1; // insert only one <CR>
}
}
@@ -314,7 +314,7 @@ edit(
clear_showcmd();
#endif
#ifdef FEAT_RIGHTLEFT
- /* there is no reverse replace mode */
+ // there is no reverse replace mode
revins_on = (State == INSERT && p_ri);
if (revins_on)
undisplay_dollar();
@@ -377,10 +377,10 @@ edit(
else
arrow_used = FALSE;
- /* we are in insert mode now, don't need to start it anymore */
+ // we are in insert mode now, don't need to start it anymore
need_start_insertmode = FALSE;
- /* Need to save the line for undo before inserting the first char. */
+ // Need to save the line for undo before inserting the first char.
ins_need_undo = TRUE;
where_paste_started.lnum = 0;
@@ -388,8 +388,8 @@ edit(
can_cindent = TRUE;
#endif
#ifdef FEAT_FOLDING
- /* The cursor line is not in a closed fold, unless 'insertmode' is set or
- * restarting. */
+ // The cursor line is not in a closed fold, unless 'insertmode' is set or
+ // restarting.
if (!p_im && did_restart_edit == 0)
foldOpenCursor();
#endif
@@ -407,10 +407,10 @@ edit(
change_warning(i == 0 ? 0 : i + 1);
#ifdef CURSOR_SHAPE
- ui_cursor_shape(); /* may show different cursor shape */
+ ui_cursor_shape(); // may show different cursor shape
#endif
#ifdef FEAT_DIGRAPHS
- do_digraph(-1); /* clear digraphs */
+ do_digraph(-1); // clear digraphs
#endif
/*
@@ -435,11 +435,11 @@ edit(
{
#ifdef FEAT_RIGHTLEFT
if (!revins_legal)
- revins_scol = -1; /* reset on illegal motions */
+ revins_scol = -1; // reset on illegal motions
else
revins_legal = 0;
#endif
- if (arrow_used) /* don't repeat insert when arrow key used */
+ if (arrow_used) // don't repeat insert when arrow key used
count = 0;
if (update_Insstart_orig)
@@ -447,17 +447,17 @@ edit(
if (stop_insert_mode && !pum_visible())
{
- /* ":stopinsert" used or 'insertmode' reset */
+ // ":stopinsert" used or 'insertmode' reset
count = 0;
goto doESCkey;
}
- /* set curwin->w_curswant for next K_DOWN or K_UP */
+ // set curwin->w_curswant for next K_DOWN or K_UP
if (!arrow_used)
curwin->w_set_curswant = TRUE;
- /* If there is no typeahead may check for timestamps (e.g., for when a
- * menu invoked a shell command). */
+ // If there is no typeahead may check for timestamps (e.g., for when a
+ // menu invoked a shell command).
if (stuff_empty())
{
did_check_timestamps = FALSE;
@@ -471,18 +471,18 @@ edit(
msg_scroll = FALSE;
#ifdef FEAT_GUI
- /* When 'mousefocus' is set a mouse movement may have taken us to
- * another window. "need_mouse_correct" may then be set because of an
- * autocommand. */
+ // When 'mousefocus' is set a mouse movement may have taken us to
+ // another window. "need_mouse_correct" may then be set because of an
+ // autocommand.
if (need_mouse_correct)
gui_mouse_correct();
#endif
#ifdef FEAT_FOLDING
- /* Open fold at the cursor line, according to 'foldopen'. */
+ // Open fold at the cursor line, according to 'foldopen'.
if (fdo_flags & FDO_INSERT)
foldOpenCursor();
- /* Close folds where the cursor isn't, according to 'foldclose' */
+ // Close folds where the cursor isn't, according to 'foldclose'
if (!char_avail())
foldCheckClose();
#endif
@@ -546,12 +546,12 @@ edit(
}
}
- /* May need to adjust w_topline to show the cursor. */
+ // May need to adjust w_topline to show the cursor.
update_topline();
did_backspace = FALSE;
- validate_cursor(); /* may set must_redraw */
+ validate_cursor(); // may set must_redraw
/*
* Redraw the display when no characters are waiting.
@@ -571,22 +571,22 @@ edit(
#endif
#ifdef USE_ON_FLY_SCROLL
- dont_scroll = FALSE; /* allow scrolling here */
+ dont_scroll = FALSE; // allow scrolling here
#endif
/*
* Get a character for Insert mode. Ignore K_IGNORE and K_NOP.
*/
if (c != K_CURSORHOLD)
- lastc = c; /* remember the previous char for CTRL-D */
+ lastc = c; // remember the previous char for CTRL-D
- /* After using CTRL-G U the next cursor key will not break undo. */
+ // After using CTRL-G U the next cursor key will not break undo.
if (dont_sync_undo == MAYBE)
dont_sync_undo = TRUE;
else
dont_sync_undo = FALSE;
if (cmdchar == K_PS)
- /* Got here from normal mode when bracketed paste started. */
+ // Got here from normal mode when bracketed paste started.
c = K_PS;
else
do
@@ -602,12 +602,12 @@ edit(
}
} while (c == K_IGNORE || c == K_NOP);
- /* Don't want K_CURSORHOLD for the second key, e.g., after CTRL-V. */
+ // Don't want K_CURSORHOLD for the second key, e.g., after CTRL-V.
did_cursorhold = TRUE;
#ifdef FEAT_RIGHTLEFT
if (p_hkmap && KeyTyped)
- c = hkmap(c); /* Hebrew mode mapping */
+ c = hkmap(c); // Hebrew mode mapping
#endif
/*
@@ -620,18 +620,18 @@ edit(
&& curwin->w_cursor.col >= ins_compl_col()
&& ins_compl_has_shown_match())
{
- /* BS: Delete one character from "compl_leader". */
+ // BS: Delete one character from "compl_leader".
if ((c == K_BS || c == Ctrl_H)
&& curwin->w_cursor.col > ins_compl_col()
&& (c = ins_compl_bs()) == NUL)
continue;
- /* When no match was selected or it was edited. */
+ // When no match was selected or it was edited.
if (!ins_compl_used_match())
{
- /* CTRL-L: Add one character from the current match to
- * "compl_leader". Except when at the original match and
- * there is nothing to add, CTRL-L works like CTRL-P then. */
+ // CTRL-L: Add one character from the current match to
+ // "compl_leader". Except when at the original match and
+ // there is nothing to add, CTRL-L works like CTRL-P then.
if (c == Ctrl_L
&& (!ctrl_x_mode_line_or_eval()
|| ins_compl_long_shown_match()))
@@ -640,12 +640,12 @@ edit(
continue;
}
- /* A non-white character that fits in with the current
- * completion: Add to "compl_leader". */
+ // A non-white character that fits in with the current
+ // completion: Add to "compl_leader".
if (ins_compl_accept_char(c))
{
#if defined(FEAT_EVAL)
- /* Trigger InsertCharPre. */
+ // Trigger InsertCharPre.
char_u *str = do_insert_char_pre(c);
char_u *p;
@@ -661,9 +661,9 @@ edit(
continue;
}
- /* Pressing CTRL-Y selects the current match. When
- * ins_compl_enter_selects() is set the Enter key does the
- * same. */
+ // Pressing CTRL-Y selects the current match. When
+ // ins_compl_enter_selects() is set the Enter key does the
+ // same.
if ((c == Ctrl_Y || (ins_compl_enter_selects()
&& (c == CAR || c == K_KENTER || c == NL)))
&& stop_arrow() == OK)
@@ -674,18 +674,18 @@ edit(
}
}
- /* Prepare for or stop CTRL-X mode. This doesn't do completion, but
- * it does fix up the text when finishing completion. */
+ // Prepare for or stop CTRL-X mode. This doesn't do completion, but
+ // it does fix up the text when finishing completion.
ins_compl_init_get_longest();
if (ins_compl_prep(c))
continue;
- /* CTRL-\ CTRL-N goes to Normal mode,
- * CTRL-\ CTRL-G goes to mode selected with 'insertmode',
- * CTRL-\ CTRL-O is like CTRL-O but without moving the cursor. */
+ // CTRL-\ CTRL-N goes to Normal mode,
+ // CTRL-\ CTRL-G goes to mode selected with 'insertmode',
+ // CTRL-\ CTRL-O is like CTRL-O but without moving the cursor.
if (c == Ctrl_BSL)
{
- /* may need to redraw when no more chars available now */
+ // may need to redraw when no more chars available now
ins_redraw(FALSE);
++no_mapping;
++allow_keys;
@@ -694,7 +694,7 @@ edit(
--allow_keys;
if (c != Ctrl_N && c != Ctrl_G && c != Ctrl_O)
{
- /* it's something else */
+ // it's something else
vungetc(c);
c = Ctrl_BSL;
}
@@ -705,7 +705,7 @@ edit(
if (c == Ctrl_O)
{
ins_ctrl_o();
- ins_at_eol = FALSE; /* cursor keeps its column */
+ ins_at_eol = FALSE; // cursor keeps its column
nomove = TRUE;
}
count = 0;
@@ -722,17 +722,17 @@ edit(
if (c == Ctrl_V || c == Ctrl_Q)
{
ins_ctrl_v();
- c = Ctrl_V; /* pretend CTRL-V is last typed character */
+ c = Ctrl_V; // pretend CTRL-V is last typed character
continue;
}
#ifdef FEAT_CINDENT
if (cindent_on() && ctrl_x_mode_none())
{
- /* A key name preceded by a bang means this key is not to be
- * inserted. Skip ahead to the re-indenting below.
- * A key name preceded by a star means that indenting has to be
- * done before inserting the key. */
+ // A key name preceded by a bang means this key is not to be
+ // inserted. Skip ahead to the re-indenting below.
+ // A key name preceded by a star means that indenting has to be
+ // done before inserting the key.
line_is_white = inindent(0);
if (in_cinkeys(c, '!', line_is_white))
goto force_cindent;
@@ -768,18 +768,18 @@ edit(
*/
switch (c)
{
- case ESC: /* End input mode */
+ case ESC: // End input mode
if (echeck_abbr(ESC + ABBR_OFF))
break;
- /* FALLTHROUGH */
+ // FALLTHROUGH
- case Ctrl_C: /* End input mode */
+ case Ctrl_C: // End input mode
#ifdef FEAT_CMDWIN
if (c == Ctrl_C && cmdwin_type != 0)
{
- /* Close the cmdline window. */
+ // Close the cmdline window.
cmdwin_result = K_IGNORE;
- got_int = FALSE; /* don't stop executing autocommands et al. */
+ got_int = FALSE; // don't stop executing autocommands et al.
nomove = TRUE;
goto doESCkey;
}
@@ -801,13 +801,13 @@ edit(
#ifdef UNIX
do_intr:
#endif
- /* when 'insertmode' set, and not halfway a mapping, don't leave
- * Insert mode */
+ // when 'insertmode' set, and not halfway a mapping, don't leave
+ // Insert mode
if (goto_im())
{
if (got_int)
{
- (void)vgetc(); /* flush all buffers */
+ (void)vgetc(); // flush all buffers
got_int = FALSE;
}
else
@@ -818,8 +818,8 @@ doESCkey:
/*
* This is the ONLY return from edit()!
*/
- /* Always update o_lnum, so that a "CTRL-O ." that adds a line
- * still puts the cursor back after the inserted text. */
+ // Always update o_lnum, so that a "CTRL-O ." that adds a line
+ // still puts the cursor back after the inserted text.
if (ins_at_eol && gchar_cursor() == NUL)
o_lnum = curwin->w_cursor.lnum;
@@ -835,16 +835,16 @@ doESCkey:
}
continue;
- case Ctrl_Z: /* suspend when 'insertmode' set */
+ case Ctrl_Z: // suspend when 'insertmode' set
if (!p_im)
- goto normalchar; /* insert CTRL-Z as normal char */
+ goto normalchar; // insert CTRL-Z as normal char
do_cmdline_cmd((char_u *)"stop");
#ifdef CURSOR_SHAPE
- ui_cursor_shape(); /* may need to update cursor shape */
+ ui_cursor_shape(); // may need to update cursor shape
#endif
continue;
- case Ctrl_O: /* execute one command */
+ case Ctrl_O: // execute one command
#ifdef FEAT_COMPL_FUNC
if (ctrl_x_mode_omni())
goto docomplete;
@@ -853,7 +853,7 @@ doESCkey:
break;
ins_ctrl_o();
- /* don't move the cursor left when 'virtualedit' has "onemore". */
+ // don't move the cursor left when 'virtualedit' has "onemore".
if (ve_flags & VE_ONEMORE)
{
ins_at_eol = FALSE;
@@ -862,15 +862,15 @@ doESCkey:
count = 0;
goto doESCkey;
- case K_INS: /* toggle insert/replace mode */
+ case K_INS: // toggle insert/replace mode
case K_KINS:
ins_insert(replaceState);
break;
- case K_SELECT: /* end of Select mode mapping - ignore */
+ case K_SELECT: // end of Select mode mapping - ignore
break;
- case K_HELP: /* Help key works like <ESC> <Help> */
+ case K_HELP: // Help key works like <ESC> <Help>
case K_F1:
case K_XF1:
stuffcharReadbuff(K_HELP);
@@ -879,55 +879,55 @@ doESCkey:
goto doESCkey;
#ifdef FEAT_NETBEANS_INTG
- case K_F21: /* NetBeans command */
- ++no_mapping; /* don't map the next key hits */
+ case K_F21: // NetBeans command
+ ++no_mapping; // don't map the next key hits
i = plain_vgetc();
--no_mapping;
netbeans_keycommand(i);
break;
#endif
- case K_ZERO: /* Insert the previously inserted text. */
+ case K_ZERO: // Insert the previously inserted text.
case NUL:
case Ctrl_A:
- /* For ^@ the trailing ESC will end the insert, unless there is an
- * error. */
+ // For ^@ the trailing ESC will end the insert, unless there is an
+ // error.
if (stuff_inserted(NUL, 1L, (c == Ctrl_A)) == FAIL
&& c != Ctrl_A && !p_im)
- goto doESCkey; /* quit insert mode */
+ goto doESCkey; // quit insert mode
inserted_space = FALSE;
break;
- case Ctrl_R: /* insert the contents of a register */
+ case Ctrl_R: // insert the contents of a register
ins_reg();
auto_format(FALSE, TRUE);
inserted_space = FALSE;
break;
- case Ctrl_G: /* commands starting with CTRL-G */
+ case Ctrl_G: // commands starting with CTRL-G
ins_ctrl_g();
break;
- case Ctrl_HAT: /* switch input mode and/or langmap */
+ case Ctrl_HAT: // switch input mode and/or langmap
ins_ctrl_hat();
break;
#ifdef FEAT_RIGHTLEFT
- case Ctrl__: /* switch between languages */
+ case Ctrl__: // switch between languages
if (!p_ari)
goto normalchar;
ins_ctrl_();
break;
#endif
- case Ctrl_D: /* Make indent one shiftwidth smaller. */
+ case Ctrl_D: // Make indent one shiftwidth smaller.
#if defined(FEAT_FIND_ID)
if (ctrl_x_mode_path_defines())
goto docomplete;
#endif
- /* FALLTHROUGH */
+ // FALLTHROUGH
- case Ctrl_T: /* Make indent one shiftwidth greater. */
+ case Ctrl_T: // Make indent one shiftwidth greater.
if (c == Ctrl_T && ctrl_x_mode_thesaurus())
{
if (has_compl_option(FALSE))
@@ -940,19 +940,19 @@ doESCkey:
inserted_space = FALSE;
break;
- case K_DEL: /* delete character under the cursor */
+ case K_DEL: // delete character under the cursor
case K_KDEL:
ins_del();
auto_format(FALSE, TRUE);
break;
- case K_BS: /* delete character before the cursor */
+ case K_BS: // delete character before the cursor
case Ctrl_H:
did_backspace = ins_bs(c, BACKSPACE_CHAR, &inserted_space);
auto_format(FALSE, TRUE);
break;
- case Ctrl_W: /* delete word before the cursor */
+ case Ctrl_W: // delete word before the cursor
#ifdef FEAT_JOB_CHANNEL
if (bt_prompt(curbuf) && (mod_mask & MOD_MASK_SHIFT) == 0)
{
@@ -969,9 +969,9 @@ doESCkey:
auto_format(FALSE, TRUE);
break;
- case Ctrl_U: /* delete all inserted text in current line */
+ case Ctrl_U: // delete all inserted text in current line
# ifdef FEAT_COMPL_FUNC
- /* CTRL-X CTRL-U completes with 'completefunc'. */
+ // CTRL-X CTRL-U completes with 'completefunc'.
if (ctrl_x_mode_function())
goto docomplete;
# endif
@@ -980,7 +980,7 @@ doESCkey:
inserted_space = FALSE;
break;
- case K_LEFTMOUSE: /* mouse keys */
+ case K_LEFTMOUSE: // mouse keys
case K_LEFTMOUSE_NM:
case K_LEFTDRAG:
case K_LEFTRELEASE:
@@ -1001,30 +1001,30 @@ doESCkey:
ins_mouse(c);
break;
- case K_MOUSEDOWN: /* Default action for scroll wheel up: scroll up */
+ case K_MOUSEDOWN: // Default action for scroll wheel up: scroll up
ins_mousescroll(MSCR_DOWN);
break;
- case K_MOUSEUP: /* Default action for scroll wheel down: scroll down */
+ case K_MOUSEUP: // Default action for scroll wheel down: scroll down
ins_mousescroll(MSCR_UP);
break;
- case K_MOUSELEFT: /* Scroll wheel left */
+ case K_MOUSELEFT: // Scroll wheel left
ins_mousescroll(MSCR_LEFT);
break;
- case K_MOUSERIGHT: /* Scroll wheel right */
+ case K_MOUSERIGHT: // Scroll wheel right
ins_mousescroll(MSCR_RIGHT);
break;
case K_PS:
bracketed_paste(PASTE_INSERT, FALSE, NULL);
if (cmdchar == K_PS)
- /* invoked from normal mode, bail out */
+ // invoked from normal mode, bail out
goto doESCkey;
break;
case K_PE:
- /* Got K_PE without K_PS, ignore. */
+ // Got K_PE without K_PS, ignore.
break;
#ifdef FEAT_GUI_TABLINE
@@ -1034,17 +1034,17 @@ doESCkey:
break;
#endif
- case K_IGNORE: /* Something mapped to nothing */
+ case K_IGNORE: // Something mapped to nothing
break;
- case K_CURSORHOLD: /* Didn't type something for a while. */
+ case K_CURSORHOLD: // Didn't type something for a while.
ins_apply_autocmds(EVENT_CURSORHOLDI);
did_cursorhold = TRUE;
break;
#ifdef FEAT_GUI_MSWIN
- /* On MS-Windows ignore <M-F4>, we get it when closing the window
- * was cancelled. */
+ // On MS-Windows ignore <M-F4>, we get it when closing the window
+ // was cancelled.
case K_F4:
if (mod_mask != MOD_MASK_ALT)
goto normalchar;
@@ -1061,45 +1061,45 @@ doESCkey:
break;
#endif
- case K_HOME: /* <Home> */
+ case K_HOME: // <Home>
case K_KHOME:
case K_S_HOME:
case K_C_HOME:
ins_home(c);
break;
- case K_END: /* <End> */
+ case K_END: // <End>
case K_KEND:
case K_S_END:
case K_C_END:
ins_end(c);
break;
- case K_LEFT: /* <Left> */
+ case K_LEFT: // <Left>
if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL))
ins_s_left();
else
ins_left();
break;
- case K_S_LEFT: /* <S-Left> */
+ case K_S_LEFT: // <S-Left>
case K_C_LEFT:
ins_s_left();
break;
- case K_RIGHT: /* <Right> */
+ case K_RIGHT: // <Right>
if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL))
ins_s_right();
else
ins_right();
break;
- case K_S_RIGHT: /* <S-Right> */
+ case K_S_RIGHT: // <S-Right>
case K_C_RIGHT:
ins_s_right();
break;
- case K_UP: /* <Up> */
+ case K_UP: // <Up>
if (pum_visible())
goto docomplete;
if (mod_mask & MOD_MASK_SHIFT)
@@ -1108,7 +1108,7 @@ doESCkey:
ins_up(FALSE);
break;
- case K_S_UP: /* <S-Up> */
+ case K_S_UP: // <S-Up>
case K_PAGEUP:
case K_KPAGEUP:
if (pum_visible())
@@ -1116,7 +1116,7 @@ doESCkey:
ins_pageup();
break;
- case K_DOWN: /* <Down> */
+ case K_DOWN: // <Down>
if (pum_visible())
goto docomplete;
if (mod_mask & MOD_MASK_SHIFT)
@@ -1125,7 +1125,7 @@ doESCkey:
ins_down(FALSE);
break;
- case K_S_DOWN: /* <S-Down> */
+ case K_S_DOWN: // <S-Down>
case K_PAGEDOWN:
case K_KPAGEDOWN:
if (pum_visible())
@@ -1134,39 +1134,39 @@ doESCkey:
break;
#ifdef FEAT_DND
- case K_DROP: /* drag-n-drop event */
+ case K_DROP: // drag-n-drop event
ins_drop();
break;
#endif
- case K_S_TAB: /* When not mapped, use like a normal TAB */
+ case K_S_TAB: // When not mapped, use like a normal TAB
c = TAB;
- /* FALLTHROUGH */
+ // FALLTHROUGH
- case TAB: /* TAB or Complete patterns along path */
+ case TAB: // TAB or Complete patterns along path
#if defined(FEAT_FIND_ID)
if (ctrl_x_mode_path_patterns())
goto docomplete;
#endif
inserted_space = FALSE;
if (ins_tab())
- goto normalchar; /* insert TAB as a normal char */
+ goto normalchar; // insert TAB as a normal char
auto_format(FALSE, TRUE);
break;
- case K_KENTER: /* <Enter> */
+ case K_KENTER: // <Enter>
c = CAR;
- /* FALLTHROUGH */
+ // FALLTHROUGH
case CAR:
case NL:
#if defined(FEAT_QUICKFIX)
- /* In a quickfix window a <CR> jumps to the error under the
- * cursor. */
+ // In a quickfix window a <CR> jumps to the error under the
+ // cursor.
if (bt_quickfix(curbuf) && c == CAR)
{
- if (curwin->w_llist_ref == NULL) /* quickfix window */
+ if (curwin->w_llist_ref == NULL) // quickfix window
do_cmdline_cmd((char_u *)".cc");
- else /* location list window */
+ else // location list window
do_cmdline_cmd((char_u *)".ll");
break;
}
@@ -1174,7 +1174,7 @@ doESCkey:
#ifdef FEAT_CMDWIN
if (cmdwin_type != 0)
{
- /* Execute the command in the cmdline window. */
+ // Execute the command in the cmdline window.
cmdwin_result = CAR;
goto doESCkey;
}
@@ -1191,12 +1191,12 @@ doESCkey:
}
#endif
if (ins_eol(c) == FAIL && !p_im)
- goto doESCkey; /* out of memory */
+ goto doESCkey; // out of memory
auto_format(FALSE, FALSE);
inserted_space = FALSE;
break;
- case Ctrl_K: /* digraph or keyword completion */
+ case Ctrl_K: // digraph or keyword completion
if (ctrl_x_mode_dictionary())
{
if (has_compl_option(TRUE))
@@ -1210,30 +1210,30 @@ doESCkey:
#endif
goto normalchar;
- case Ctrl_X: /* Enter CTRL-X mode */
+ case Ctrl_X: // Enter CTRL-X mode
ins_ctrl_x();
break;
- case Ctrl_RSB: /* Tag name completion after ^X */
+ case Ctrl_RSB: // Tag name completion after ^X
if (!ctrl_x_mode_tags())
goto normalchar;
goto docomplete;
- case Ctrl_F: /* File name completion after ^X */
+ case Ctrl_F: // File name completion after ^X
if (!ctrl_x_mode_files())
goto normalchar;
goto docomplete;
- case 's': /* Spelling completion after ^X */
+ case 's': // Spelling completion after ^X
case Ctrl_S:
if (!ctrl_x_mode_spell())
goto normalchar;
goto docomplete;
- case Ctrl_L: /* Whole line completion after ^X */
+ case Ctrl_L: // Whole line completion after ^X
if (!ctrl_x_mode_whole_line())
{
- /* CTRL-L with 'insertmode' set: Leave Insert mode */
+ // CTRL-L with 'insertmode' set: Leave Insert mode
if (p_im)
{
if (echeck_abbr(Ctrl_L + ABBR_OFF))
@@ -1242,12 +1242,12 @@ doESCkey:
}
goto normalchar;
}
- /* FALLTHROUGH */
+ // FALLTHROUGH
- case Ctrl_P: /* Do previous/next pattern completion */
+ case Ctrl_P: // Do previous/next pattern completion
case Ctrl_N:
- /* if 'complete' is empty then plain ^P is no longer special,
- * but it is under other ^X modes */
+ // if 'complete' is empty then plain ^P is no longer special,
+ // but it is under other ^X modes
if (*curbuf->b_p_cpt == NUL
&& (ctrl_x_mode_normal() || ctrl_x_mode_whole_line())
&& !(compl_cont_status & CONT_LOCAL))
@@ -1256,7 +1256,7 @@ doESCkey:
docomplete:
compl_busy = TRUE;
#ifdef FEAT_FOLDING
- disable_fold_update++; /* don't redraw folds here */
+ disable_fold_update++; // don't redraw folds here
#endif
if (ins_complete(c, TRUE) == FAIL)
compl_cont_status = 0;
@@ -1266,14 +1266,14 @@ docomplete:
compl_busy = FALSE;
break;
- case Ctrl_Y: /* copy from previous line or scroll down */
- case Ctrl_E: /* copy from next line or scroll up */
+ case Ctrl_Y: // copy from previous line or scroll down
+ case Ctrl_E: // copy from next line or scroll up
c = ins_ctrl_ey(c);
break;
default:
#ifdef UNIX
- if (c == intr_char) /* special interrupt char */
+ if (c == intr_char) // special interrupt char
goto do_intr;
#endif
@@ -1284,7 +1284,7 @@ normalchar:
#if defined(FEAT_EVAL)
if (!p_paste)
{
- /* Trigger InsertCharPre. */
+ // Trigger InsertCharPre.
char_u *str = do_insert_char_pre(c);
char_u *p;
@@ -1292,7 +1292,7 @@ normalchar:
{
if (*str != NUL && stop_arrow() != FAIL)
{
- /* Insert the new value of v:char literally. */
+ // Insert the new value of v:char literally.
for (p = str; *p != NUL; MB_PTR_ADV(p))
{
c = PTR2CHAR(p);
@@ -1307,14 +1307,14 @@ normalchar:
c = NUL;
}
- /* If the new value is already inserted or an empty string
- * then don't insert any character. */
+ // If the new value is already inserted or an empty string
+ // then don't insert any character.
if (c == NUL)
break;
}
#endif
#ifdef FEAT_SMARTINDENT
- /* Try to perform smart-indenting. */
+ // Try to perform smart-indenting.
ins_try_si(c);
#endif
@@ -1330,9 +1330,9 @@ normalchar:
Insstart_blank_vcol = get_nolist_virtcol();
}
- /* Insert a normal character and check for abbreviations on a
- * special character. Let CTRL-] expand abbreviations without
- * inserting it. */
+ // Insert a normal character and check for abbreviations on a
+ // special character. Let CTRL-] expand abbreviations without
+ // inserting it.
if (vim_iswordc(c) || (!echeck_abbr(
// Add ABBR_OFF for characters above 0x100, this is
// what check_abbr() expects.
@@ -1349,23 +1349,23 @@ normalchar:
auto_format(FALSE, TRUE);
#ifdef FEAT_FOLDING
- /* When inserting a character the cursor line must never be in a
- * closed fold. */
+ // When inserting a character the cursor line must never be in a
+ // closed fold.
foldOpenCursor();
#endif
break;
- } /* end of switch (c) */
+ } // end of switch (c)
- /* If typed something may trigger CursorHoldI again. */
+ // If typed something may trigger CursorHoldI again.
if (c != K_CURSORHOLD
#ifdef FEAT_COMPL_FUNC
- /* but not in CTRL-X mode, a script can't restore the state */
+ // but not in CTRL-X mode, a script can't restore the state
&& ctrl_x_mode_normal()
#endif
)
did_cursorhold = FALSE;
- /* If the cursor was moved we didn't just insert a space */
+ // If the cursor was moved we didn't just insert a space
if (arrow_used)
inserted_space = FALSE;
@@ -1379,14 +1379,14 @@ force_cindent:
if (in_cinkeys(c, ' ', line_is_white))
{
if (stop_arrow() == OK)
- /* re-indent the current line */
+ // re-indent the current line
do_c_expr_indent();
}
}
-#endif /* FEAT_CINDENT */
+#endif // FEAT_CINDENT
- } /* for (;;) */
- /* NOTREACHED */
+ } // for (;;)
+ // NOTREACHED
}
int
@@ -1414,8 +1414,8 @@ ins_redraw(int ready) // not busy with something
if (char_avail())
return;
- /* Trigger CursorMoved if the cursor moved. Not when the popup menu is
- * visible, the command might delete it. */
+ // Trigger CursorMoved if the cursor moved. Not when the popup menu is
+ // visible, the command might delete it.
if (ready && (has_cursormovedI()
# ifdef FEAT_PROP_POPUP
|| popup_visible
@@ -1428,17 +1428,17 @@ ins_redraw(int ready) // not busy with something
&& !pum_visible())
{
# ifdef FEAT_SYN_HL
- /* Need to update the screen first, to make sure syntax
- * highlighting is correct after making a change (e.g., inserting
- * a "(". The autocommand may also require a redraw, so it's done
- * again below, unfortunately. */
+ // Need to update the screen first, to make sure syntax
+ // highlighting is correct after making a change (e.g., inserting
+ // a "(". The autocommand may also require a redraw, so it's done
+ // again below, unfortunately.
if (syntax_present(curwin) && must_redraw)
update_screen(0);
# endif
if (has_cursormovedI())
{
- /* Make sure curswant is correct, an autocommand may call
- * getcurpos(). */
+ // Make sure curswant is correct, an autocommand may call
+ // getcurpos().
update_curswant();
ins_apply_autocmds(EVENT_CURSORMOVEDI);
}
@@ -1457,7 +1457,7 @@ ins_redraw(int ready) // not busy with something
last_cursormoved = curwin->w_cursor;
}
- /* Trigger TextChangedI if b_changedtick differs. */
+ // Trigger TextChangedI if b_changedtick differs.
if (ready && has_textchangedI()
&& curbuf->b_last_changedtick != CHANGEDTICK(curbuf)
&& !pum_visible())
@@ -1475,9 +1475,9 @@ ins_redraw(int ready) // not busy with something
(linenr_T)(curwin->w_cursor.lnum + 1));
}
- /* Trigger TextChangedP if b_changedtick differs. When the popupmenu closes
- * TextChangedI will need to trigger for backwards compatibility, thus use
- * different b_last_changedtick* variables. */
+ // Trigger TextChangedP if b_changedtick differs. When the popupmenu closes
+ // TextChangedI will need to trigger for backwards compatibility, thus use
+ // different b_last_changedtick* variables.
if (ready && has_textchangedP()
&& curbuf->b_last_changedtick_pum != CHANGEDTICK(curbuf)
&& pum_visible())
@@ -1517,10 +1517,10 @@ ins_redraw(int ready) // not busy with something
if (must_redraw)
update_screen(0);
else if (clear_cmdline || redraw_cmdline)
- showmode(); /* clear cmdline and show mode */
+ showmode(); // clear cmdline and show mode
showruler(FALSE);
setcursor();
- emsg_on_display = FALSE; /* may remove error message now */
+ emsg_on_display = FALSE; // may remove error message now
}
/*
@@ -1533,7 +1533,7 @@ ins_ctrl_v(void)
int did_putchar = FALSE;
int prev_mod_mask = mod_mask;
- /* may need to redraw when no more chars available now */
+ // may need to redraw when no more chars available now
ins_redraw(FALSE);
if (redrawing() && !char_avail())
@@ -1541,7 +1541,7 @@ ins_ctrl_v(void)
edit_putchar('^', TRUE);
did_putchar = TRUE;
}
- AppendToRedobuff((char_u *)CTRL_V_STR); /* CTRL-V */
+ AppendToRedobuff((char_u *)CTRL_V_STR); // CTRL-V
#ifdef FEAT_CMDL_INFO
add_to_showcmd_c(Ctrl_V);
@@ -1549,8 +1549,8 @@ ins_ctrl_v(void)
c = get_literal();
if (did_putchar)
- /* when the line fits in 'columns' the '^' is at the start of the next
- * line and will not removed by the redraw */
+ // when the line fits in 'columns' the '^' is at the start of the next
+ // line and will not removed by the redraw
edit_unputchar();
#ifdef FEAT_CMDL_INFO
clear_showcmd();
@@ -1626,11 +1626,11 @@ decodeModifyOtherKeys(int c)
* Used while handling CTRL-K, CTRL-V, etc. in Insert mode.
*/
static int pc_status;
-#define PC_STATUS_UNSET 0 /* pc_bytes was not set */
-#define PC_STATUS_RIGHT 1 /* right halve of double-wide char */
-#define PC_STATUS_LEFT 2 /* left halve of double-wide char */
-#define PC_STATUS_SET 3 /* pc_bytes was filled */
-static char_u pc_bytes[MB_MAXBYTES + 1]; /* saved bytes */
+#define PC_STATUS_UNSET 0 // pc_bytes was not set
+#define PC_STATUS_RIGHT 1 // right halve of double-wide char
+#define PC_STATUS_LEFT 2 // left halve of double-wide char
+#define PC_STATUS_SET 3 // pc_bytes was filled
+static char_u pc_bytes[MB_MAXBYTES + 1]; // saved bytes
static int pc_attr;
static int pc_row;
static int pc_col;
@@ -1642,7 +1642,7 @@ edit_putchar(int c, int highlight)
if (ScreenLines != NULL)
{
- update_topline(); /* just in case w_topline isn't valid */
+ update_topline(); // just in case w_topline isn't valid
validate_cursor();
if (highlight)
attr = HL_ATTR(HLF_8);
@@ -1675,7 +1675,7 @@ edit_putchar(int c, int highlight)
pc_status = PC_STATUS_LEFT;
}
- /* save the character to be able to put it back */
+ // save the character to be able to put it back
if (pc_status == PC_STATUS_UNSET)
{
screen_getbytes(pc_row, pc_col, pc_bytes, &pc_attr);
@@ -1737,7 +1737,7 @@ init_prompt(int cmdchar_todo)
coladvance((colnr_T)MAXCOL);
if (cmdchar_todo == 'I' || curwin->w_cursor.col <= (int)STRLEN(prompt))
curwin->w_cursor.col = (int)STRLEN(prompt);
- /* Make sure the cursor is in a valid position. */
+ // Make sure the cursor is in a valid position.
check_cursor();
}
@@ -1788,11 +1788,11 @@ display_dollar(colnr_T col)
{
char_u *p;
- /* If on the last byte of a multi-byte move to the first byte. */
+ // If on the last byte of a multi-byte move to the first byte.
p = ml_get_curline();
curwin->w_cursor.col -= (*mb_head_off)(p, p + col);
}
- curs_columns(FALSE); /* recompute w_wrow and w_wcol */
+ curs_columns(FALSE); // recompute w_wrow and w_wcol
if (curwin->w_wcol < curwin->w_width)
{
edit_putchar('$', FALSE);
@@ -1825,11 +1825,11 @@ truncate_spaces(char_u *line)
{
int i;
- /* find start of trailing white space */
+ // find start of trailing white space
for (i = (int)STRLEN(line) - 1; i >= 0 && VIM_ISWHITE(line[i]); i--)
{
if (State & REPLACE_FLAG)
- replace_join(0); /* remove a NUL from the replace stack */
+ replace_join(0); // remove a NUL from the replace stack
}
line[i + 1] = NUL;
}
@@ -1865,15 +1865,15 @@ del_char_after_col(int limit_col UNUSED)
{
colnr_T ecol = curwin->w_cursor.col + 1;
- /* Make sure the cursor is at the start of a character, but
- * skip forward again when going too far back because of a
- * composing character. */
+ // Make sure the cursor is at the start of a character, but
+ // skip forward again when going too far back because of a
+ // composing character.
mb_adjust_cursor();
while (curwin->w_cursor.col < (colnr_T)limit_col)
{
int l = utf_ptr2len(ml_get_cursor());
- if (l == 0) /* end of line */
+ if (l == 0) // end of line
break;
curwin->w_cursor.col += l;
}
@@ -1916,9 +1916,9 @@ get_literal(void)
++allow_keys;
#endif
#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
+ dont_scroll = TRUE; // disallow scrolling here
#endif
- ++no_mapping; /* don't map the next key hits */
+ ++no_mapping; // don't map the next key hits
cc = 0;
i = 0;
for (;;)
@@ -1959,25 +1959,25 @@ get_literal(void)
}
if (cc > 255 && unicode == 0)
- cc = 255; /* limit range to 0-255 */
+ cc = 255; // limit range to 0-255
nc = 0;
- if (hex) /* hex: up to two chars */
+ if (hex) // hex: up to two chars
{
if (i >= 2)
break;
}
- else if (unicode) /* Unicode: up to four or eight chars */
+ else if (unicode) // Unicode: up to four or eight chars
{
if ((unicode == 'u' && i >= 4) || (unicode == 'U' && i >= 8))
break;
}
- else if (i >= 3) /* decimal or octal: up to three chars */
+ else if (i >= 3) // decimal or octal: up to three chars
break;
}
- if (i == 0) /* no number entered */
+ if (i == 0) // no number entered
{
- if (nc == K_ZERO) /* NUL is stored as NL */
+ if (nc == K_ZERO) // NUL is stored as NL
{
cc = '\n';
nc = 0;
@@ -1989,11 +1989,11 @@ get_literal(void)
}
}
- if (cc == 0) /* NUL is stored as NL */
+ if (cc == 0) // NUL is stored as NL
cc = '\n';
if (enc_dbcs && (cc & 0xff) == 0)
- cc = '?'; /* don't accept an illegal DBCS char, the NUL in the
- second byte will cause trouble! */
+ cc = '?'; // don't accept an illegal DBCS char, the NUL in the
+ // second byte will cause trouble!
--no_mapping;
#ifdef FEAT_GUI
@@ -2002,7 +2002,7 @@ get_literal(void)
#endif
if (nc)
vungetc(nc);
- got_int = FALSE; /* CTRL-C typed after CTRL-V is not an interrupt */
+ got_int = FALSE; // CTRL-C typed after CTRL-V is not an interrupt
return cc;
}
@@ -2013,7 +2013,7 @@ get_literal(void)
insert_special(
int c,
int allow_modmask,
- int ctrlv) /* c was typed after CTRL-V */
+ int ctrlv) // c was typed after CTRL-V
{
char_u *p;
int len;
@@ -2026,7 +2026,7 @@ insert_special(
* unless 'allow_modmask' is TRUE.
*/
#ifdef MACOS_X
- /* Command-key never produces a normal key */
+ // Command-key never produces a normal key
if (mod_mask & MOD_MASK_CMD)
allow_modmask = TRUE;
#endif
@@ -2078,9 +2078,9 @@ insert_special(
*/
void
insertchar(
- int c, /* character to insert or NUL */
- int flags, /* INSCHAR_FORMAT, etc. */
- int second_indent) /* indent for second line if >= 0 */
+ int c, // character to insert or NUL
+ int flags, // INSCHAR_FORMAT, etc.
+ int second_indent) // indent for second line if >= 0
{
int textwidth;
char_u *p;
@@ -2118,8 +2118,8 @@ insertchar(
|| Insstart_blank_vcol <= (colnr_T)textwidth
))))))
{
- /* Format with 'formatexpr' when it's set. Use internal formatting
- * when 'formatexpr' isn't set or it returns non-zero. */
+ // Format with 'formatexpr' when it's set. Use internal formatting
+ // when 'formatexpr' isn't set or it returns non-zero.
#if defined(FEAT_EVAL)
int do_internal = TRUE;
colnr_T virtcol = get_nolist_virtcol()
@@ -2129,8 +2129,8 @@ insertchar(
&& (force_format || virtcol > (colnr_T)textwidth))
{
do_internal = (fex_format(curwin->w_cursor.lnum, 1L, c) != 0);
- /* It may be required to save for undo again, e.g. when setline()
- * was called. */
+ // It may be required to save for undo again, e.g. when setline()
+ // was called.
ins_need_undo = TRUE;
}
if (do_internal)
@@ -2138,7 +2138,7 @@ insertchar(
internal_format(textwidth, second_indent, flags, c == NUL, c);
}
- if (c == NUL) /* only formatting was wanted */
+ if (c == NUL) // only formatting was wanted
return;
// Check whether this character should end a comment.
@@ -2211,7 +2211,7 @@ insertchar(
* InsertCharPre autocommand could change the input buffer.
*/
#ifdef USE_ON_FLY_SCROLL
- dont_scroll = FALSE; /* allow scrolling here */
+ dont_scroll = FALSE; // allow scrolling here
#endif
if ( !ISSPECIAL(c)
@@ -2255,7 +2255,7 @@ insertchar(
#ifdef FEAT_RIGHTLEFT
c = vgetc();
if (p_hkmap && KeyTyped)
- c = hkmap(c); /* Hebrew mode mapping */
+ c = hkmap(c); // Hebrew mode mapping
buf[i++] = c;
#else
buf[i++] = vgetc();
@@ -2263,8 +2263,8 @@ insertchar(
}
#ifdef FEAT_DIGRAPHS
- do_digraph(-1); /* clear digraphs */
- do_digraph(buf[i-1]); /* may be the start of a digraph */
+ do_digraph(-1); // clear digraphs
+ do_digraph(buf[i-1]); // may be the start of a digraph
#endif
buf[i] = NUL;
ins_str(buf);
@@ -2314,7 +2314,7 @@ internal_format(
int second_indent,
int flags,
int format_only,
- int c) /* character to be inserted (can be NUL) */
+ int c) // character to be inserted (can be NUL)
{
int cc;
int save_char = NUL;
@@ -2329,7 +2329,7 @@ internal_format(
#ifdef FEAT_LINEBREAK
int has_lbr = curwin->w_p_lbr;
- /* make sure win_lbr_chartabsize() counts correctly */
+ // make sure win_lbr_chartabsize() counts correctly
curwin->w_p_lbr = FALSE;
#endif
@@ -2352,10 +2352,10 @@ internal_format(
*/
while (!got_int)
{
- int startcol; /* Cursor column at entry */
- int wantcol; /* column at textwidth border */
- int foundcol; /* column for start of spaces */
- int end_foundcol = 0; /* column for start of word */
+ int startcol; // Cursor column at entry
+ int wantcol; // column at textwidth border
+ int foundcol; // column for start of spaces
+ int end_foundcol = 0; // column for start of word
colnr_T len;
colnr_T virtcol;
int orig_col = 0;
@@ -2375,16 +2375,16 @@ internal_format(
&& has_format_option(FO_WRAP_COMS))
do_comments = TRUE;
- /* Don't break until after the comment leader */
+ // Don't break until after the comment leader
if (do_comments)
leader_len = get_leader_len(ml_get_curline(), NULL, FALSE, TRUE);
else
leader_len = 0;
- /* If the line doesn't start with a comment leader, then don't
- * start one in a following broken line. Avoids that a %word
- * moved to the start of the next line causes all following lines
- * to start with %. */
+ // If the line doesn't start with a comment leader, then don't
+ // start one in a following broken line. Avoids that a %word
+ // moved to the start of the next line causes all following lines
+ // to start with %.
if (leader_len == 0)
no_leader = TRUE;
if (!(flags & INSCHAR_FORMAT)
@@ -2395,7 +2395,7 @@ internal_format(
if ((startcol = curwin->w_cursor.col) == 0)
break;
- /* find column of textwidth border */
+ // find column of textwidth border
coladvance((colnr_T)textwidth);
wantcol = curwin->w_cursor.col;
@@ -2417,7 +2417,7 @@ internal_format(
cc = gchar_cursor();
if (WHITECHAR(cc))
{
- /* remember position of blank just before text */
+ // remember position of blank just before text
end_col = curwin->w_cursor.col;
// find start of sequence of blanks
@@ -2433,22 +2433,22 @@ internal_format(
wcc++;
}
if (curwin->w_cursor.col == 0 && WHITECHAR(cc))
- break; /* only spaces in front of text */
+ break; // only spaces in front of text
// Don't break after a period when 'formatoptions' has 'p' and
// there are less than two spaces.
if (has_format_option(FO_PERIOD_ABBR) && cc == '.' && wcc < 2)
continue;
- /* Don't break until after the comment leader */
+ // Don't break until after the comment leader
if (curwin->w_cursor.col < leader_len)
break;
if (has_format_option(FO_ONE_LETTER))
{
- /* do not break after one-letter words */
+ // do not break after one-letter words
if (curwin->w_cursor.col == 0)
- break; /* one-letter word at begin */
- /* do not break "#a b" when 'tw' is 2 */
+ break; // one-letter word at begin
+ // do not break "#a b" when 'tw' is 2
if (curwin->w_cursor.col <= leader_len)
break;
col = curwin->w_cursor.col;
@@ -2456,7 +2456,7 @@ internal_format(
cc = gchar_cursor();
if (WHITECHAR(cc))
- continue; /* one-letter, continue */
+ continue; // one-letter, continue
curwin->w_cursor.col = col;
}
@@ -2469,15 +2469,15 @@ internal_format(
}
else if (cc >= 0x100 && fo_multibyte)
{
- /* Break after or before a multi-byte character. */
+ // Break after or before a multi-byte character.
if (curwin->w_cursor.col != startcol)
{
- /* Don't break until after the comment leader */
+ // Don't break until after the comment leader
if (curwin->w_cursor.col < leader_len)
break;
col = curwin->w_cursor.col;
inc_cursor();
- /* Don't change end_foundcol if already set. */
+ // Don't change end_foundcol if already set.
if (foundcol != curwin->w_cursor.col)
{
foundcol = curwin->w_cursor.col;
@@ -2497,8 +2497,8 @@ internal_format(
cc = gchar_cursor();
if (WHITECHAR(cc))
- continue; /* break with space */
- /* Don't break until after the comment leader */
+ continue; // break with space
+ // Don't break until after the comment leader
if (curwin->w_cursor.col < leader_len)
break;
@@ -2514,13 +2514,13 @@ internal_format(
dec_cursor();
}
- if (foundcol == 0) /* no spaces, cannot break line */
+ if (foundcol == 0) // no spaces, cannot break line
{
curwin->w_cursor.col = startcol;
break;
}
- /* Going to break the line, remove any "$" now. */
+ // Going to break the line, remove any "$" now.
undisplay_dollar();
/*
@@ -2529,7 +2529,7 @@ internal_format(
* over the text instead.
*/
if (State & VREPLACE_FLAG)
- orig_col = startcol; /* Will start backspacing from here */
+ orig_col = startcol; // Will start backspacing from here
else
replace_offset = startcol - end_foundcol;
@@ -2554,16 +2554,16 @@ internal_format(
saved_text = vim_strsave(ml_get_cursor());
curwin->w_cursor.col = orig_col;
if (saved_text == NULL)
- break; /* Can't do it, out of memory */
+ break; // Can't do it, out of memory
saved_text[startcol] = NUL;
- /* Backspace over characters that will move to the next line */
+ // Backspace over characters that will move to the next line
if (!fo_white_par)
backspace_until_column(foundcol);
}
else
{
- /* put cursor after pos. to break line */
+ // put cursor after pos. to break line
if (!fo_white_par)
curwin->w_cursor.col = foundcol;
}
@@ -2606,12 +2606,12 @@ internal_format(
int i;
int padding = second_indent - leader_len;
- /* We started at the first_line of a numbered list
- * that has a comment. the open_line() function has
- * inserted the proper comment leader and positioned
- * the cursor at the end of the split line. Now we
- * add the additional whitespace needed after the
- * comment leader for the numbered list. */
+ // We started at the first_line of a numbered list
+ // that has a comment. the open_line() function has
+ // inserted the proper comment leader and positioned
+ // the cursor at the end of the split line. Now we
+ // add the additional whitespace needed after the
+ // comment leader for the numbered list.
for (i = 0; i < padding; i++)
ins_str((char_u *)" ");
}
@@ -2649,7 +2649,7 @@ internal_format(
#ifdef FEAT_CINDENT
can_cindent = TRUE;
#endif
- /* moved the cursor, don't autoindent or cindent now */
+ // moved the cursor, don't autoindent or cindent now
did_ai = FALSE;
#ifdef FEAT_SMARTINDENT
did_si = FALSE;
@@ -2659,7 +2659,7 @@ internal_format(
line_breakcheck();
}
- if (save_char != NUL) /* put back space after cursor */
+ if (save_char != NUL) // put back space after cursor
pchar_cursor(save_char);
#ifdef FEAT_LINEBREAK
@@ -2681,8 +2681,8 @@ internal_format(
*/
void
auto_format(
- int trailblank, /* when TRUE also format with trailing blank */
- int prev_line) /* may start in previous line */
+ int trailblank, // when TRUE also format with trailing blank
+ int prev_line) // may start in previous line
{
pos_T pos;
colnr_T len;
@@ -2697,14 +2697,14 @@ auto_format(
pos = curwin->w_cursor;
old = ml_get_curline();
- /* may remove added space */
+ // may remove added space
check_auto_format(FALSE);
- /* Don't format in Insert mode when the cursor is on a trailing blank, the
- * user might insert normal text next. Also skip formatting when "1" is
- * in 'formatoptions' and there is a single character before the cursor.
- * Otherwise the line would be broken and when typing another non-white
- * next they are not joined back together. */
+ // Don't format in Insert mode when the cursor is on a trailing blank, the
+ // user might insert normal text next. Also skip formatting when "1" is
+ // in 'formatoptions' and there is a single character before the cursor.
+ // Otherwise the line would be broken and when typing another non-white
+ // next they are not joined back together.
wasatend = (pos.col == (colnr_T)STRLEN(old));
if (*old != NUL && !trailblank && wasatend)
{
@@ -2722,8 +2722,8 @@ auto_format(
curwin->w_cursor = pos;
}
- /* With the 'c' flag in 'formatoptions' and 't' missing: only format
- * comments. */
+ // With the 'c' flag in 'formatoptions' and 't' missing: only format
+ // comments.
if (has_format_option(FO_WRAP_COMS) && !has_format_option(FO_WRAP)
&& get_leader_len(old, NULL, FALSE, TRUE) == 0)
return;
@@ -2751,17 +2751,17 @@ auto_format(
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
{
- /* "cannot happen" */
+ // "cannot happen"
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
coladvance((colnr_T)MAXCOL);
}
else
check_cursor_col();
- /* Insert mode: If the cursor is now after the end of the line while it
- * previously wasn't, the line was broken. Because of the rule above we
- * need to add a space when 'w' is in 'formatoptions' to keep a paragraph
- * formatted. */
+ // Insert mode: If the cursor is now after the end of the line while it
+ // previously wasn't, the line was broken. Because of the rule above we
+ // need to add a space when 'w' is in 'formatoptions' to keep a paragraph
+ // formatted.
if (!wasatend && has_format_option(FO_WHITE_PAR))
{
new = ml_get_curline();
@@ -2772,11 +2772,11 @@ auto_format(
pnew[len] = ' ';
pnew[len + 1] = NUL;
ml_replace(curwin->w_cursor.lnum, pnew, FALSE);
- /* remove the space later */
+ // remove the space later
did_add_space = TRUE;
}
else
- /* may remove added space */
+ // may remove added space
check_auto_format(FALSE);
}
@@ -2790,7 +2790,7 @@ auto_format(
*/
static void
check_auto_format(
- int end_insert) /* TRUE when ending Insert mode */
+ int end_insert) // TRUE when ending Insert mode
{
int c = ' ';
int cc;
@@ -2799,7 +2799,7 @@ check_auto_format(
{
cc = gchar_cursor();
if (!WHITECHAR(cc))
- /* Somehow the space was removed already. */
+ // Somehow the space was removed already.
did_add_space = FALSE;
else
{
@@ -2811,7 +2811,7 @@ check_auto_format(
}
if (c != NUL)
{
- /* The space is no longer at the end of the line, delete it. */
+ // The space is no longer at the end of the line, delete it.
del_char(FALSE);
did_add_space = FALSE;
}
@@ -2828,15 +2828,15 @@ check_auto_format(
*/
int
comp_textwidth(
- int ff) /* force formatting (for "gq" command) */
+ int ff) // force formatting (for "gq" command)
{
int textwidth;
textwidth = curbuf->b_p_tw;
if (textwidth == 0 && curbuf->b_p_wm)
{
- /* The width is the window width minus 'wrapmargin' minus all the
- * things that add to the margin. */
+ // The width is the window width minus 'wrapmargin' minus all the
+ // things that add to the margin.
textwidth = curwin->w_width - curbuf->b_p_wm;
#ifdef FEAT_CMDWIN
if (cmdwin_type != 0)
@@ -2871,8 +2871,8 @@ redo_literal(int c)
{
char_u buf[10];
- /* Only digits need special treatment. Translate them into a string of
- * three digits. */
+ // Only digits need special treatment. Translate them into a string of
+ // three digits.
if (VIM_ISDIGIT(c))
{
vim_snprintf((char *)buf, sizeof(buf), "%03d", c);
@@ -2888,7 +2888,7 @@ redo_literal(int c)
*/
void
start_arrow(
- pos_T *end_insert_pos) /* can be NULL */
+ pos_T *end_insert_pos) // can be NULL
{
start_arrow_common(end_insert_pos, TRUE);
}
@@ -2899,8 +2899,8 @@ start_arrow(
*/
static void
start_arrow_with_change(
- pos_T *end_insert_pos, /* can be NULL */
- int end_change) /* end undoable change */
+ pos_T *end_insert_pos, // can be NULL
+ int end_change) // end undoable change
{
start_arrow_common(end_insert_pos, end_change);
if (!end_change)
@@ -2912,14 +2912,14 @@ start_arrow_with_change(
static void
start_arrow_common(
- pos_T *end_insert_pos, /* can be NULL */
- int end_change) /* end undoable change */
+ pos_T *end_insert_pos, // can be NULL
+ int end_change) // end undoable change
{
- if (!arrow_used && end_change) /* something has been inserted */
+ if (!arrow_used && end_change) // something has been inserted
{
AppendToRedobuff(ESC_STR);
stop_insert(end_insert_pos, FALSE, FALSE);
- arrow_used = TRUE; /* this means we stopped the current insert */
+ arrow_used = TRUE; // this means we stopped the current insert
}
#ifdef FEAT_SPELL
check_spell_redraw();
@@ -2955,10 +2955,10 @@ stop_arrow(void)
{
if (arrow_used)
{
- Insstart = curwin->w_cursor; /* new insertion starts here */
+ Insstart = curwin->w_cursor; // new insertion starts here
if (Insstart.col > Insstart_orig.col && !ins_need_undo)
- /* Don't update the original insert position when moved to the
- * right, except when nothing was inserted yet. */
+ // Don't update the original insert position when moved to the
+ // right, except when nothing was inserted yet.
update_Insstart_orig = FALSE;
Insstart_textlen = (colnr_T)linetabsize(ml_get_curline());
@@ -2975,7 +2975,7 @@ stop_arrow(void)
vr_lines_changed = 1;
}
ResetRedobuff();
- AppendToRedobuff((char_u *)"1i"); /* pretend we start an insertion */
+ AppendToRedobuff((char_u *)"1i"); // pretend we start an insertion
new_insert_skip = 2;
}
else if (ins_need_undo)
@@ -2985,7 +2985,7 @@ stop_arrow(void)
}
#ifdef FEAT_FOLDING
- /* Always open fold at the cursor line when inserting something. */
+ // Always open fold at the cursor line when inserting something.
foldOpenCursor();
#endif
@@ -3000,14 +3000,14 @@ stop_arrow(void)
static void
stop_insert(
pos_T *end_insert_pos,
- int esc, /* called by ins_esc() */
- int nomove) /* <c-\><c-o>, don't move cursor */
+ int esc, // called by ins_esc()
+ int nomove) // <c-\><c-o>, don't move cursor
{
int cc;
char_u *ptr;
stop_redo_ins();
- replace_flush(); /* abandon replace stack */
+ replace_flush(); // abandon replace stack
/*
* Save the inserted text for later redo with ^@ and CTRL-A.
@@ -3027,17 +3027,17 @@ stop_insert(
if (!arrow_used && end_insert_pos != NULL)
{
- /* Auto-format now. It may seem strange to do this when stopping an
- * insertion (or moving the cursor), but it's required when appending
- * a line and having it end in a space. But only do it when something
- * was actually inserted, otherwise undo won't work. */
+ // Auto-format now. It may seem strange to do this when stopping an
+ // insertion (or moving the cursor), but it's required when appending
+ // a line and having it end in a space. But only do it when something
+ // was actually inserted, otherwise undo won't work.
if (!ins_need_undo && has_format_option(FO_AUTO))
{
pos_T tpos = curwin->w_cursor;
- /* When the cursor is at the end of the line after a space the
- * formatting will move it to the following word. Avoid that by
- * moving the cursor onto the space. */
+ // When the cursor is at the end of the line after a space the
+ // formatting will move it to the following word. Avoid that by
+ // moving the cursor onto the space.
cc = 'x';
if (curwin->w_cursor.col > 0 && gchar_cursor() == NUL)
{
@@ -3062,14 +3062,14 @@ stop_insert(
}
}
- /* If a space was inserted for auto-formatting, remove it now. */
+ // If a space was inserted for auto-formatting, remove it now.
check_auto_format(TRUE);
- /* If we just did an auto-indent, remove the white space from the end
- * of the line, and put the cursor back.
- * Do this when ESC was used or moving the cursor up/down.
- * Check for the old position still being valid, just in case the text
- * got changed unexpectedly. */
+ // If we just did an auto-indent, remove the white space from the end
+ // of the line, and put the cursor back.
+ // Do this when ESC was used or moving the cursor up/down.
+ // Check for the old position still being valid, just in case the text
+ // got changed unexpectedly.
if (!nomove && did_ai && (esc || (vim_strchr(p_cpo, CPO_INDENT) == NULL
&& curwin->w_cursor.lnum != end_insert_pos->lnum))
&& end_insert_pos->lnum <= curbuf->b_ml.ml_line_count)
@@ -3077,7 +3077,7 @@ stop_insert(
pos_T tpos = curwin->w_cursor;
curwin->w_cursor = *end_insert_pos;
- check_cursor_col(); /* make sure it is not past the line */
+ check_cursor_col(); // make sure it is not past the line
for (;;)
{
if (gchar_cursor() == NUL && curwin->w_cursor.col > 0)
@@ -3086,21 +3086,21 @@ stop_insert(
if (!VIM_ISWHITE(cc))
break;
if (del_char(TRUE) == FAIL)
- break; /* should not happen */
+ break; // should not happen
}
if (curwin->w_cursor.lnum != tpos.lnum)
curwin->w_cursor = tpos;
else
{
- /* reset tpos, could have been invalidated in the loop above */
+ // reset tpos, could have been invalidated in the loop above
tpos = curwin->w_cursor;
tpos.col++;
if (cc != NUL && gchar_pos(&tpos) == NUL)
- ++curwin->w_cursor.col; /* put cursor back on the NUL */
+ ++curwin->w_cursor.col; // put cursor back on the NUL
}
- /* <C-S-Right> may have started Visual mode, adjust the position for
- * deleted characters. */
+ // <C-S-Right> may have started Visual mode, adjust the position for
+ // deleted characters.
if (VIsual_active && VIsual.lnum == curwin->w_cursor.lnum)
{
int len = (int)STRLEN(ml_get_curline());
@@ -3120,8 +3120,8 @@ stop_insert(
can_si_back = FALSE;
#endif
- /* Set '[ and '] to the inserted text. When end_insert_pos is NULL we are
- * now in a different buffer. */
+ // Set '[ and '] to the inserted text. When end_insert_pos is NULL we are
+ // now in a different buffer.
if (end_insert_pos != NULL)
{
curbuf->b_op_start = Insstart;
@@ -3144,7 +3144,7 @@ set_last_insert(int c)
if (last_insert != NULL)
{
s = last_insert;
- /* Use the CTRL-V only when entering a special char */
+ // Use the CTRL-V only when entering a special char
if (c < ' ' || c == DEL)
*s++ = Ctrl_V;
s = add_char2buf(c, s);
@@ -3178,7 +3178,7 @@ add_char2buf(int c, char_u *s)
for (i = 0; i < len; ++i)
{
c = temp[i];
- /* Need to escape K_SPECIAL and CSI like in the typeahead buffer. */
+ // Need to escape K_SPECIAL and CSI like in the typeahead buffer.
if (c == K_SPECIAL)
{
*s++ = K_SPECIAL;
@@ -3246,28 +3246,28 @@ oneright(void)
{
pos_T prevpos = curwin->w_cursor;
- /* Adjust for multi-wide char (excluding TAB) */
+ // Adjust for multi-wide char (excluding TAB)
ptr = ml_get_cursor();
coladvance(getviscol() + ((*ptr != TAB
&& vim_isprintc((*mb_ptr2char)(ptr)))
? ptr2cells(ptr) : 1));
curwin->w_set_curswant = TRUE;
- /* Return OK if the cursor moved, FAIL otherwise (at window edge). */
+ // Return OK if the cursor moved, FAIL otherwise (at window edge).
return (prevpos.col != curwin->w_cursor.col
|| prevpos.coladd != curwin->w_cursor.coladd) ? OK : FAIL;
}
ptr = ml_get_cursor();
if (*ptr == NUL)
- return FAIL; /* already at the very end */
+ return FAIL; // already at the very end
if (has_mbyte)
l = (*mb_ptr2len)(ptr);
else
l = 1;
- /* move "l" bytes right, but don't end up on the NUL, unless 'virtualedit'
- * contains "onemore". */
+ // move "l" bytes right, but don't end up on the NUL, unless 'virtualedit'
+ // contains "onemore".
if (ptr[l] == NUL && (ve_flags & VE_ONEMORE) == 0)
return FAIL;
curwin->w_cursor.col += l;
@@ -3290,14 +3290,14 @@ oneleft(void)
return FAIL;
#ifdef FEAT_LINEBREAK
- /* We might get stuck on 'showbreak', skip over it. */
+ // We might get stuck on 'showbreak', skip over it.
width = 1;
for (;;)
{
coladvance(v - width);
- /* getviscol() is slow, skip it when 'showbreak' is empty,
- * 'breakindent' is not set and there are no multi-byte
- * characters */
+ // getviscol() is slow, skip it when 'showbreak' is empty,
+ // 'breakindent' is not set and there are no multi-byte
+ // characters
if ((*get_showbreak_value(curwin) == NUL && !curwin->w_p_bri
&& !has_mbyte) || getviscol() < v)
break;
@@ -3311,7 +3311,7 @@ oneleft(void)
{
char_u *ptr;
- /* Adjust for multi-wide char (not a TAB) */
+ // Adjust for multi-wide char (not a TAB)
ptr = ml_get_cursor();
if (*ptr != TAB && vim_isprintc((*mb_ptr2char)(ptr))
&& ptr2cells(ptr) > 1)
@@ -3328,8 +3328,8 @@ oneleft(void)
curwin->w_set_curswant = TRUE;
--curwin->w_cursor.col;
- /* if the character on the left of the current cursor is a multi-byte
- * character, move to its first byte */
+ // if the character on the left of the current cursor is a multi-byte
+ // character, move to its first byte
if (has_mbyte)
mb_adjust_cursor();
return OK;
@@ -3338,15 +3338,15 @@ oneleft(void)
int
cursor_up(
long n,
- int upd_topline) /* When TRUE: update topline */
+ int upd_topline) // When TRUE: update topline
{
linenr_T lnum;
if (n > 0)
{
lnum = curwin->w_cursor.lnum;
- /* This fails if the cursor is already in the first line or the count
- * is larger than the line number and '-' is in 'cpoptions' */
+ // This fails if the cursor is already in the first line or the count
+ // is larger than the line number and '-' is in 'cpoptions'
if (lnum <= 1 || (n >= lnum && vim_strchr(p_cpo, CPO_MINUS) != NULL))
return FAIL;
if (n >= lnum)
@@ -3358,18 +3358,18 @@ cursor_up(
/*
* Count each sequence of folded lines as one logical line.
*/
- /* go to the start of the current fold */
+ // go to the start of the current fold
(void)hasFolding(lnum, &lnum, NULL);
while (n--)
{
- /* move up one line */
+ // move up one line
--lnum;
if (lnum <= 1)
break;
- /* If we entered a fold, move to the beginning, unless in
- * Insert mode or when 'foldopen' contains "all": it will open
- * in a moment. */
+ // If we entered a fold, move to the beginning, unless in
+ // Insert mode or when 'foldopen' contains "all": it will open
+ // in a moment.
if (n > 0 || !((State & INSERT) || (fdo_flags & FDO_ALL)))
(void)hasFolding(lnum, &lnum, NULL);
}
@@ -3382,11 +3382,11 @@ cursor_up(
curwin->w_cursor.lnum = lnum;
}
- /* try to advance to the column we want to be at */
+ // try to advance to the column we want to be at
coladvance(curwin->w_curswant);
if (upd_topline)
- update_topline(); /* make sure curwin->w_topline is valid */
+ update_topline(); // make sure curwin->w_topline is valid
return OK;
}
@@ -3397,7 +3397,7 @@ cursor_up(
int
cursor_down(
long n,
- int upd_topline) /* When TRUE: update topline */
+ int upd_topline) // When TRUE: update topline
{
linenr_T lnum;
@@ -3405,11 +3405,11 @@ cursor_down(
{
lnum = curwin->w_cursor.lnum;
#ifdef FEAT_FOLDING
- /* Move to last line of fold, will fail if it's the end-of-file. */
+ // Move to last line of fold, will fail if it's the end-of-file.
(void)hasFolding(lnum, NULL, &lnum);
#endif
- /* This fails if the cursor is already in the last line or would move
- * beyond the last line and '-' is in 'cpoptions' */
+ // This fails if the cursor is already in the last line or would move
+ // beyond the last line and '-' is in 'cpoptions'
if (lnum >= curbuf->b_ml.ml_line_count
|| (lnum + n > curbuf->b_ml.ml_line_count
&& vim_strchr(p_cpo, CPO_MINUS) != NULL))
@@ -3422,7 +3422,7 @@ cursor_down(
{
linenr_T last;
- /* count each sequence of folded lines as one logical line */
+ // count each sequence of folded lines as one logical line
while (n--)
{
if (hasFolding(lnum, NULL, &last))
@@ -3441,11 +3441,11 @@ cursor_down(
curwin->w_cursor.lnum = lnum;
}
- /* try to advance to the column we want to be at */
+ // try to advance to the column we want to be at
coladvance(curwin->w_curswant);
if (upd_topline)
- update_topline(); /* make sure curwin->w_topline is valid */
+ update_topline(); // make sure curwin->w_topline is valid
return OK;
}
@@ -3457,9 +3457,9 @@ cursor_down(
*/
int
stuff_inserted(
- int c, /* Command character to be inserted */
- long count, /* Repeat this many times */
- int no_esc) /* Don't add an ESC at the end */
+ int c, // Command character to be inserted
+ long count, // Repeat this many times
+ int no_esc) // Don't add an ESC at the end
{
char_u *esc_ptr;
char_u *ptr;
@@ -3473,16 +3473,15 @@ stuff_inserted(
return FAIL;
}
- /* may want to stuff the command character, to start Insert mode */
+ // may want to stuff the command character, to start Insert mode
if (c != NUL)
stuffcharReadbuff(c);
if ((esc_ptr = (char_u *)vim_strrchr(ptr, ESC)) != NULL)
- *esc_ptr = NUL; /* remove the ESC */
+ *esc_ptr = NUL; // remove the ESC
- /* when the last char is either "0" or "^" it will be quoted if no ESC
- * comes after it OR if it will inserted more than once and "ptr"
- * starts with ^D. -- Acevedo
- */
+ // when the last char is either "0" or "^" it will be quoted if no ESC
+ // comes after it OR if it will inserted more than once and "ptr"
+ // starts with ^D. -- Acevedo
last_ptr = (esc_ptr ? esc_ptr : ptr + STRLEN(ptr)) - 1;
if (last_ptr >= ptr && (*last_ptr == '0' || *last_ptr == '^')
&& (no_esc || (*ptr == Ctrl_D && count > 1)))
@@ -3494,7 +3493,7 @@ stuff_inserted(
do
{
stuffReadbuff(ptr);
- /* a trailing "0" is inserted as "<C-V>048", "^" as "<C-V>^" */
+ // a trailing "0" is inserted as "<C-V>048", "^" as "<C-V>^"
if (last)
stuffReadbuff((char_u *)(last == '0'
? IF_EB("\026\060\064\070", CTRL_V_STR "xf0")
@@ -3506,9 +3505,9 @@ stuff_inserted(
*last_ptr = last;
if (esc_ptr != NULL)
- *esc_ptr = ESC; /* put the ESC back */
+ *esc_ptr = ESC; // put the ESC back
- /* may want to stuff a trailing ESC, to get out of Insert mode */
+ // may want to stuff a trailing ESC, to get out of Insert mode
if (!no_esc)
stuffcharReadbuff(ESC);
@@ -3539,7 +3538,7 @@ get_last_insert_save(void)
if (s != NULL)
{
len = (int)STRLEN(s);
- if (len > 0 && s[len - 1] == ESC) /* remove trailing ESC */
+ if (len > 0 && s[len - 1] == ESC) // remove trailing ESC
s[len - 1] = NUL;
}
return s;
@@ -3554,8 +3553,8 @@ get_last_insert_save(void)
static int
echeck_abbr(int c)
{
- /* Don't check for abbreviation in paste mode, when disabled and just
- * after moving around with cursor keys. */
+ // Don't check for abbreviation in paste mode, when disabled and just
+ // after moving around with cursor keys.
if (p_paste || no_abbr || arrow_used)
return FALSE;
@@ -3583,22 +3582,22 @@ echeck_abbr(int c)
*/
static char_u *replace_stack = NULL;
-static long replace_stack_nr = 0; /* next entry in replace stack */
-static long replace_stack_len = 0; /* max. number of entries */
+static long replace_stack_nr = 0; // next entry in replace stack
+static long replace_stack_len = 0; // max. number of entries
void
replace_push(
- int c) /* character that is replaced (NUL is none) */
+ int c) // character that is replaced (NUL is none)
{
char_u *p;
- if (replace_stack_nr < replace_offset) /* nothing to do */
+ if (replace_stack_nr < replace_offset) // nothing to do
return;
if (replace_stack_len <= replace_stack_nr)
{
replace_stack_len += 50;
p = ALLOC_MULT(char_u, replace_stack_len);
- if (p == NULL) /* out of memory */
+ if (p == NULL) // out of memory
{
replace_stack_len -= 50;
return;
@@ -3653,7 +3652,7 @@ replace_pop(void)
*/
void
replace_join(
- int off) /* offset for which NUL to remove */
+ int off) // offset for which NUL to remove
{
int i;
@@ -3677,7 +3676,7 @@ replace_pop_ins(void)
int cc;
int oldState = State;
- State = NORMAL; /* don't want REPLACE here */
+ State = NORMAL; // don't want REPLACE here
while ((cc = replace_pop()) > 0)
{
mb_replace_pop_ins(cc);
@@ -3709,15 +3708,15 @@ mb_replace_pop_ins(int cc)
ins_char(cc);
if (enc_utf8)
- /* Handle composing chars. */
+ // Handle composing chars.
for (;;)
{
c = replace_pop();
- if (c == -1) /* stack empty */
+ if (c == -1) // stack empty
break;
if ((n = MB_BYTE2LEN(c)) == 1)
{
- /* Not a multi-byte char, put it back. */
+ // Not a multi-byte char, put it back.
replace_push(c);
break;
}
@@ -3730,7 +3729,7 @@ mb_replace_pop_ins(int cc)
ins_bytes_len(buf, n);
else
{
- /* Not a composing char, put it back. */
+ // Not a composing char, put it back.
for (i = n - 1; i >= 0; --i)
replace_push(buf[i]);
break;
@@ -3788,8 +3787,8 @@ replace_do_bs(int limit_col)
#endif
if (State & VREPLACE_FLAG)
{
- /* Get the number of screen cells used by the character we are
- * going to delete. */
+ // Get the number of screen cells used by the character we are
+ // going to delete.
getvcol(curwin, &curwin->w_cursor, NULL, &start_vcol, NULL);
orig_vcols = chartabsize(ml_get_cursor(), start_vcol);
}
@@ -3810,7 +3809,7 @@ replace_do_bs(int limit_col)
if (State & VREPLACE_FLAG)
{
- /* Get the number of screen cells used by the inserted characters */
+ // Get the number of screen cells used by the inserted characters
p = ml_get_cursor();
ins_len = (int)STRLEN(p) - orig_len;
vcol = start_vcol;
@@ -3821,8 +3820,8 @@ replace_do_bs(int limit_col)
}
vcol -= start_vcol;
- /* Delete spaces that were inserted after the cursor to keep the
- * text aligned. */
+ // Delete spaces that were inserted after the cursor to keep the
+ // text aligned.
curwin->w_cursor.col += ins_len;
while (vcol > orig_vcols && gchar_cursor() == ' ')
{
@@ -3857,7 +3856,7 @@ replace_do_bs(int limit_col)
int
hkmap(int c)
{
- if (p_hkmapp) /* phonetic mapping, by Ilya Dogolazky */
+ if (p_hkmapp) // phonetic mapping, by Ilya Dogolazky
{
enum {hALEF=0, BET, GIMEL, DALET, HEI, VAV, ZAIN, HET, TET, IUD,
KAFsofit, hKAF, LAMED, MEMsofit, MEM, NUNsofit, NUN, SAMEH, AIN,
@@ -3875,25 +3874,24 @@ hkmap(int c)
if (c == 'N' || c == 'M' || c == 'P' || c == 'C' || c == 'Z')
return (int)(map[CharOrd(c)] - 1 + p_aleph);
- /* '-1'='sofit' */
+ // '-1'='sofit'
else if (c == 'x')
return 'X';
else if (c == 'q')
- return '\''; /* {geresh}={'} */
+ return '\''; // {geresh}={'}
else if (c == 246)
- return ' '; /* \"o --> ' ' for a german keyboard */
+ return ' '; // \"o --> ' ' for a german keyboard
else if (c == 228)
- return ' '; /* \"a --> ' ' -- / -- */
+ return ' '; // \"a --> ' ' -- / --
else if (c == 252)
- return ' '; /* \"u --> ' ' -- / -- */
+ return ' '; // \"u --> ' ' -- / --
#ifdef EBCDIC
else if (islower(c))
#else
- /* NOTE: islower() does not do the right thing for us on Linux so we
- * do this the same was as 5.7 and previous, so it works correctly on
- * all systems. Specifically, the e.g. Delete and Arrow keys are
- * munged and won't work if e.g. searching for Hebrew text.
- */
+ // NOTE: islower() does not do the right thing for us on Linux so we
+ // do this the same was as 5.7 and previous, so it works correctly on
+ // all systems. Specifically, the e.g. Delete and Arrow keys are
+ // munged and won't work if e.g. searching for Hebrew text.
else if (c >= 'a' && c <= 'z')
#endif
return (int)(map[CharOrdLow(c)] + p_aleph);
@@ -3910,7 +3908,7 @@ hkmap(int c)
case 'q': return '/';
case 'w': return '\'';
- /* Hebrew letters - set offset from 'a' */
+ // Hebrew letters - set offset from 'a'
case ',': c = '{'; break;
case '.': c = 'v'; break;
case ';': c = 't'; break;
@@ -3918,7 +3916,7 @@ hkmap(int c)
static char str[] = "zqbcxlsjphmkwonu ydafe rig";
#ifdef EBCDIC
- /* see note about islower() above */
+ // see note about islower() above
if (!islower(c))
#else
if (c < 'a' || c > 'z')
@@ -3948,7 +3946,7 @@ ins_reg(void)
pc_status = PC_STATUS_UNSET;
if (redrawing() && !char_avail())
{
- /* may need to redraw when no more chars available now */
+ // may need to redraw when no more chars available now
ins_redraw(FALSE);
edit_putchar('"', TRUE);
@@ -3958,7 +3956,7 @@ ins_reg(void)
}
#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
+ dont_scroll = TRUE; // disallow scrolling here
#endif
/*
@@ -3971,7 +3969,7 @@ ins_reg(void)
LANGMAP_ADJUST(regname, TRUE);
if (regname == Ctrl_R || regname == Ctrl_O || regname == Ctrl_P)
{
- /* Get a third key for literal register insertion */
+ // Get a third key for literal register insertion
literally = regname;
#ifdef FEAT_CMDL_INFO
add_to_showcmd_c(literally);
@@ -3983,8 +3981,8 @@ ins_reg(void)
--allow_keys;
#ifdef FEAT_EVAL
- /* Don't call u_sync() while typing the expression or giving an error
- * message for it. Only call it explicitly. */
+ // Don't call u_sync() while typing the expression or giving an error
+ // message for it. Only call it explicitly.
++no_u_sync;
if (regname == '=')
{
@@ -3992,8 +3990,8 @@ ins_reg(void)
# ifdef HAVE_INPUT_METHOD
int im_on = im_get_status();
# endif
- /* Sync undo when evaluating the expression calls setline() or
- * append(), so that it can be undone separately. */
+ // Sync undo when evaluating the expression calls setline() or
+ // append(), so that it can be undone separately.
u_sync_once = 2;
regname = get_expr_register();
@@ -4010,14 +4008,14 @@ ins_reg(void)
if (regname == NUL || !valid_yank_reg(regname, FALSE))
{
vim_beep(BO_REG);
- need_redraw = TRUE; /* remove the '"' */
+ need_redraw = TRUE; // remove the '"'
}
else
{
#endif
if (literally == Ctrl_O || literally == Ctrl_P)
{
- /* Append the command to the redo buffer. */
+ // Append the command to the redo buffer.
AppendCharToRedobuff(Ctrl_R);
AppendCharToRedobuff(literally);
AppendCharToRedobuff(regname);
@@ -4028,12 +4026,12 @@ ins_reg(void)
else if (insert_reg(regname, literally) == FAIL)
{
vim_beep(BO_REG);
- need_redraw = TRUE; /* remove the '"' */
+ need_redraw = TRUE; // remove the '"'
}
else if (stop_insert_mode)
- /* When the '=' register was used and a function was invoked that
- * did ":stopinsert" then stuff_empty() returns FALSE but we won't
- * insert anything, need to remove the '"' */
+ // When the '=' register was used and a function was invoked that
+ // did ":stopinsert" then stuff_empty() returns FALSE but we won't
+ // insert anything, need to remove the '"'
need_redraw = TRUE;
#ifdef FEAT_EVAL
@@ -4047,11 +4045,11 @@ ins_reg(void)
clear_showcmd();
#endif
- /* If the inserted register is empty, we need to remove the '"' */
+ // If the inserted register is empty, we need to remove the '"'
if (need_redraw || stuff_empty())
edit_unputchar();
- /* Disallow starting Visual mode here, would get a weird mode. */
+ // Disallow starting Visual mode here, would get a weird mode.
if (!vis_active && VIsual_active)
end_visual_mode();
}
@@ -4078,36 +4076,36 @@ ins_ctrl_g(void)
--allow_keys;
switch (c)
{
- /* CTRL-G k and CTRL-G <Up>: cursor up to Insstart.col */
+ // CTRL-G k and CTRL-G <Up>: cursor up to Insstart.col
case K_UP:
case Ctrl_K:
case 'k': ins_up(TRUE);
break;
- /* CTRL-G j and CTRL-G <Down>: cursor down to Insstart.col */
+ // CTRL-G j and CTRL-G <Down>: cursor down to Insstart.col
case K_DOWN:
case Ctrl_J:
case 'j': ins_down(TRUE);
break;
- /* CTRL-G u: start new undoable edit */
+ // CTRL-G u: start new undoable edit
case 'u': u_sync(TRUE);
ins_need_undo = TRUE;
- /* Need to reset Insstart, esp. because a BS that joins
- * a line to the previous one must save for undo. */
+ // Need to reset Insstart, esp. because a BS that joins
+ // a line to the previous one must save for undo.
update_Insstart_orig = FALSE;
Insstart = curwin->w_cursor;
break;
- /* CTRL-G U: do not break undo with the next char */
+ // CTRL-G U: do not break undo with the next char
case 'U':
- /* Allow one left/right cursor movement with the next char,
- * without breaking undo. */
+ // Allow one left/right cursor movement with the next char,
+ // without breaking undo.
dont_sync_undo = MAYBE;
break;
- /* Unknown CTRL-G command, reserved for future expansion. */
+ // Unknown CTRL-G command, reserved for future expansion.
default: vim_beep(BO_CTRLG);
}
}
@@ -4120,7 +4118,7 @@ ins_ctrl_hat(void)
{
if (map_to_exists_mode((char_u *)"", LANGMAP, FALSE))
{
- /* ":lmap" mappings exists, Toggle use of ":lmap" mappings. */
+ // ":lmap" mappings exists, Toggle use of ":lmap" mappings.
if (State & LANGMAP)
{
curbuf->b_p_iminsert = B_IMODE_NONE;
@@ -4138,7 +4136,7 @@ ins_ctrl_hat(void)
#ifdef HAVE_INPUT_METHOD
else
{
- /* There are no ":lmap" mappings, toggle IM */
+ // There are no ":lmap" mappings, toggle IM
if (im_get_status())
{
curbuf->b_p_iminsert = B_IMODE_NONE;
@@ -4155,12 +4153,12 @@ ins_ctrl_hat(void)
set_iminsert_global();
showmode();
#ifdef FEAT_GUI
- /* may show different cursor shape or color */
+ // may show different cursor shape or color
if (gui.in_use)
gui_update_cursor(TRUE, FALSE);
#endif
#if defined(FEAT_KEYMAP)
- /* Show/unshow value of 'keymap' in status lines. */
+ // Show/unshow value of 'keymap' in status lines.
status_redraw_curbuf();
#endif
}
@@ -4174,7 +4172,7 @@ ins_ctrl_hat(void)
ins_esc(
long *count,
int cmdchar,
- int nomove) /* don't move cursor */
+ int nomove) // don't move cursor
{
int temp;
static int disabled_redraw = FALSE;
@@ -4210,29 +4208,29 @@ ins_esc(
*count = 0;
}
- if (--*count > 0) /* repeat what was typed */
+ if (--*count > 0) // repeat what was typed
{
- /* Vi repeats the insert without replacing characters. */
+ // Vi repeats the insert without replacing characters.
if (vim_strchr(p_cpo, CPO_REPLCNT) != NULL)
State &= ~REPLACE_FLAG;
(void)start_redo_ins();
if (cmdchar == 'r' || cmdchar == 'v')
- stuffRedoReadbuff(ESC_STR); /* no ESC in redo buffer */
+ stuffRedoReadbuff(ESC_STR); // no ESC in redo buffer
++RedrawingDisabled;
disabled_redraw = TRUE;
- return FALSE; /* repeat the insert */
+ return FALSE; // repeat the insert
}
stop_insert(&curwin->w_cursor, TRUE, nomove);
undisplay_dollar();
}
- /* When an autoindent was removed, curswant stays after the
- * indent */
+ // When an autoindent was removed, curswant stays after the
+ // indent
if (restart_edit == NUL && (colnr_T)temp == curwin->w_cursor.col)
curwin->w_set_curswant = TRUE;
- /* Remember the last Insert position in the '^ mark. */
+ // Remember the last Insert position in the '^ mark.
if (!cmdmod.keepjumps)
curbuf->b_last_insert = curwin->w_cursor;
@@ -4259,23 +4257,23 @@ ins_esc(
else
{
--curwin->w_cursor.col;
- /* Correct cursor for multi-byte character. */
+ // Correct cursor for multi-byte character.
if (has_mbyte)
mb_adjust_cursor();
}
}
#ifdef HAVE_INPUT_METHOD
- /* Disable IM to allow typing English directly for Normal mode commands.
- * When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as
- * well). */
+ // Disable IM to allow typing English directly for Normal mode commands.
+ // When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as
+ // well).
if (!(State & LANGMAP))
im_save_status(&curbuf->b_p_iminsert);
im_set_active(FALSE);
#endif
State = NORMAL;
- /* need to position cursor again (e.g. when on a TAB ) */
+ // need to position cursor again (e.g. when on a TAB )
changed_cline_bef_curs();
setmouse();
@@ -4356,18 +4354,18 @@ ins_start_select(int c)
# endif
if (!(mod_mask & MOD_MASK_SHIFT))
break;
- /* FALLTHROUGH */
+ // FALLTHROUGH
case K_S_LEFT:
case K_S_RIGHT:
case K_S_UP:
case K_S_DOWN:
case K_S_END:
case K_S_HOME:
- /* Start selection right away, the cursor can move with
- * CTRL-O when beyond the end of the line. */
+ // Start selection right away, the cursor can move with
+ // CTRL-O when beyond the end of the line.
start_selection();
- /* Execute the key in (insert) Select mode. */
+ // Execute the key in (insert) Select mode.
stuffcharReadbuff(Ctrl_O);
if (mod_mask)
{
@@ -4405,7 +4403,7 @@ ins_insert(int replaceState)
AppendCharToRedobuff(K_INS);
showmode();
#ifdef CURSOR_SHAPE
- ui_cursor_shape(); /* may show different cursor shape */
+ ui_cursor_shape(); // may show different cursor shape
#endif
}
@@ -4423,7 +4421,7 @@ ins_ctrl_o(void)
else
restart_edit = 'I';
if (virtual_active())
- ins_at_eol = FALSE; /* cursor always keeps its column */
+ ins_at_eol = FALSE; // cursor always keeps its column
else
ins_at_eol = (gchar_cursor() == NUL);
}
@@ -4449,12 +4447,12 @@ ins_shift(int c, int lastc)
&& curwin->w_cursor.col > 0)
{
--curwin->w_cursor.col;
- (void)del_char(FALSE); /* delete the '^' or '0' */
- /* In Replace mode, restore the characters that '^' or '0' replaced. */
+ (void)del_char(FALSE); // delete the '^' or '0'
+ // In Replace mode, restore the characters that '^' or '0' replaced.
if (State & REPLACE_FLAG)
replace_pop_ins();
if (lastc == '^')
- old_indent = get_indent(); /* remember curr. indent */
+ old_indent = get_indent(); // remember curr. indent
change_indent(INDENT_SET, 0, TRUE, 0, TRUE);
}
else
@@ -4468,7 +4466,7 @@ ins_shift(int c, int lastc)
can_si_back = FALSE;
#endif
#ifdef FEAT_CINDENT
- can_cindent = FALSE; /* no cindenting after ^D or ^T */
+ can_cindent = FALSE; // no cindenting after ^D or ^T
#endif
}
@@ -4479,24 +4477,24 @@ ins_del(void)
if (stop_arrow() == FAIL)
return;
- if (gchar_cursor() == NUL) /* delete newline */
+ if (gchar_cursor() == NUL) // delete newline
{
temp = curwin->w_cursor.col;
- if (!can_bs(BS_EOL) /* only if "eol" included */
+ if (!can_bs(BS_EOL) // only if "eol" included
|| do_join(2, FALSE, TRUE, FALSE, FALSE) == FAIL)
vim_beep(BO_BS);
else
{
curwin->w_cursor.col = temp;
- /* Adjust orig_line_count in case more lines have been deleted than
- * have been added. That makes sure, that open_line() later
- * can access all buffer lines correctly */
+ // Adjust orig_line_count in case more lines have been deleted than
+ // have been added. That makes sure, that open_line() later
+ // can access all buffer lines correctly
if (State & VREPLACE_FLAG &&
orig_line_count > curbuf->b_ml.ml_line_count)
orig_line_count = curbuf->b_ml.ml_line_count;
}
}
- else if (del_char(FALSE) == FAIL) /* delete char under cursor */
+ else if (del_char(FALSE) == FAIL) // delete char under cursor
vim_beep(BO_BS);
did_ai = FALSE;
#ifdef FEAT_SMARTINDENT
@@ -4517,8 +4515,8 @@ ins_bs_one(colnr_T *vcolp)
getvcol(curwin, &curwin->w_cursor, vcolp, NULL, NULL);
if (State & REPLACE_FLAG)
{
- /* Don't delete characters before the insert point when in
- * Replace mode */
+ // Don't delete characters before the insert point when in
+ // Replace mode
if (curwin->w_cursor.lnum != Insstart.lnum
|| curwin->w_cursor.col >= Insstart.col)
replace_do_bs(-1);
@@ -4539,13 +4537,13 @@ ins_bs(
{
linenr_T lnum;
int cc;
- int temp = 0; /* init for GCC */
+ int temp = 0; // init for GCC
colnr_T save_col;
colnr_T mincol;
int did_backspace = FALSE;
int in_indent;
int oldState;
- int cpc[MAX_MCO]; /* composing characters */
+ int cpc[MAX_MCO]; // composing characters
/*
* can't delete anything in an empty file
@@ -4578,17 +4576,16 @@ ins_bs(
if (in_indent)
can_cindent = FALSE;
#endif
- end_comment_pending = NUL; /* After BS, don't auto-end comment */
+ end_comment_pending = NUL; // After BS, don't auto-end comment
#ifdef FEAT_RIGHTLEFT
- if (revins_on) /* put cursor after last inserted char */
+ if (revins_on) // put cursor after last inserted char
inc_cursor();
#endif
- /* Virtualedit:
- * BACKSPACE_CHAR eats a virtual space
- * BACKSPACE_WORD eats all coladd
- * BACKSPACE_LINE eats all coladd and keeps going
- */
+ // Virtualedit:
+ // BACKSPACE_CHAR eats a virtual space
+ // BACKSPACE_WORD eats all coladd
+ // BACKSPACE_LINE eats all coladd and keeps going
if (curwin->w_cursor.coladd > 0)
{
if (mode == BACKSPACE_CHAR)
@@ -4629,7 +4626,7 @@ ins_bs(
*/
cc = -1;
if (State & REPLACE_FLAG)
- cc = replace_pop(); /* returns -1 if NL was inserted */
+ cc = replace_pop(); // returns -1 if NL was inserted
/*
* In replace mode, in the line we started replacing, we only move the
* cursor.
@@ -4643,12 +4640,12 @@ ins_bs(
if (!(State & VREPLACE_FLAG)
|| curwin->w_cursor.lnum > orig_line_count)
{
- temp = gchar_cursor(); /* remember current char */
+ temp = gchar_cursor(); // remember current char
--curwin->w_cursor.lnum;
- /* When "aw" is in 'formatoptions' we must delete the space at
- * the end of the line, otherwise the line will be broken
- * again when auto-formatting. */
+ // When "aw" is in 'formatoptions' we must delete the space at
+ // the end of the line, otherwise the line will be broken
+ // again when auto-formatting.
if (has_format_option(FO_AUTO)
&& has_format_option(FO_WHITE_PAR))
{
@@ -4693,7 +4690,7 @@ ins_bs(
curwin->w_cursor.col = save_col;
cc = replace_pop();
}
- /* restore the characters that NL replaced */
+ // restore the characters that NL replaced
replace_pop_ins();
State = oldState;
}
@@ -4706,11 +4703,11 @@ ins_bs(
* Delete character(s) before the cursor.
*/
#ifdef FEAT_RIGHTLEFT
- if (revins_on) /* put cursor on last inserted char */
+ if (revins_on) // put cursor on last inserted char
dec_cursor();
#endif
mincol = 0;
- /* keep indent */
+ // keep indent
if (mode == BACKSPACE_LINE
&& (curbuf->b_p_ai
#ifdef FEAT_CINDENT
@@ -4751,9 +4748,9 @@ ins_bs(
colnr_T start_vcol;
*inserted_space_p = FALSE;
- /* Compute the virtual column where we want to be. Since
- * 'showbreak' may get in the way, need to get the last column of
- * the previous character. */
+ // Compute the virtual column where we want to be. Since
+ // 'showbreak' may get in the way, need to get the last column of
+ // the previous character.
getvcol(curwin, &curwin->w_cursor, &vcol, NULL, NULL);
start_vcol = vcol;
dec_cursor();
@@ -4776,15 +4773,15 @@ ins_bs(
want_vcol = (want_vcol / ts) * ts;
#endif
- /* delete characters until we are at or before want_vcol */
+ // delete characters until we are at or before want_vcol
while (vcol > want_vcol
&& (cc = *(ml_get_cursor() - 1), VIM_ISWHITE(cc)))
ins_bs_one(&vcol);
- /* insert extra spaces until we are at want_vcol */
+ // insert extra spaces until we are at want_vcol
while (vcol < want_vcol)
{
- /* Remember the first char we inserted */
+ // Remember the first char we inserted
if (curwin->w_cursor.lnum == Insstart_orig.lnum
&& curwin->w_cursor.col < Insstart_orig.col)
Insstart_orig.col = curwin->w_cursor.col;
@@ -4800,8 +4797,8 @@ ins_bs(
getvcol(curwin, &curwin->w_cursor, &vcol, NULL, NULL);
}
- /* If we are now back where we started delete one character. Can
- * happen when using 'sts' and 'linebreak'. */
+ // If we are now back where we started delete one character. Can
+ // happen when using 'sts' and 'linebreak'.
if (vcol >= start_vcol)
ins_bs_one(&vcol);
}
@@ -4818,25 +4815,25 @@ ins_bs(
do
{
#ifdef FEAT_RIGHTLEFT
- if (!revins_on) /* put cursor on char to be deleted */
+ if (!revins_on) // put cursor on char to be deleted
#endif
dec_cursor();
cc = gchar_cursor();
- /* look multi-byte character class */
+ // look multi-byte character class
if (has_mbyte)
{
prev_cclass = cclass;
cclass = mb_get_class(ml_get_cursor());
}
- /* start of word? */
+ // start of word?
if (mode == BACKSPACE_WORD && !vim_isspace(cc))
{
mode = BACKSPACE_WORD_NOT_SPACE;
temp = vim_iswordc(cc);
}
- /* end of word? */
+ // end of word?
else if (mode == BACKSPACE_WORD_NOT_SPACE
&& ((vim_isspace(cc) || vim_iswordc(cc) != temp)
|| prev_cclass != cclass))
@@ -4875,7 +4872,7 @@ ins_bs(
break;
#endif
}
- /* Just a single backspace?: */
+ // Just a single backspace?:
if (mode == BACKSPACE_CHAR)
break;
} while (
@@ -4902,25 +4899,25 @@ ins_bs(
*/
AppendCharToRedobuff(c);
- /* If deleted before the insertion point, adjust it */
+ // If deleted before the insertion point, adjust it
if (curwin->w_cursor.lnum == Insstart_orig.lnum
&& curwin->w_cursor.col < Insstart_orig.col)
Insstart_orig.col = curwin->w_cursor.col;
- /* vi behaviour: the cursor moves backward but the character that
- * was there remains visible
- * Vim behaviour: the cursor moves backward and the character that
- * was there is erased from the screen.
- * We can emulate the vi behaviour by pretending there is a dollar
- * displayed even when there isn't.
- * --pkv Sun Jan 19 01:56:40 EST 2003 */
+ // vi behaviour: the cursor moves backward but the character that
+ // was there remains visible
+ // Vim behaviour: the cursor moves backward and the character that
+ // was there is erased from the screen.
+ // We can emulate the vi behaviour by pretending there is a dollar
+ // displayed even when there isn't.
+ // --pkv Sun Jan 19 01:56:40 EST 2003
if (vim_strchr(p_cpo, CPO_BACKSPACE) != NULL && dollar_vcol == -1)
dollar_vcol = curwin->w_virtcol;
#ifdef FEAT_FOLDING
- /* When deleting a char the cursor line must never be in a closed fold.
- * E.g., when 'foldmethod' is indent and deleting the first non-white
- * char before a Tab. */
+ // When deleting a char the cursor line must never be in a closed fold.
+ // E.g., when 'foldmethod' is indent and deleting the first non-white
+ // char before a Tab.
if (did_backspace)
foldOpenCursor();
#endif
@@ -4944,7 +4941,7 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
int save_allow_keys = allow_keys;
int save_paste = p_paste;
- /* If the end code is too long we can't detect it, read everything. */
+ // If the end code is too long we can't detect it, read everything.
if (STRLEN(end) >= NUMBUFLEN)
end = NULL;
++no_mapping;
@@ -4975,7 +4972,7 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
if (end != NULL && STRNCMP(buf, end, idx) == 0)
{
if (end[idx] == NUL)
- break; /* Found the end of paste code. */
+ break; // Found the end of paste code.
continue;
}
if (!drop)
@@ -5035,7 +5032,7 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
static void
ins_tabline(int c)
{
- /* We will be leaving the current window, unless closing another tab. */
+ // We will be leaving the current window, unless closing another tab.
if (c != K_TABMENU || current_tabmenu != TABLINE_MENU_CLOSE
|| (current_tab != 0 && current_tab != tabpage_index(curtab)))
{
@@ -5051,7 +5048,7 @@ ins_tabline(int c)
else
{
handle_tabmenu();
- redraw_statuslines(); /* will redraw the tabline when needed */
+ redraw_statuslines(); // will redraw the tabline when needed
}
}
#endif
@@ -5105,8 +5102,8 @@ ins_left(void)
if (oneleft() == OK)
{
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
- /* Only call start_arrow() when not busy with preediting, it will
- * break undo. K_LEFT is inserted in im_correct_cursor(). */
+ // Only call start_arrow() when not busy with preediting, it will
+ // break undo. K_LEFT is inserted in im_correct_cursor().
if (p_imst == IM_OVER_THE_SPOT || !im_is_preediting())
#endif
{
@@ -5115,7 +5112,7 @@ ins_left(void)
AppendCharToRedobuff(K_LEFT);
}
#ifdef FEAT_RIGHTLEFT
- /* If exit reversed string, position is fixed */
+ // If exit reversed string, position is fixed
if (revins_scol != -1 && (int)curwin->w_cursor.col >= revins_scol)
revins_legal++;
revins_chars++;
@@ -5128,11 +5125,11 @@ ins_left(void)
*/
else if (vim_strchr(p_ww, '[') != NULL && curwin->w_cursor.lnum > 1)
{
- /* always break undo when moving upwards/downwards, else undo may break */
+ // always break undo when moving upwards/downwards, else undo may break
start_arrow(&tpos);
--(curwin->w_cursor.lnum);
coladvance((colnr_T)MAXCOL);
- curwin->w_set_curswant = TRUE; /* so we stay at the end */
+ curwin->w_set_curswant = TRUE; // so we stay at the end
}
else
vim_beep(BO_CRSR);
@@ -5231,8 +5228,8 @@ ins_right(void)
revins_chars--;
#endif
}
- /* if 'whichwrap' set for cursor in insert mode, may move the
- * cursor to the next line */
+ // if 'whichwrap' set for cursor in insert mode, may move the
+ // cursor to the next line
else if (vim_strchr(p_ww, ']') != NULL
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
{
@@ -5271,7 +5268,7 @@ ins_s_right()
static void
ins_up(
- int startcol) /* when TRUE move to Insstart.col */
+ int startcol) // when TRUE move to Insstart.col
{
pos_T tpos;
linenr_T old_topline = curwin->w_topline;
@@ -5309,7 +5306,7 @@ ins_pageup(void)
if (mod_mask & MOD_MASK_CTRL)
{
- /* <C-PageUp>: tab page back */
+ // <C-PageUp>: tab page back
if (first_tabpage->tp_next != NULL)
{
start_arrow(&curwin->w_cursor);
@@ -5332,7 +5329,7 @@ ins_pageup(void)
static void
ins_down(
- int startcol) /* when TRUE move to Insstart.col */
+ int startcol) // when TRUE move to Insstart.col
{
pos_T tpos;
linenr_T old_topline = curwin->w_topline;
@@ -5370,7 +5367,7 @@ ins_pagedown(void)
if (mod_mask & MOD_MASK_CTRL)
{
- /* <C-PageDown>: tab page forward */
+ // <C-PageDown>: tab page forward
if (first_tabpage->tp_next != NULL)
{
start_arrow(&curwin->w_cursor);
@@ -5427,7 +5424,7 @@ ins_tab(void)
if (!curbuf->b_p_et
#ifdef FEAT_VARTABS
&& !(p_sta && ind
- /* These five lines mean 'tabstop' != 'shiftwidth' */
+ // These five lines mean 'tabstop' != 'shiftwidth'
&& ((tabstop_count(curbuf->b_p_vts_array) > 1)
|| (tabstop_count(curbuf->b_p_vts_array) == 1
&& tabstop_first(curbuf->b_p_vts_array)
@@ -5453,24 +5450,24 @@ ins_tab(void)
AppendToRedobuff((char_u *)"\t");
#ifdef FEAT_VARTABS
- if (p_sta && ind) /* insert tab in indent, use 'shiftwidth' */
+ if (p_sta && ind) // insert tab in indent, use 'shiftwidth'
{
temp = (int)get_sw_value(curbuf);
temp -= get_nolist_virtcol() % temp;
}
else if (tabstop_count(curbuf->b_p_vsts_array) > 0 || curbuf->b_p_sts != 0)
- /* use 'softtabstop' when set */
+ // use 'softtabstop' when set
temp = tabstop_padding(get_nolist_virtcol(), get_sts_value(),
curbuf->b_p_vsts_array);
- else /* otherwise use 'tabstop' */
+ else // otherwise use 'tabstop'
temp = tabstop_padding(get_nolist_virtcol(), curbuf->b_p_ts,
curbuf->b_p_vts_array);
#else
- if (p_sta && ind) /* insert tab in indent, use 'shiftwidth' */
+ if (p_sta && ind) // insert tab in indent, use 'shiftwidth'
temp = (int)get_sw_value(curbuf);
- else if (curbuf->b_p_sts != 0) /* use 'softtabstop' when set */
+ else if (curbuf->b_p_sts != 0) // use 'softtabstop' when set
temp = (int)get_sts_value();
- else /* otherwise use 'tabstop' */
+ else // otherwise use 'tabstop'
temp = (int)curbuf->b_p_ts;
temp -= get_nolist_virtcol() % temp;
#endif
@@ -5488,7 +5485,7 @@ ins_tab(void)
else
{
ins_str((char_u *)" ");
- if (State & REPLACE_FLAG) /* no char replaced */
+ if (State & REPLACE_FLAG) // no char replaced
replace_push(NUL);
}
}
@@ -5505,7 +5502,7 @@ ins_tab(void)
#endif
{
char_u *ptr;
- char_u *saved_line = NULL; /* init for GCC */
+ char_u *saved_line = NULL; // init for GCC
pos_T pos;
pos_T fpos;
pos_T *cursor;
@@ -5532,11 +5529,11 @@ ins_tab(void)
cursor = &curwin->w_cursor;
}
- /* When 'L' is not in 'cpoptions' a tab always takes up 'ts' spaces. */
+ // When 'L' is not in 'cpoptions' a tab always takes up 'ts' spaces.
if (vim_strchr(p_cpo, CPO_LISTWM) == NULL)
curwin->w_p_list = FALSE;
- /* Find first white before the cursor */
+ // Find first white before the cursor
fpos = curwin->w_cursor;
while (fpos.col > 0 && VIM_ISWHITE(ptr[-1]))
{
@@ -5544,7 +5541,7 @@ ins_tab(void)
--ptr;
}
- /* In Replace mode, don't change characters before the insert point. */
+ // In Replace mode, don't change characters before the insert point.
if ((State & REPLACE_FLAG)
&& fpos.lnum == Insstart.lnum
&& fpos.col < Insstart.col)
@@ -5553,12 +5550,12 @@ ins_tab(void)
fpos.col = Insstart.col;
}
- /* compute virtual column numbers of first white and cursor */
+ // compute virtual column numbers of first white and cursor
getvcol(curwin, &fpos, &vcol, NULL, NULL);
getvcol(curwin, cursor, &want_vcol, NULL, NULL);
- /* Use as many TABs as possible. Beware of 'breakindent', 'showbreak'
- * and 'linebreak' adding extra virtual columns. */
+ // Use as many TABs as possible. Beware of 'breakindent', 'showbreak'
+ // and 'linebreak' adding extra virtual columns.
while (VIM_ISWHITE(*ptr))
{
i = lbr_chartabsize(NULL, (char_u *)"\t", vcol);
@@ -5569,8 +5566,8 @@ ins_tab(void)
*ptr = TAB;
if (change_col < 0)
{
- change_col = fpos.col; /* Column of first change */
- /* May have to adjust Insstart */
+ change_col = fpos.col; // Column of first change
+ // May have to adjust Insstart
if (fpos.lnum == Insstart.lnum && fpos.col < Insstart.col)
Insstart.col = fpos.col;
}
@@ -5585,7 +5582,7 @@ ins_tab(void)
int repl_off = 0;
char_u *line = ptr;
- /* Skip over the spaces we need. */
+ // Skip over the spaces we need.
while (vcol < want_vcol && *ptr == ' ')
{
vcol += lbr_chartabsize(line, ptr, vcol);
@@ -5594,18 +5591,18 @@ ins_tab(void)
}
if (vcol > want_vcol)
{
- /* Must have a char with 'showbreak' just before it. */
+ // Must have a char with 'showbreak' just before it.
--ptr;
--repl_off;
}
fpos.col += repl_off;
- /* Delete following spaces. */
+ // Delete following spaces.
i = cursor->col - fpos.col;
if (i > 0)
{
STRMOVE(ptr, ptr + i);
- /* correct replace stack. */
+ // correct replace stack.
if ((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG))
for (temp = i; --temp >= 0; )
replace_join(repl_off);
@@ -5630,11 +5627,11 @@ ins_tab(void)
*/
if (State & VREPLACE_FLAG)
{
- /* Backspace from real cursor to change_col */
+ // Backspace from real cursor to change_col
backspace_until_column(change_col);
- /* Insert each char in saved_line from changed_col to
- * ptr-cursor */
+ // Insert each char in saved_line from changed_col to
+ // ptr-cursor
ins_bytes_len(saved_line + change_col,
cursor->col - change_col);
}
@@ -5678,14 +5675,14 @@ ins_eol(int c)
* in open_line().
*/
- /* Put cursor on NUL if on the last char and coladd is 1 (happens after
- * CTRL-O). */
+ // Put cursor on NUL if on the last char and coladd is 1 (happens after
+ // CTRL-O).
if (virtual_active() && curwin->w_cursor.coladd > 0)
coladvance(getviscol());
#ifdef FEAT_RIGHTLEFT
- /* NL in reverse insert will always start in the end of
- * current line. */
+ // NL in reverse insert will always start in the end of
+ // current line.
if (revins_on)
curwin->w_cursor.col += (colnr_T)STRLEN(ml_get_cursor());
#endif
@@ -5698,7 +5695,7 @@ ins_eol(int c)
can_cindent = TRUE;
#endif
#ifdef FEAT_FOLDING
- /* When inserting a line the cursor line must never be in a closed fold. */
+ // When inserting a line the cursor line must never be in a closed fold.
foldOpenCursor();
#endif
@@ -5721,7 +5718,7 @@ ins_digraph(void)
pc_status = PC_STATUS_UNSET;
if (redrawing() && !char_avail())
{
- /* may need to redraw when no more chars available now */
+ // may need to redraw when no more chars available now
ins_redraw(FALSE);
edit_putchar('?', TRUE);
@@ -5732,22 +5729,22 @@ ins_digraph(void)
}
#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
+ dont_scroll = TRUE; // disallow scrolling here
#endif
- /* don't map the digraph chars. This also prevents the
- * mode message to be deleted when ESC is hit */
+ // don't map the digraph chars. This also prevents the
+ // mode message to be deleted when ESC is hit
++no_mapping;
++allow_keys;
c = plain_vgetc();
--no_mapping;
--allow_keys;
if (did_putchar)
- /* when the line fits in 'columns' the '?' is at the start of the next
- * line and will not be removed by the redraw */
+ // when the line fits in 'columns' the '?' is at the start of the next
+ // line and will not be removed by the redraw
edit_unputchar();
- if (IS_SPECIAL(c) || mod_mask) /* special key */
+ if (IS_SPECIAL(c) || mod_mask) // special key
{
#ifdef FEAT_CMDL_INFO
clear_showcmd();
@@ -5760,7 +5757,7 @@ ins_digraph(void)
did_putchar = FALSE;
if (redrawing() && !char_avail())
{
- /* may need to redraw when no more chars available now */
+ // may need to redraw when no more chars available now
ins_redraw(FALSE);
if (char2cells(c) == 1)
@@ -5779,8 +5776,8 @@ ins_digraph(void)
--no_mapping;
--allow_keys;
if (did_putchar)
- /* when the line fits in 'columns' the '?' is at the start of the
- * next line and will not be removed by a redraw */
+ // when the line fits in 'columns' the '?' is at the start of the
+ // next line and will not be removed by a redraw
edit_unputchar();
if (cc != ESC)
{
@@ -5817,7 +5814,7 @@ ins_copychar(linenr_T lnum)
return NUL;
}
- /* try to advance to the cursor column */
+ // try to advance to the cursor column
temp = 0;
line = ptr = ml_get(lnum);
prev_ptr = ptr;
@@ -5859,12 +5856,12 @@ ins_ctrl_ey(int tc)
{
long tw_save;
- /* The character must be taken literally, insert like it
- * was typed after a CTRL-V, and pretend 'textwidth'
- * wasn't set. Digits, 'o' and 'x' are special after a
- * CTRL-V, don't use it for these. */
+ // The character must be taken literally, insert like it
+ // was typed after a CTRL-V, and pretend 'textwidth'
+ // wasn't set. Digits, 'o' and 'x' are special after a
+ // CTRL-V, don't use it for these.
if (c < 256 && !isalnum(c))
- AppendToRedobuff((char_u *)CTRL_V_STR); /* CTRL-V */
+ AppendToRedobuff((char_u *)CTRL_V_STR); // CTRL-V
tw_save = curbuf->b_p_tw;
curbuf->b_p_tw = -1;
insert_special(c, TRUE, FALSE);
@@ -5873,7 +5870,7 @@ ins_ctrl_ey(int tc)
revins_chars++;
revins_legal++;
#endif
- c = Ctrl_V; /* pretend CTRL-V is last character */
+ c = Ctrl_V; // pretend CTRL-V is last character
auto_format(FALSE, TRUE);
}
}
@@ -5912,7 +5909,7 @@ do_insert_char_pre(int c)
char_u buf[MB_MAXBYTES + 1];
int save_State = State;
- /* Return quickly when there is nothing to do. */
+ // Return quickly when there is nothing to do.
if (!has_insertcharpre())
return NULL;
@@ -5924,21 +5921,21 @@ do_insert_char_pre(int c)
buf[1] = NUL;
}
- /* Lock the text to avoid weird things from happening. */
+ // Lock the text to avoid weird things from happening.
++textlock;
- set_vim_var_string(VV_CHAR, buf, -1); /* set v:char */
+ set_vim_var_string(VV_CHAR, buf, -1); // set v:char
res = NULL;
if (ins_apply_autocmds(EVENT_INSERTCHARPRE))
{
- /* Get the value of v:char. It may be empty or more than one
- * character. Only use it when changed, otherwise continue with the
- * original character to avoid breaking autoindent. */
+ // Get the value of v:char. It may be empty or more than one
+ // character. Only use it when changed, otherwise continue with the
+ // original character to avoid breaking autoindent.
if (STRCMP(buf, get_vim_var_str(VV_CHAR)) != 0)
res = vim_strsave(get_vim_var_str(VV_CHAR));
}
- set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */
+ set_vim_var_string(VV_CHAR, NULL, -1); // clear v:char
--textlock;
// Restore the State, it may have been changed.
diff --git a/src/eval.c b/src/eval.c
index c37d6fdc2..178f47388 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -36,19 +36,19 @@ static char *e_nowhitespace = N_("E274: No white space allowed before parenthesi
*/
static int current_copyID = 0;
-static int echo_attr = 0; /* attributes used for ":echo" */
+static int echo_attr = 0; // attributes used for ":echo"
/*
* Info used by a ":for" loop.
*/
typedef struct
{
- int fi_semicolon; /* TRUE if ending in '; var]' */
- int fi_varcount; /* nr of variables in the list */
- listwatch_T fi_lw; /* keep an eye on the item used. */
- list_T *fi_list; /* list being used */
- int fi_bi; /* index of blob */
- blob_T *fi_blob; /* blob being used */
+ int fi_semicolon; // TRUE if ending in '; var]'
+ int fi_varcount; // nr of variables in the list
+ listwatch_T fi_lw; // keep an eye on the item used.
+ list_T *fi_list; // list being used
+ int fi_bi; // index of blob
+ blob_T *fi_blob; // blob being used
} forinfo_T;
static int tv_op(typval_T *tv1, typval_T *tv2, char_u *op);
@@ -174,7 +174,7 @@ eval_to_bool(
char_u *arg,
int *error,
char_u **nextcmd,
- int skip) /* only parse, don't execute */
+ int skip) // only parse, don't execute
{
typval_T tv;
varnumber_T retval = FALSE;
@@ -261,7 +261,7 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv)
s = skipwhite(s);
if (eval1_emsg(&s, rettv, TRUE) == FAIL)
return FAIL;
- if (*s != NUL) /* check for trailing chars after expr */
+ if (*s != NUL) // check for trailing chars after expr
{
clear_tv(rettv);
semsg(_(e_invexpr2), s);
@@ -300,7 +300,7 @@ eval_expr_to_bool(typval_T *expr, int *error)
eval_to_string_skip(
char_u *arg,
char_u **nextcmd,
- int skip) /* only parse, don't execute */
+ int skip) // only parse, don't execute
{
typval_T tv;
char_u *retval;
@@ -467,7 +467,7 @@ call_vim_function(
int ret;
funcexe_T funcexe;
- rettv->v_type = VAR_UNKNOWN; /* clear_tv() uses this */
+ rettv->v_type = VAR_UNKNOWN; // clear_tv() uses this
vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum;
@@ -574,15 +574,15 @@ eval_foldexpr(char_u *arg, int *cp)
retval = 0;
else
{
- /* If the result is a number, just return the number. */
+ // If the result is a number, just return the number.
if (tv.v_type == VAR_NUMBER)
retval = tv.vval.v_number;
else if (tv.v_type != VAR_STRING || tv.vval.v_string == NULL)
retval = 0;
else
{
- /* If the result is a string, check if there is a non-digit before
- * the number. */
+ // If the result is a string, check if there is a non-digit before
+ // the number.
s = tv.vval.v_string;
if (!VIM_ISDIGIT(*s) && *s != '-')
*cp = *s++;
@@ -625,8 +625,8 @@ get_lval(
lval_T *lp,
int unlet,
int skip,
- int flags, /* GLV_ values */
- int fne_flags) /* flags for find_name_end() */
+ int flags, // GLV_ values
+ int fne_flags) // flags for find_name_end()
{
char_u *p;
char_u *expr_start, *expr_end;
@@ -641,21 +641,21 @@ get_lval(
hashtab_T *ht;
int quiet = flags & GLV_QUIET;
- /* Clear everything in "lp". */
+ // Clear everything in "lp".
vim_memset(lp, 0, sizeof(lval_T));
if (skip)
{
- /* When skipping just find the end of the name. */
+ // When skipping just find the end of the name.
lp->ll_name = name;
return find_name_end(name, NULL, NULL, FNE_INCL_BR | fne_flags);
}
- /* Find the end of the name. */
+ // Find the end of the name.
p = find_name_end(name, &expr_start, &expr_end, fne_flags);
if (expr_start != NULL)
{
- /* Don't expand the name when we already know there is an error. */
+ // Don't expand the name when we already know there is an error.
if (unlet && !VIM_ISWHITE(*p) && !ends_excmd(*p)
&& *p != '[' && *p != '.')
{
@@ -666,9 +666,9 @@ get_lval(
lp->ll_exp_name = make_expanded_name(name, expr_start, expr_end, p);
if (lp->ll_exp_name == NULL)
{
- /* Report an invalid expression in braces, unless the
- * expression evaluation has been cancelled due to an
- * aborting error, an interrupt, or an exception. */
+ // Report an invalid expression in braces, unless the
+ // expression evaluation has been cancelled due to an
+ // aborting error, an interrupt, or an exception.
if (!aborting() && !quiet)
{
emsg_severe = TRUE;
@@ -681,14 +681,14 @@ get_lval(
else
lp->ll_name = name;
- /* Without [idx] or .key we are done. */
+ // Without [idx] or .key we are done.
if ((*p != '[' && *p != '.') || lp->ll_name == NULL)
return p;
cc = *p;
*p = NUL;
- /* Only pass &ht when we would write to the variable, it prevents autoload
- * as well. */
+ // Only pass &ht when we would write to the variable, it prevents autoload
+ // as well.
v = find_var(lp->ll_name, (flags & GLV_READ_ONLY) ? NULL : &ht,
flags & GLV_NO_AUTOLOAD);
if (v == NULL && !quiet)
@@ -738,24 +738,24 @@ get_lval(
}
else
{
- /* Get the index [expr] or the first index [expr: ]. */
+ // Get the index [expr] or the first index [expr: ].
p = skipwhite(p + 1);
if (*p == ':')
empty1 = TRUE;
else
{
empty1 = FALSE;
- if (eval1(&p, &var1, TRUE) == FAIL) /* recursive! */
+ if (eval1(&p, &var1, TRUE) == FAIL) // recursive!
return NULL;
if (tv_get_string_chk(&var1) == NULL)
{
- /* not a number or string */
+ // not a number or string
clear_tv(&var1);
return NULL;
}
}
- /* Optionally get the second index [ :expr]. */
+ // Optionally get the second index [ :expr].
if (*p == ':')
{
if (lp->ll_tv->v_type == VAR_DICT)
@@ -782,14 +782,14 @@ get_lval(
else
{
lp->ll_empty2 = FALSE;
- if (eval1(&p, &var2, TRUE) == FAIL) /* recursive! */
+ if (eval1(&p, &var2, TRUE) == FAIL) // recursive!
{
clear_tv(&var1);
return NULL;
}
if (tv_get_string_chk(&var2) == NULL)
{
- /* not a number or string */
+ // not a number or string
clear_tv(&var1);
clear_tv(&var2);
return NULL;
@@ -809,7 +809,7 @@ get_lval(
return NULL;
}
- /* Skip to past ']'. */
+ // Skip to past ']'.
++p;
}
@@ -817,8 +817,8 @@ get_lval(
{
if (len == -1)
{
- /* "[key]": get key from "var1" */
- key = tv_get_string_chk(&var1); /* is number or string */
+ // "[key]": get key from "var1"
+ key = tv_get_string_chk(&var1); // is number or string
if (key == NULL)
{
clear_tv(&var1);
@@ -829,9 +829,9 @@ get_lval(
lp->ll_dict = lp->ll_tv->vval.v_dict;
lp->ll_di = dict_find(lp->ll_dict, key, len);
- /* When assigning to a scope dictionary check that a function and
- * variable name is valid (only variable name unless it is l: or
- * g: dictionary). Disallow overwriting a builtin function. */
+ // When assigning to a scope dictionary check that a function and
+ // variable name is valid (only variable name unless it is l: or
+ // g: dictionary). Disallow overwriting a builtin function.
if (rettv != NULL && lp->ll_dict->dv_scope != 0)
{
int prevval;
@@ -843,7 +843,7 @@ get_lval(
key[len] = NUL;
}
else
- prevval = 0; /* avoid compiler warning */
+ prevval = 0; // avoid compiler warning
wrong = (lp->ll_dict->dv_scope == VAR_DEF_SCOPE
&& rettv->v_type == VAR_FUNC
&& var_check_func_name(key, lp->ll_di == NULL))
@@ -882,7 +882,7 @@ get_lval(
p = NULL;
break;
}
- /* existing variable, need to check if it can be changed */
+ // existing variable, need to check if it can be changed
else if ((flags & GLV_READ_ONLY) == 0
&& var_check_ro(lp->ll_di->di_flags, name, FALSE))
{
@@ -941,7 +941,7 @@ get_lval(
if (empty1)
lp->ll_n1 = 0;
else
- /* is number or string */
+ // is number or string
lp->ll_n1 = (long)tv_get_number(&var1);
clear_tv(&var1);
@@ -973,7 +973,7 @@ get_lval(
if (lp->ll_range && !lp->ll_empty2)
{
lp->ll_n2 = (long)tv_get_number(&var2);
- /* is number or string */
+ // is number or string
clear_tv(&var2);
if (lp->ll_n2 < 0)
{
@@ -987,7 +987,7 @@ get_lval(
lp->ll_n2 = list_idx_of_item(lp->ll_list, ni);
}
- /* Check that lp->ll_n2 isn't before lp->ll_n1. */
+ // Check that lp->ll_n2 isn't before lp->ll_n1.
if (lp->ll_n1 < 0)
lp->ll_n1 = list_idx_of_item(lp->ll_list, lp->ll_li);
if (lp->ll_n2 < lp->ll_n1)
@@ -1164,7 +1164,7 @@ set_var_lval(
break;
if (lp->ll_li->li_next == NULL)
{
- /* Need to add an empty item. */
+ // Need to add an empty item.
if (list_append_number(lp->ll_list, 0) == FAIL)
{
ri = NULL;
@@ -1199,7 +1199,7 @@ set_var_lval(
return;
}
- /* Need to add an item to the Dictionary. */
+ // Need to add an item to the Dictionary.
di = dictitem_alloc(lp->ll_newkey);
if (di == NULL)
return;
@@ -1244,7 +1244,7 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op)
char_u numbuf[NUMBUFLEN];
char_u *s;
- /* Can't do anything with a Funcref, Dict, v:true on the right. */
+ // Can't do anything with a Funcref, Dict, v:true on the right.
if (tv2->v_type != VAR_FUNC && tv2->v_type != VAR_DICT
&& tv2->v_type != VAR_SPECIAL)
{
@@ -1386,7 +1386,7 @@ eval_for_line(
typval_T tv;
list_T *l;
- *errp = TRUE; /* default: there is an error */
+ *errp = TRUE; // default: there is an error
fi = ALLOC_CLEAR_ONE(forinfo_T);
if (fi == NULL)
@@ -1526,7 +1526,7 @@ set_context_for_expression(
xp->xp_context = EXPAND_USER_VARS;
if (vim_strpbrk(arg, (char_u *)"\"'+-*/%.=!?~|&$([<>,#") == NULL)
{
- /* ":let var1 var2 ...": find last space. */
+ // ":let var1 var2 ...": find last space.
for (p = arg + STRLEN(arg); p >= arg; )
{
xp->xp_pattern = p;
@@ -1563,7 +1563,7 @@ set_context_for_expression(
}
else if (c == '$')
{
- /* environment variable */
+ // environment variable
xp->xp_context = EXPAND_ENV_VARS;
}
else if (c == '=')
@@ -1574,28 +1574,28 @@ set_context_for_expression(
else if (c == '#'
&& xp->xp_context == EXPAND_EXPRESSION)
{
- /* Autoload function/variable contains '#'. */
+ // Autoload function/variable contains '#'.
break;
}
else if ((c == '<' || c == '#')
&& xp->xp_context == EXPAND_FUNCTIONS
&& vim_strchr(xp->xp_pattern, '(') == NULL)
{
- /* Function name can start with "<SNR>" and contain '#'. */
+ // Function name can start with "<SNR>" and contain '#'.
break;
}
else if (cmdidx != CMD_let || got_eq)
{
- if (c == '"') /* string */
+ if (c == '"') // string
{
while ((c = *++xp->xp_pattern) != NUL && c != '"')
if (c == '\\' && xp->xp_pattern[1] != NUL)
++xp->xp_pattern;
xp->xp_context = EXPAND_NOTHING;
}
- else if (c == '\'') /* literal string */
+ else if (c == '\'') // literal string
{
- /* Trick: '' is like stopping and starting a literal string. */
+ // Trick: '' is like stopping and starting a literal string.
while ((c = *++xp->xp_pattern) != NUL && c != '\'')
/* skip */ ;
xp->xp_context = EXPAND_NOTHING;
@@ -1614,8 +1614,8 @@ set_context_for_expression(
xp->xp_context = EXPAND_EXPRESSION;
}
else
- /* Doesn't look like something valid, expand as an expression
- * anyway. */
+ // Doesn't look like something valid, expand as an expression
+ // anyway.
xp->xp_context = EXPAND_EXPRESSION;
arg = xp->xp_pattern;
if (*arg != NUL)
@@ -1636,7 +1636,7 @@ pattern_match(char_u *pat, char_u *text, int ic)
char_u *save_cpo;
regmatch_T regmatch;
- /* avoid 'l' flag in 'cpoptions' */
+ // avoid 'l' flag in 'cpoptions'
save_cpo = p_cpo;
p_cpo = (char_u *)"";
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
@@ -1672,12 +1672,12 @@ eval_func(
if (!evaluate)
check_vars(s, len);
- /* If "s" is the name of a variable of type VAR_FUNC
- * use its contents. */
+ // If "s" is the name of a variable of type VAR_FUNC
+ // use its contents.
s = deref_func_name(s, &len, &partial, !evaluate);
- /* Need to make a copy, in case evaluating the arguments makes
- * the name invalid. */
+ // Need to make a copy, in case evaluating the arguments makes
+ // the name invalid.
s = vim_strsave(s);
if (s == NULL)
ret = FAIL;
@@ -1696,18 +1696,18 @@ eval_func(
}
vim_free(s);
- /* If evaluate is FALSE rettv->v_type was not set in
- * get_func_tv, but it's needed in handle_subscript() to parse
- * what follows. So set it here. */
+ // If evaluate is FALSE rettv->v_type was not set in
+ // get_func_tv, but it's needed in handle_subscript() to parse
+ // what follows. So set it here.
if (rettv->v_type == VAR_UNKNOWN && !evaluate && **arg == '(')
{
rettv->vval.v_string = NULL;
rettv->v_type = VAR_FUNC;
}
- /* Stop the expression evaluation when immediately
- * aborting on error, or when an interrupt occurred or
- * an exception was thrown but not caught. */
+ // Stop the expression evaluation when immediately
+ // aborting on error, or when an interrupt occurred or
+ // an exception was thrown but not caught.
if (evaluate && aborting())
{
if (ret == OK)
@@ -1806,7 +1806,7 @@ eval1(char_u **arg, typval_T *rettv, int evaluate)
* Get the second variable.
*/
*arg = skipwhite(*arg + 1);
- if (eval1(arg, rettv, evaluate && result) == FAIL) /* recursive! */
+ if (eval1(arg, rettv, evaluate && result) == FAIL) // recursive!
return FAIL;
/*
@@ -1824,7 +1824,7 @@ eval1(char_u **arg, typval_T *rettv, int evaluate)
* Get the third variable.
*/
*arg = skipwhite(*arg + 1);
- if (eval1(arg, &var2, evaluate && !result) == FAIL) /* recursive! */
+ if (eval1(arg, &var2, evaluate && !result) == FAIL) // recursive!
{
if (evaluate && result)
clear_tv(rettv);
@@ -1998,7 +1998,7 @@ eval4(char_u **arg, typval_T *rettv, int evaluate)
char_u *p;
int i;
exptype_T type = TYPE_UNKNOWN;
- int type_is = FALSE; /* TRUE for "is" and "isnot" */
+ int type_is = FALSE; // TRUE for "is" and "isnot"
int len = 2;
int ic;
@@ -2056,19 +2056,19 @@ eval4(char_u **arg, typval_T *rettv, int evaluate)
*/
if (type != TYPE_UNKNOWN)
{
- /* extra question mark appended: ignore case */
+ // extra question mark appended: ignore case
if (p[len] == '?')
{
ic = TRUE;
++len;
}
- /* extra '#' appended: match case */
+ // extra '#' appended: match case
else if (p[len] == '#')
{
ic = FALSE;
++len;
}
- /* nothing appended: use 'ignorecase' */
+ // nothing appended: use 'ignorecase'
else
ic = p_ic;
@@ -2145,13 +2145,13 @@ eval5(char_u **arg, typval_T *rettv, int evaluate)
#endif
)
{
- /* For "list + ...", an illegal use of the first operand as
- * a number cannot be determined before evaluating the 2nd
- * operand: if this is also a list, all is ok.
- * For "something . ...", "something - ..." or "non-list + ...",
- * we know that the first operand needs to be a string or number
- * without evaluating the 2nd operand. So check before to avoid
- * side effects after an error. */
+ // For "list + ...", an illegal use of the first operand as
+ // a number cannot be determined before evaluating the 2nd
+ // operand: if this is also a list, all is ok.
+ // For "something . ...", "something - ..." or "non-list + ...",
+ // we know that the first operand needs to be a string or number
+ // without evaluating the 2nd operand. So check before to avoid
+ // side effects after an error.
if (evaluate && tv_get_string_chk(rettv) == NULL)
{
clear_tv(rettv);
@@ -2178,9 +2178,9 @@ eval5(char_u **arg, typval_T *rettv, int evaluate)
*/
if (op == '.')
{
- s1 = tv_get_string_buf(rettv, buf1); /* already checked */
+ s1 = tv_get_string_buf(rettv, buf1); // already checked
s2 = tv_get_string_buf_chk(&var2, buf2);
- if (s2 == NULL) /* type error ? */
+ if (s2 == NULL) // type error ?
{
clear_tv(rettv);
clear_tv(&var2);
@@ -2213,7 +2213,7 @@ eval5(char_u **arg, typval_T *rettv, int evaluate)
else if (op == '+' && rettv->v_type == VAR_LIST
&& var2.v_type == VAR_LIST)
{
- /* concatenate Lists */
+ // concatenate Lists
if (list_concat(rettv->vval.v_list, var2.vval.v_list,
&var3) == FAIL)
{
@@ -2240,9 +2240,9 @@ eval5(char_u **arg, typval_T *rettv, int evaluate)
n1 = tv_get_number_chk(rettv, &error);
if (error)
{
- /* This can only happen for "list + non-list". For
- * "non-list + ..." or "something - ...", we returned
- * before evaluating the 2nd operand. */
+ // This can only happen for "list + non-list". For
+ // "non-list + ..." or "something - ...", we returned
+ // before evaluating the 2nd operand.
clear_tv(rettv);
return FAIL;
}
@@ -2275,7 +2275,7 @@ eval5(char_u **arg, typval_T *rettv, int evaluate)
clear_tv(rettv);
#ifdef FEAT_FLOAT
- /* If there is a float on either side the result is a float. */
+ // If there is a float on either side the result is a float.
if (rettv->v_type == VAR_FLOAT || var2.v_type == VAR_FLOAT)
{
if (op == '+')
@@ -2318,7 +2318,7 @@ eval6(
char_u **arg,
typval_T *rettv,
int evaluate,
- int want_string) /* after "." operator */
+ int want_string) // after "." operator
{
typval_T var2;
int op;
@@ -2408,11 +2408,11 @@ eval6(
else if (op == '/')
{
# ifdef VMS
- /* VMS crashes on divide by zero, work around it */
+ // VMS crashes on divide by zero, work around it
if (f2 == 0.0)
{
if (f1 == 0)
- f1 = -1 * __F_FLT_MAX - 1L; /* similar to NaN */
+ f1 = -1 * __F_FLT_MAX - 1L; // similar to NaN
else if (f1 < 0)
f1 = -1 * __F_FLT_MAX;
else
@@ -2421,8 +2421,8 @@ eval6(
else
f1 = f1 / f2;
# else
- /* We rely on the floating point library to handle divide
- * by zero to result in "inf" and not a crash. */
+ // We rely on the floating point library to handle divide
+ // by zero to result in "inf" and not a crash.
f1 = f1 / f2;
# endif
}
@@ -2487,7 +2487,7 @@ eval7(
char_u **arg,
typval_T *rettv,
int evaluate,
- int want_string UNUSED) /* after "." operator */
+ int want_string UNUSED) // after "." operator
{
varnumber_T n;
int len;
@@ -2542,13 +2542,13 @@ eval7(
char_u *p;
int get_float = FALSE;
- /* We accept a float when the format matches
- * "[0-9]\+\.[0-9]\+\([eE][+-]\?[0-9]\+\)\?". This is very
- * strict to avoid backwards compatibility problems.
- * With script version 2 and later the leading digit can be
- * omitted.
- * Don't look for a float after the "." operator, so that
- * ":let vers = 1.2.3" doesn't fail. */
+ // We accept a float when the format matches
+ // "[0-9]\+\.[0-9]\+\([eE][+-]\?[0-9]\+\)\?". This is very
+ // strict to avoid backwards compatibility problems.
+ // With script version 2 and later the leading digit can be
+ // omitted.
+ // Don't look for a float after the "." operator, so that
+ // ":let vers = 1.2.3" doesn't fail.
if (**arg == '.')
p = *arg;
else
@@ -2705,7 +2705,7 @@ eval7(
* nested expression: (expression).
*/
case '(': *arg = skipwhite(*arg + 1);
- ret = eval1(arg, rettv, evaluate); /* recursive! */
+ ret = eval1(arg, rettv, evaluate); // recursive!
if (**arg == ')')
++*arg;
else if (ret == OK)
@@ -2735,7 +2735,7 @@ eval7(
ret = FAIL;
else
{
- if (**arg == '(') /* recursive! */
+ if (**arg == '(') // recursive!
ret = eval_func(arg, s, len, rettv, evaluate, NULL);
else if (evaluate)
ret = get_var_tv(s, len, rettv, NULL, TRUE, FALSE);
@@ -2750,8 +2750,8 @@ eval7(
*arg = skipwhite(*arg);
- /* Handle following '[', '(' and '.' for expr[expr], expr.name,
- * expr(expr), expr->name(expr) */
+ // Handle following '[', '(' and '.' for expr[expr], expr.name,
+ // expr(expr), expr->name(expr)
if (ret == OK)
ret = handle_subscript(arg, rettv, evaluate, TRUE,
start_leader, &end_leader);
@@ -2853,7 +2853,7 @@ call_func_rettv(
functv = *rettv;
rettv->v_type = VAR_UNKNOWN;
- /* Invoke the function. Recursive! */
+ // Invoke the function. Recursive!
if (functv.v_type == VAR_PARTIAL)
{
pt = functv.vval.v_partial;
@@ -2874,8 +2874,8 @@ call_func_rettv(
funcexe.basetv = basetv;
ret = get_func_tv(s, -1, rettv, arg, &funcexe);
- /* Clear the funcref afterwards, so that deleting it while
- * evaluating the arguments is possible (see test55). */
+ // Clear the funcref afterwards, so that deleting it while
+ // evaluating the arguments is possible (see test55).
if (evaluate)
clear_tv(&functv);
@@ -2892,7 +2892,7 @@ eval_lambda(
char_u **arg,
typval_T *rettv,
int evaluate,
- int verbose) /* give error messages */
+ int verbose) // give error messages
{
typval_T base = *rettv;
int ret;
@@ -2937,7 +2937,7 @@ eval_method(
char_u **arg,
typval_T *rettv,
int evaluate,
- int verbose) /* give error messages */
+ int verbose) // give error messages
{
char_u *name;
long len;
@@ -2996,7 +2996,7 @@ eval_index(
char_u **arg,
typval_T *rettv,
int evaluate,
- int verbose) /* give error messages */
+ int verbose) // give error messages
{
int empty1 = FALSE, empty2 = FALSE;
typval_T var1, var2;
@@ -3029,7 +3029,7 @@ eval_index(
case VAR_UNKNOWN:
if (evaluate)
return FAIL;
- /* FALLTHROUGH */
+ // FALLTHROUGH
case VAR_STRING:
case VAR_NUMBER:
@@ -3063,11 +3063,11 @@ eval_index(
*arg = skipwhite(*arg + 1);
if (**arg == ':')
empty1 = TRUE;
- else if (eval1(arg, &var1, evaluate) == FAIL) /* recursive! */
+ else if (eval1(arg, &var1, evaluate) == FAIL) // recursive!
return FAIL;
else if (evaluate && tv_get_string_chk(&var1) == NULL)
{
- /* not a number or string */
+ // not a number or string
clear_tv(&var1);
return FAIL;
}
@@ -3081,7 +3081,7 @@ eval_index(
*arg = skipwhite(*arg + 1);
if (**arg == ']')
empty2 = TRUE;
- else if (eval1(arg, &var2, evaluate) == FAIL) /* recursive! */
+ else if (eval1(arg, &var2, evaluate) == FAIL) // recursive!
{
if (!empty1)
clear_tv(&var1);
@@ -3089,7 +3089,7 @@ eval_index(
}
else if (evaluate && tv_get_string_chk(&var2) == NULL)
{
- /* not a number or string */
+ // not a number or string
if (!empty1)
clear_tv(&var1);
clear_tv(&var2);
@@ -3097,7 +3097,7 @@ eval_index(
}
}
- /* Check for the ']'. */
+ // Check for the ']'.
if (**arg != ']')
{
if (verbose)
@@ -3107,7 +3107,7 @@ eval_index(
clear_tv(&var2);
return FAIL;
}
- *arg = skipwhite(*arg + 1); /* skip the ']' */
+ *arg = skipwhite(*arg + 1); // skip the ']'
}
if (evaluate)
@@ -3138,7 +3138,7 @@ eval_index(
case VAR_SPECIAL:
case VAR_JOB:
case VAR_CHANNEL:
- break; /* not evaluating, skipping over subscript */
+ break; // not evaluating, skipping over subscript
case VAR_NUMBER:
case VAR_STRING:
@@ -3146,8 +3146,8 @@ eval_index(
len = (long)STRLEN(s);
if (range)
{
- /* The resulting variable is a substring. If the indexes
- * are out of range the result is empty. */
+ // The resulting variable is a substring. If the indexes
+ // are out of range the result is empty.
if (n1 < 0)
{
n1 = len + n1;
@@ -3165,9 +3165,9 @@ eval_index(
}
else
{
- /* The resulting variable is a string of a single
- * character. If the index is too big or negative the
- * result is empty. */
+ // The resulting variable is a string of a single
+ // character. If the index is too big or negative the
+ // result is empty.
if (n1 >= len || n1 < 0)
s = NULL;
else
@@ -3246,8 +3246,8 @@ eval_index(
n1 = len + n1;
if (!empty1 && (n1 < 0 || n1 >= len))
{
- /* For a range we allow invalid values and return an empty
- * list. A list index out of range is an error. */
+ // For a range we allow invalid values and return an empty
+ // list. A list index out of range is an error.
if (!range)
{
if (verbose)
@@ -3342,7 +3342,7 @@ eval_index(
int
get_option_tv(
char_u **arg,
- typval_T *rettv, /* when NULL, only check if option exists */
+ typval_T *rettv, // when NULL, only check if option exists
int evaluate)
{
char_u *option_end;
@@ -3350,7 +3350,7 @@ get_option_tv(
char_u *stringval;
int opt_type;
int c;
- int working = (**arg == '+'); /* has("+option") */
+ int working = (**arg == '+'); // has("+option")
int ret = OK;
int opt_flags;
@@ -3376,7 +3376,7 @@ get_option_tv(
opt_type = get_option_value(*arg, &numval,
rettv == NULL ? NULL : &stringval, opt_flags);
- if (opt_type == -3) /* invalid name */
+ if (opt_type == -3) // invalid name
{
if (rettv != NULL)
semsg(_("E113: Unknown option: %s"), *arg);
@@ -3384,22 +3384,22 @@ get_option_tv(
}
else if (rettv != NULL)
{
- if (opt_type == -2) /* hidden string option */
+ if (opt_type == -2) // hidden string option
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
}
- else if (opt_type == -1) /* hidden number option */
+ else if (opt_type == -1) // hidden number option
{
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = 0;
}
- else if (opt_type == 1) /* number option */
+ else if (opt_type == 1) // number option
{
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = numval;
}
- else /* string option */
+ else // string option
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = stringval;
@@ -3408,7 +3408,7 @@ get_option_tv(
else if (working && (opt_type == -2 || opt_type == -1))
ret = FAIL;
- *option_end = c; /* put back for error messages */
+ *option_end = c; // put back for error messages
*arg = option_end;
return ret;
@@ -3433,8 +3433,8 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
if (*p == '\\' && p[1] != NUL)
{
++p;
- /* A "\<x>" form occupies at least 4 characters, and produces up
- * to 6 characters: reserve space for 2 extra */
+ // A "\<x>" form occupies at least 4 characters, and produces up
+ // to 6 characters: reserve space for 2 extra
if (*p == '<')
extra += 2;
}
@@ -3446,7 +3446,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
return FAIL;
}
- /* If only parsing, set *arg and return here */
+ // If only parsing, set *arg and return here
if (!evaluate)
{
*arg = p + 1;
@@ -3476,9 +3476,9 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
case 'r': *name++ = CAR; ++p; break;
case 't': *name++ = TAB; ++p; break;
- case 'X': /* hex: "\x1", "\x12" */
+ case 'X': // hex: "\x1", "\x12"
case 'x':
- case 'u': /* Unicode: "\u0023" */
+ case 'u': // Unicode: "\u0023"
case 'U':
if (vim_isxdigit(p[1]))
{
@@ -3498,8 +3498,8 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
nr = (nr << 4) + hex2nr(*p);
}
++p;
- /* For "\u" store the number according to
- * 'encoding'. */
+ // For "\u" store the number according to
+ // 'encoding'.
if (c != 'X')
name += (*mb_char2bytes)(nr, name);
else
@@ -3507,7 +3507,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
}
break;
- /* octal: "\1", "\12", "\123" */
+ // octal: "\1", "\12", "\123"
case '0':
case '1':
case '2':
@@ -3525,7 +3525,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
++name;
break;
- /* Special key, e.g.: "\<C-W>" */
+ // Special key, e.g.: "\<C-W>"
case '<': extra = trans_special(&p, name, TRUE, TRUE,
TRUE, NULL);
if (extra != 0)
@@ -3533,7 +3533,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
name += extra;
break;
}
- /* FALLTHROUGH */
+ // FALLTHROUGH
default: MB_COPY_CHAR(p, name);
break;
@@ -3544,7 +3544,7 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
}
*name = NUL;
- if (*p != NUL) /* just in case */
+ if (*p != NUL) // just in case
++p;
*arg = p;
@@ -3582,7 +3582,7 @@ get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate)
return FAIL;
}
- /* If only parsing return after setting "*arg" */
+ // If only parsing return after setting "*arg"
if (!evaluate)
{
*arg = p + 1;
@@ -3661,14 +3661,14 @@ static int tv_equal_recurse_limit;
func_equal(
typval_T *tv1,
typval_T *tv2,
- int ic) /* ignore case */
+ int ic) // ignore case
{
char_u *s1, *s2;
dict_T *d1, *d2;
int a1, a2;
int i;
- /* empty and NULL function name considered the same */
+ // empty and NULL function name considered the same
s1 = tv1->v_type == VAR_FUNC ? tv1->vval.v_string
: partial_name(tv1->vval.v_partial);
if (s1 != NULL && *s1 == NUL)
@@ -3685,7 +3685,7 @@ func_equal(
else if (STRCMP(s1, s2) != 0)
return FALSE;
- /* empty dict and NULL dict is different */
+ // empty dict and NULL dict is different
d1 = tv1->v_type == VAR_FUNC ? NULL : tv1->vval.v_partial->pt_dict;
d2 = tv2->v_type == VAR_FUNC ? NULL : tv2->vval.v_partial->pt_dict;
if (d1 == NULL || d2 == NULL)
@@ -3696,7 +3696,7 @@ func_equal(
else if (!dict_equal(d1, d2, ic, TRUE))
return FALSE;
- /* empty list and no list considered the same */
+ // empty list and no list considered the same
a1 = tv1->v_type == VAR_FUNC ? 0 : tv1->vval.v_partial->pt_argc;
a2 = tv2->v_type == VAR_FUNC ? 0 : tv2->vval.v_partial->pt_argc;
if (a1 != a2)
@@ -3718,20 +3718,20 @@ func_equal(
tv_equal(
typval_T *tv1,
typval_T *tv2,
- int ic, /* ignore case */
- int recursive) /* TRUE when used recursively */
+ int ic, // ignore case
+ int recursive) // TRUE when used recursively
{
char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN];
char_u *s1, *s2;
- static int recursive_cnt = 0; /* catch recursive loops */
+ static int recursive_cnt = 0; // catch recursive loops
int r;
- /* Catch lists and dicts that have an endless loop by limiting
- * recursiveness to a limit. We guess they are equal then.
- * A fixed limit has the problem of still taking an awful long time.
- * Reduce the limit every time running into it. That should work fine for
- * deeply linked structures that are not recursively linked and catch
- * recursiveness quickly. */
+ // Catch lists and dicts that have an endless loop by limiting
+ // recursiveness to a limit. We guess they are equal then.
+ // A fixed limit has the problem of still taking an awful long time.
+ // Reduce the limit every time running into it. That should work fine for
+ // deeply linked structures that are not recursively linked and catch
+ // recursiveness quickly.
if (!recursive)
tv_equal_recurse_limit = 1000;
if (recursive_cnt >= tv_equal_recurse_limit)
@@ -3740,8 +3740,8 @@ tv_equal(
return TRUE;
}
- /* For VAR_FUNC and VAR_PARTIAL compare the function name, bound dict and
- * arguments. */
+ // For VAR_FUNC and VAR_PARTIAL compare the function name, bound dict and
+ // arguments.
if ((tv1->v_type == VAR_FUNC
|| (tv1->v_type == VAR_PARTIAL && tv1->vval.v_partial != NULL))
&& (tv2->v_type == VAR_FUNC
@@ -3802,8 +3802,8 @@ tv_equal(
break;
}
- /* VAR_UNKNOWN can be the result of a invalid expression, let's say it
- * does not equal anything, not even itself. */
+ // VAR_UNKNOWN can be the result of a invalid expression, let's say it
+ // does not equal anything, not even itself.
return FALSE;
}
@@ -3855,14 +3855,14 @@ garbage_collect(int testing)
if (!testing)
{
- /* Only do this once. */
+ // Only do this once.
want_garbage_collect = FALSE;
may_garbage_collect = FALSE;
garbage_collect_at_exit = FALSE;
}
- /* We advance by two because we add one for items referenced through
- * previous_funccal. */
+ // We advance by two because we add one for items referenced through
+ // previous_funccal.
copyID = get_copyID();
/*
@@ -3870,20 +3870,20 @@ garbage_collect(int testing)
* with copyID.
*/
- /* Don't free variables in the previous_funccal list unless they are only
- * referenced through previous_funccal. This must be first, because if
- * the item is referenced elsewhere the funccal must not be freed. */
+ // Don't free variables in the previous_funccal list unless they are only
+ // referenced through previous_funccal. This must be first, because if
+ // the item is referenced elsewhere the funccal must not be freed.
abort = abort || set_ref_in_previous_funccal(copyID);
- /* script-local variables */
+ // script-local variables
abort = abort || garbage_collect_scriptvars(copyID);
- /* buffer-local variables */
+ // buffer-local variables
FOR_ALL_BUFFERS(buf)
abort = abort || set_ref_in_item(&buf->b_bufvar.di_tv, copyID,
NULL, NULL);
- /* window-local variables */
+ // window-local variables
FOR_ALL_TAB_WINDOWS(tp, wp)
abort = abort || set_ref_in_item(&wp->w_winvar.di_tv, copyID,
NULL, NULL);
@@ -3900,23 +3900,23 @@ garbage_collect(int testing)
NULL, NULL);
#endif
- /* tabpage-local variables */
+ // tabpage-local variables
FOR_ALL_TABPAGES(tp)
abort = abort || set_ref_in_item(&tp->tp_winvar.di_tv, copyID,
NULL, NULL);
- /* global variables */
+ // global variables
abort = abort || garbage_collect_globvars(copyID);
- /* function-local variables */
+ // function-local variables
abort = abort || set_ref_in_call_stack(copyID);
- /* named functions (matters for closures) */
+ // named functions (matters for closures)
abort = abort || set_ref_in_functions(copyID);
- /* function call arguments, if v:testing is set. */
+ // function call arguments, if v:testing is set.
abort = abort || set_ref_in_func_args(copyID);
- /* v: vars */
+ // v: vars
abort = abort || garbage_collect_vimvars(copyID);
// callbacks in buffers
@@ -3987,9 +3987,9 @@ free_unref_items(int copyID)
{
int did_free = FALSE;
- /* Let all "free" functions know that we are here. This means no
- * dictionaries, lists, channels or jobs are to be freed, because we will
- * do that here. */
+ // Let all "free" functions know that we are here. This means no
+ // dictionaries, lists, channels or jobs are to be freed, because we will
+ // do that here.
in_free_unref_items = TRUE;
/*
@@ -3997,19 +3997,19 @@ free_unref_items(int copyID)
* themselves yet, so that it is possible to decrement refcount counters
*/
- /* Go through the list of dicts and free items without the copyID. */
+ // Go through the list of dicts and free items without the copyID.
did_free |= dict_free_nonref(copyID);
- /* Go through the list of lists and free items without the copyID. */
+ // Go through the list of lists and free items without the copyID.
did_free |= list_free_nonref(copyID);
#ifdef FEAT_JOB_CHANNEL
- /* Go through the list of jobs and free items without the copyID. This
- * must happen before doing channels, because jobs refer to channels, but
- * the reference from the channel to the job isn't tracked. */
+ // Go through the list of jobs and free items without the copyID. This
+ // must happen before doing channels, because jobs refer to channels, but
+ // the reference from the channel to the job isn't tracked.
did_free |= free_unused_jobs_contents(copyID, COPYID_MASK);
- /* Go through the list of channels and free items without the copyID. */
+ // Go through the list of channels and free items without the copyID.
did_free |= free_unused_channels_contents(copyID, COPYID_MASK);
#endif
@@ -4020,12 +4020,12 @@ free_unref_items(int copyID)
list_free_items(copyID);
#ifdef FEAT_JOB_CHANNEL
- /* Go through the list of jobs and free items without the copyID. This
- * must happen before doing channels, because jobs refer to channels, but
- * the reference from the channel to the job isn't tracked. */
+ // Go through the list of jobs and free items without the copyID. This
+ // must happen before doing channels, because jobs refer to channels, but
+ // the reference from the channel to the job isn't tracked.
free_unused_jobs(copyID, COPYID_MASK);
- /* Go through the list of channels and free items without the copyID. */
+ // Go through the list of channels and free items without the copyID.
free_unused_channels(copyID, COPYID_MASK);
#endif
@@ -4055,9 +4055,9 @@ set_ref_in_ht(hashtab_T *ht, int copyID, list_stack_T **list_stack)
{
if (!abort)
{
- /* Mark each item in the hashtab. If the item contains a hashtab
- * it is added to ht_stack, if it contains a list it is added to
- * list_stack. */
+ // Mark each item in the hashtab. If the item contains a hashtab
+ // it is added to ht_stack, if it contains a list it is added to
+ // list_stack.
todo = (int)cur_ht->ht_used;
for (hi = cur_ht->ht_array; todo > 0; ++hi)
if (!HASHITEM_EMPTY(hi))
@@ -4071,7 +4071,7 @@ set_ref_in_ht(hashtab_T *ht, int copyID, list_stack_T **list_stack)
if (ht_stack == NULL)
break;
- /* take an item from the stack */
+ // take an item from the stack
cur_ht = ht_stack->ht;
tempitem = ht_stack;
ht_stack = ht_stack->prev;
@@ -4130,16 +4130,16 @@ set_ref_in_list_items(list_T *l, int copyID, ht_stack_T **ht_stack)
for (;;)
{
if (!abort)
- /* Mark each item in the list. If the item contains a hashtab
- * it is added to ht_stack, if it contains a list it is added to
- * list_stack. */
+ // Mark each item in the list. If the item contains a hashtab
+ // it is added to ht_stack, if it contains a list it is added to
+ // list_stack.
for (li = cur_l->lv_first; !abort && li != NULL; li = li->li_next)
abort = abort || set_ref_in_item(&li->li_tv, copyID,
ht_stack, &list_stack);
if (list_stack == NULL)
break;
- /* take an item from the stack */
+ // take an item from the stack
cur_l = list_stack->list;
tempitem = list_stack;
list_stack = list_stack->prev;
@@ -4171,7 +4171,7 @@ set_ref_in_item(
if (dd != NULL && dd->dv_copyID != copyID)
{
- /* Didn't see this dict yet. */
+ // Didn't see this dict yet.
dd->dv_copyID = copyID;
if (ht_stack == NULL)
{
@@ -4197,7 +4197,7 @@ set_ref_in_item(
if (ll != NULL && ll->lv_copyID != copyID)
{
- /* Didn't see this list yet. */
+ // Didn't see this list yet.
ll->lv_copyID = copyID;
if (list_stack == NULL)
{
@@ -4227,8 +4227,7 @@ set_ref_in_item(
partial_T *pt = tv->vval.v_partial;
int i;
- /* A partial does not have a copyID, because it cannot contain itself.
- */
+ // A partial does not have a copyID, because it cannot contain itself.
if (pt != NULL)
{
abort = set_ref_in_func(pt->pt_name, pt->pt_func, copyID);
@@ -4349,9 +4348,9 @@ echo_string_core(
{
if (!did_echo_string_emsg)
{
- /* Only give this message once for a recursive call to avoid
- * flooding the user with errors. And stop iterating over lists
- * and dicts. */
+ // Only give this message once for a recursive call to avoid
+ // flooding the user with errors. And stop iterating over lists
+ // and dicts.
did_echo_string_emsg = TRUE;
emsg(_("E724: variable nested too deep for displaying"));
}
@@ -4612,12 +4611,12 @@ string_quote(char_u *str, int function)
int
string2float(
char_u *text,
- float_T *value) /* result stored here */
+ float_T *value) // result stored here
{
char *s = (char *)text;
float_T f;
- /* MS-Windows does not deal with "inf" and "nan" properly. */
+ // MS-Windows does not deal with "inf" and "nan" properly.
if (STRNICMP(text, "inf", 3) == 0)
{
*value = INFINITY;
@@ -4660,11 +4659,11 @@ get_env_tv(char_u **arg, typval_T *rettv, int evaluate)
if (evaluate)
{
if (len == 0)
- return FAIL; /* invalid empty name */
+ return FAIL; // invalid empty name
cc = name[len];
name[len] = NUL;
- /* first try vim_getenv(), fast for normal environment vars */
+ // first try vim_getenv(), fast for normal environment vars
string = vim_getenv(name, &mustfree);
if (string != NULL && *string != NUL)
{
@@ -4676,7 +4675,7 @@ get_env_tv(char_u **arg, typval_T *rettv, int evaluate)
if (mustfree)
vim_free(string);
- /* next try expanding things like $VIM and ${HOME} */
+ // next try expanding things like $VIM and ${HOME}
string = expand_env_save(name - 1);
if (string != NULL && *string == '$')
VIM_CLEAR(string);
@@ -4697,14 +4696,14 @@ get_env_tv(char_u **arg, typval_T *rettv, int evaluate)
pos_T *
var2fpos(
typval_T *varp,
- int dollar_lnum, /* TRUE when $ is last line */
- int *fnum) /* set to fnum for '0, 'A, etc. */
+ int dollar_lnum, // TRUE when $ is last line
+ int *fnum) // set to fnum for '0, 'A, etc.
{
char_u *name;
static pos_T pos;
pos_T *pp;
- /* Argument can be [lnum, col, coladd]. */
+ // Argument can be [lnum, col, coladd].
if (varp->v_type == VAR_LIST)
{
list_T *l;
@@ -4716,30 +4715,30 @@ var2fpos(
if (l == NULL)
return NULL;
- /* Get the line number */
+ // Get the line number
pos.lnum = list_find_nr(l, 0L, &error);
if (error || pos.lnum <= 0 || pos.lnum > curbuf->b_ml.ml_line_count)
- return NULL; /* invalid line number */
+ return NULL; // invalid line number
- /* Get the column number */
+ // Get the column number
pos.col = list_find_nr(l, 1L, &error);
if (error)
return NULL;
len = (long)STRLEN(ml_get(pos.lnum));
- /* We accept "$" for the column number: last column. */
+ // We accept "$" for the column number: last column.
li = list_find(l, 1L);
if (li != NULL && li->li_tv.v_type == VAR_STRING
&& li->li_tv.vval.v_string != NULL
&& STRCMP(li->li_tv.vval.v_string, "$") == 0)
pos.col = len + 1;
- /* Accept a position up to the NUL after the line. */
+ // Accept a position up to the NUL after the line.
if (pos.col == 0 || (int)pos.col > len + 1)
- return NULL; /* invalid column number */
+ return NULL; // invalid column number
--pos.col;
- /* Get the virtual offset. Defaults to zero. */
+ // Get the virtual offset. Defaults to zero.
pos.coladd = list_find_nr(l, 2L, &error);
if (error)
pos.coladd = 0;
@@ -4750,15 +4749,15 @@ var2fpos(
name = tv_get_string_chk(varp);
if (name == NULL)
return NULL;
- if (name[0] == '.') /* cursor */
+ if (name[0] == '.') // cursor
return &curwin->w_cursor;
- if (name[0] == 'v' && name[1] == NUL) /* Visual start */
+ if (name[0] == 'v' && name[1] == NUL) // Visual start
{
if (VIsual_active)
return &VIsual;
return &curwin->w_cursor;
}
- if (name[0] == '\'') /* mark */
+ if (name[0] == '\'') // mark
{
pp = getmark_buf_fnum(curbuf, name[1], FALSE, fnum);
if (pp == NULL || pp == (pos_T *)-1 || pp->lnum <= 0)
@@ -4771,23 +4770,23 @@ var2fpos(
if (name[0] == 'w' && dollar_lnum)
{
pos.col = 0;
- if (name[1] == '0') /* "w0": first visible line */
+ if (name[1] == '0') // "w0": first visible line
{
update_topline();
- /* In silent Ex mode topline is zero, but that's not a valid line
- * number; use one instead. */
+ // In silent Ex mode topline is zero, but that's not a valid line
+ // number; use one instead.
pos.lnum = curwin->w_topline > 0 ? curwin->w_topline : 1;
return &pos;
}
- else if (name[1] == '$') /* "w$": last visible line */
+ else if (name[1] == '$') // "w$": last visible line
{
validate_botline();
- /* In silent Ex mode botline is zero, return zero then. */
+ // In silent Ex mode botline is zero, return zero then.
pos.lnum = curwin->w_botline > 0 ? curwin->w_botline - 1 : 0;
return &pos;
}
}
- else if (name[0] == '$') /* last column or line */
+ else if (name[0] == '$') // last column or line
{
if (dollar_lnum)
{
@@ -4823,8 +4822,8 @@ list2fpos(
long i = 0;
long n;
- /* List must be: [fnum, lnum, col, coladd, curswant], where "fnum" is only
- * there when "fnump" isn't NULL; "coladd" and "curswant" are optional. */
+ // List must be: [fnum, lnum, col, coladd, curswant], where "fnum" is only
+ // there when "fnump" isn't NULL; "coladd" and "curswant" are optional.
if (arg->v_type != VAR_LIST
|| l == NULL
|| l->lv_len < (fnump == NULL ? 2 : 3)
@@ -4833,32 +4832,32 @@ list2fpos(
if (fnump != NULL)
{
- n = list_find_nr(l, i++, NULL); /* fnum */
+ n = list_find_nr(l, i++, NULL); // fnum
if (n < 0)
return FAIL;
if (n == 0)
- n = curbuf->b_fnum; /* current buffer */
+ n = curbuf->b_fnum; // current buffer
*fnump = n;
}
- n = list_find_nr(l, i++, NULL); /* lnum */
+ n = list_find_nr(l, i++, NULL); // lnum
if (n < 0)
return FAIL;
posp->lnum = n;
- n = list_find_nr(l, i++, NULL); /* col */
+ n = list_find_nr(l, i++, NULL); // col
if (n < 0)
return FAIL;
posp->col = n;
- n = list_find_nr(l, i, NULL); /* off */
+ n = list_find_nr(l, i, NULL); // off
if (n < 0)
posp->coladd = 0;
else
posp->coladd = n;
if (curswantp != NULL)
- *curswantp = list_find_nr(l, i + 1, NULL); /* curswant */
+ *curswantp = list_find_nr(l, i + 1, NULL); // curswant
return OK;
}
@@ -4876,7 +4875,7 @@ get_env_len(char_u **arg)
for (p = *arg; vim_isIDc(*p); ++p)
;
- if (p == *arg) /* no name found */
+ if (p == *arg) // no name found
return 0;
len = (int)(p - *arg);
@@ -4895,20 +4894,20 @@ get_id_len(char_u **arg)
char_u *p;
int len;
- /* Find the end of the name. */
+ // Find the end of the name.
for (p = *arg; eval_isnamec(*p); ++p)
{
if (*p == ':')
{
- /* "s:" is start of "s:var", but "n:" is not and can be used in
- * slice "[n:]". Also "xx:" is not a namespace. */
+ // "s:" is start of "s:var", but "n:" is not and can be used in
+ // slice "[n:]". Also "xx:" is not a namespace.
len = (int)(p - *arg);
if ((len == 1 && vim_strchr(NAMESPACE_CHAR, **arg) == NULL)
|| len > 1)
break;
}
}
- if (p == *arg) /* no name found */
+ if (p == *arg) // no name found
return 0;
len = (int)(p - *arg);
@@ -4938,19 +4937,19 @@ get_name_len(
char_u *expr_start;
char_u *expr_end;
- *alias = NULL; /* default to no alias */
+ *alias = NULL; // default to no alias
if ((*arg)[0] == K_SPECIAL && (*arg)[1] == KS_EXTRA
&& (*arg)[2] == (int)KE_SNR)
{
- /* hard coded <SNR>, already translated */
+ // hard coded <SNR>, already translated
*arg += 3;
return get_id_len(arg) + 3;
}
len = eval_fname_script(*arg);
if (len > 0)
{
- /* literal "<SID>", "s:" or "<SNR>" */
+ // literal "<SID>", "s:" or "<SNR>"
*arg += len;
}
@@ -5017,7 +5016,7 @@ find_name_end(
*expr_end = NULL;
}
- /* Quick check for valid starting character. */
+ // Quick check for valid starting character.
if ((flags & FNE_CHECK_START) && !eval_isnamec1(*arg) && *arg != '{')
return arg;
@@ -5030,7 +5029,7 @@ find_name_end(
{
if (*p == '\'')
{
- /* skip over 'string' to avoid counting [ and ] inside it. */
+ // skip over 'string' to avoid counting [ and ] inside it.
for (p = p + 1; *p != NUL && *p != '\''; MB_PTR_ADV(p))
;
if (*p == NUL)
@@ -5038,7 +5037,7 @@ find_name_end(
}
else if (*p == '"')
{
- /* skip over "str\"ing" to avoid counting [ and ] inside it. */
+ // skip over "str\"ing" to avoid counting [ and ] inside it.
for (p = p + 1; *p != NUL && *p != '"'; MB_PTR_ADV(p))
if (*p == '\\' && p[1] != NUL)
++p;
@@ -5047,8 +5046,8 @@ find_name_end(
}
else if (br_nest == 0 && mb_nest == 0 && *p == ':')
{
- /* "s:" is start of "s:var", but "n:" is not and can be used in
- * slice "[n:]". Also "xx:" is not a namespace. But {ns}: is. */
+ // "s:" is start of "s:var", but "n:" is not and can be used in
+ // slice "[n:]". Also "xx:" is not a namespace. But {ns}: is.
len = (int)(p - arg);
if ((len == 1 && vim_strchr(NAMESPACE_CHAR, *arg) == NULL)
|| (len > 1 && p[-1] != '}'))
@@ -5129,7 +5128,7 @@ make_expanded_name(
}
vim_free(temp_result);
- *in_end = c1; /* put char back for error messages */
+ *in_end = c1; // put char back for error messages
*expr_start = '{';
*expr_end = '}';
@@ -5138,7 +5137,7 @@ make_expanded_name(
temp_result = find_name_end(retval, &expr_start, &expr_end, 0);
if (expr_start != NULL)
{
- /* Further expansion! */
+ // Further expansion!
temp_result = make_expanded_name(retval, expr_start,
expr_end, temp_result);
vim_free(retval);
@@ -5235,7 +5234,7 @@ handle_subscript(
ret = eval_method(arg, rettv, evaluate, verbose);
}
}
- else /* **arg == '[' || **arg == '.' */
+ else // **arg == '[' || **arg == '.'
{
dict_unref(selfdict);
if (rettv->v_type == VAR_DICT)
@@ -5254,9 +5253,9 @@ handle_subscript(
}
}
- /* Turn "dict.Func" into a partial for "Func" bound to "dict".
- * Don't do this when "Func" is already a partial that was bound
- * explicitly (pt_auto is FALSE). */
+ // Turn "dict.Func" into a partial for "Func" bound to "dict".
+ // Don't do this when "Func" is already a partial that was bound
+ // explicitly (pt_auto is FALSE).
if (selfdict != NULL
&& (rettv->v_type == VAR_FUNC
|| (rettv->v_type == VAR_PARTIAL
@@ -5311,7 +5310,7 @@ free_tv(typval_T *varp)
{
case VAR_FUNC:
func_unref(varp->vval.v_string);
- /* FALLTHROUGH */
+ // FALLTHROUGH
case VAR_STRING:
vim_free(varp->vval.v_string);
break;
@@ -5359,7 +5358,7 @@ clear_tv(typval_T *varp)
{
case VAR_FUNC:
func_unref(varp->vval.v_string);
- /* FALLTHROUGH */
+ // FALLTHROUGH
case VAR_STRING:
VIM_CLEAR(varp->vval.v_string);
break;
@@ -5429,7 +5428,7 @@ tv_get_number(typval_T *varp)
{
int error = FALSE;
- return tv_get_number_chk(varp, &error); /* return 0L on error */
+ return tv_get_number_chk(varp, &error); // return 0L on error
}
varnumber_T
@@ -5481,7 +5480,7 @@ tv_get_number_chk(typval_T *varp, int *denote)
internal_error("tv_get_number(UNKNOWN)");
break;
}
- if (denote == NULL) /* useful for values that must be unsigned */
+ if (denote == NULL) // useful for values that must be unsigned
n = -1;
else
*denote = TRUE;
@@ -5626,7 +5625,7 @@ tv_get_string_buf_chk(typval_T *varp, char_u *buf)
(long)job->jv_proc_info.dwProcessId,
status);
# else
- /* fall-back */
+ // fall-back
vim_snprintf((char *)buf, NUMBUFLEN, "process ? %s", status);
# endif
return buf;
@@ -5843,7 +5842,7 @@ item_copy(
to->vval.v_list = NULL;
else if (copyID != 0 && from->vval.v_list->lv_copyID == copyID)
{
- /* use the copy made earlier */
+ // use the copy made earlier
to->vval.v_list = from->vval.v_list->lv_copylist;
++to->vval.v_list->lv_refcount;
}
@@ -5862,7 +5861,7 @@ item_copy(
to->vval.v_dict = NULL;
else if (copyID != 0 && from->vval.v_dict->dv_copyID == copyID)
{
- /* use the copy made earlier */
+ // use the copy made earlier
to->vval.v_dict = from->vval.v_dict->dv_copydict;
++to->vval.v_dict->dv_refcount;
}
@@ -5901,8 +5900,8 @@ ex_echo(exarg_T *eap)
++emsg_skip;
while (*arg != NUL && *arg != '|' && *arg != '\n' && !got_int)
{
- /* If eval1() causes an error message the text from the command may
- * still need to be cleared. E.g., "echo 22,44". */
+ // If eval1() causes an error message the text from the command may
+ // still need to be cleared. E.g., "echo 22,44".
need_clr_eos = needclr;
p = arg;
@@ -5926,13 +5925,13 @@ ex_echo(exarg_T *eap)
if (atstart)
{
atstart = FALSE;
- /* Call msg_start() after eval1(), evaluating the expression
- * may cause a message to appear. */
+ // Call msg_start() after eval1(), evaluating the expression
+ // may cause a message to appear.
if (eap->cmdidx == CMD_echo)
{
- /* Mark the saved text as finishing the line, so that what
- * follows is displayed on a new line when scrolling back
- * at the more prompt. */
+ // Mark the saved text as finishing the line, so that what
+ // follows is displayed on a new line when scrolling back
+ // at the more prompt.
msg_sb_eol();
msg_start();
}
@@ -5947,7 +5946,7 @@ ex_echo(exarg_T *eap)
{
if (*p != TAB && needclr)
{
- /* remove any text still there from the command */
+ // remove any text still there from the command
msg_clr_eos();
needclr = FALSE;
}
@@ -5977,7 +5976,7 @@ ex_echo(exarg_T *eap)
--emsg_skip;
else
{
- /* remove text that may still be there from the command */
+ // remove text that may still be there from the command
if (needclr)
msg_clr_eos();
if (eap->cmdidx == CMD_echo)
@@ -6060,9 +6059,9 @@ ex_execute(exarg_T *eap)
{
if (eap->cmdidx == CMD_echomsg || eap->cmdidx == CMD_echoerr)
{
- /* Mark the already saved text as finishing the line, so that what
- * follows is displayed on a new line when scrolling back at the
- * more prompt. */
+ // Mark the already saved text as finishing the line, so that what
+ // follows is displayed on a new line when scrolling back at the
+ // more prompt.
msg_sb_eol();
}
@@ -6073,7 +6072,7 @@ ex_execute(exarg_T *eap)
}
else if (eap->cmdidx == CMD_echoerr)
{
- /* We don't want to abort following commands, restore did_emsg. */
+ // We don't want to abort following commands, restore did_emsg.
save_did_emsg = did_emsg;
emsg(ga.ga_data);
if (!force_abort)
@@ -6122,7 +6121,7 @@ find_option_end(char_u **arg, int *opt_flags)
*arg = p;
if (p[0] == 't' && p[1] == '_' && p[2] != NUL && p[3] != NUL)
- p += 4; /* termcap option */
+ p += 4; // termcap option
else
while (ASCII_ISALPHA(*p))
++p;
@@ -6162,11 +6161,11 @@ last_set_msg(sctx_T script_ctx)
*/
int
typval_compare(
- typval_T *typ1, /* first operand */
- typval_T *typ2, /* second operand */
- exptype_T type, /* operator */
- int type_is, /* TRUE for "is" and "isnot" */
- int ic) /* ignore case */
+ typval_T *typ1, // first operand
+ typval_T *typ2, // second operand
+ exptype_T type, // operator
+ int type_is, // TRUE for "is" and "isnot"
+ int ic) // ignore case
{
int i;
varnumber_T n1, n2;
@@ -6175,8 +6174,8 @@ typval_compare(
if (type_is && typ1->v_type != typ2->v_type)
{
- /* For "is" a different type always means FALSE, for "notis"
- * it means TRUE. */
+ // For "is" a different type always means FALSE, for "notis"
+ // it means TRUE.
n1 = (type == TYPE_NEQUAL);
}
else if (typ1->v_type == VAR_BLOB || typ2->v_type == VAR_BLOB)
@@ -6227,7 +6226,7 @@ typval_compare(
}
else
{
- /* Compare two Lists for being equal or unequal. */
+ // Compare two Lists for being equal or unequal.
n1 = list_equal(typ1->vval.v_list, typ2->vval.v_list,
ic, FALSE);
if (type == TYPE_NEQUAL)
@@ -6256,7 +6255,7 @@ typval_compare(
}
else
{
- /* Compare two Dictionaries for being equal or unequal. */
+ // Compare two Dictionaries for being equal or unequal.
n1 = dict_equal(typ1->vval.v_dict, typ2->vval.v_dict,
ic, FALSE);
if (type == TYPE_NEQUAL)
@@ -6277,13 +6276,13 @@ typval_compare(
&& typ1->vval.v_partial == NULL)
|| (typ2->v_type == VAR_PARTIAL
&& typ2->vval.v_partial == NULL))
- /* when a partial is NULL assume not equal */
+ // when a partial is NULL assume not equal
n1 = FALSE;
else if (type_is)
{
if (typ1->v_type == VAR_FUNC && typ2->v_type == VAR_FUNC)
- /* strings are considered the same if their value is
- * the same */
+ // strings are considered the same if their value is
+ // the same
n1 = tv_equal(typ1, typ2, ic, FALSE);
else if (typ1->v_type == VAR_PARTIAL
&& typ2->v_type == VAR_PARTIAL)
@@ -6320,7 +6319,7 @@ typval_compare(
case TYPE_SEQUAL: n1 = (f1 <= f2); break;
case TYPE_UNKNOWN:
case TYPE_MATCH:
- case TYPE_NOMATCH: break; /* avoid gcc warning */
+ case TYPE_NOMATCH: break; // avoid gcc warning
}
}
#endif
@@ -6344,7 +6343,7 @@ typval_compare(
case TYPE_SEQUAL: n1 = (n1 <= n2); break;
case TYPE_UNKNOWN:
case TYPE_MATCH:
- case TYPE_NOMATCH: break; /* avoid gcc warning */
+ case TYPE_NOMATCH: break; // avoid gcc warning
}
}
else
@@ -6372,7 +6371,7 @@ typval_compare(
n1 = !n1;
break;
- case TYPE_UNKNOWN: break; /* avoid gcc warning */
+ case TYPE_UNKNOWN: break; // avoid gcc warning
}
}
clear_tv(typ1);
@@ -6392,7 +6391,7 @@ typval_tostring(typval_T *arg)
if (arg == NULL)
return vim_strsave((char_u *)"(does not exist)");
ret = tv2string(arg, &tofree, numbuf, 0);
- /* Make a copy if we have a value but it's not in allocated memory. */
+ // Make a copy if we have a value but it's not in allocated memory.
if (ret != NULL && tofree == NULL)
ret = vim_strsave(ret);
return ret;
@@ -6425,7 +6424,7 @@ do_string_sub(
char_u *save_cpo;
char_u *zero_width = NULL;
- /* Make 'cpoptions' empty, so that the 'l' flag doesn't work here */
+ // Make 'cpoptions' empty, so that the 'l' flag doesn't work here
save_cpo = p_cpo;
p_cpo = empty_option;
@@ -6441,12 +6440,12 @@ do_string_sub(
end = str + STRLEN(str);
while (vim_regexec_nl(&regmatch, str, (colnr_T)(tail - str)))
{
- /* Skip empty match except for first match. */
+ // Skip empty match except for first match.
if (regmatch.startp[0] == regmatch.endp[0])
{
if (zero_width == regmatch.startp[0])
{
- /* avoid getting stuck on a match with an empty string */
+ // avoid getting stuck on a match with an empty string
i = mb_ptr2len(tail);
mch_memmove((char_u *)ga.ga_data + ga.ga_len, tail,
(size_t)i);
@@ -6472,10 +6471,10 @@ do_string_sub(
break;
}
- /* copy the text up to where the match is */
+ // copy the text up to where the match is
i = (int)(regmatch.startp[0] - tail);
mch_memmove((char_u *)ga.ga_data + ga.ga_len, tail, (size_t)i);
- /* add the substituted text */
+ // add the substituted text
(void)vim_regsub(&regmatch, sub, expr, (char_u *)ga.ga_data
+ ga.ga_len + i, TRUE, TRUE, FALSE);
ga.ga_len += i + sublen - 1;
@@ -6497,7 +6496,7 @@ do_string_sub(
if (p_cpo == empty_option)
p_cpo = save_cpo;
else
- /* Darn, evaluating {sub} expression or {expr} changed the value. */
+ // Darn, evaluating {sub} expression or {expr} changed the value.
free_string_option(save_cpo);
return ret;
diff --git a/src/evalbuffer.c b/src/evalbuffer.c
index 00185b108..a475165f4 100644
--- a/src/evalbuffer.c
+++ b/src/evalbuffer.c
@@ -825,7 +825,7 @@ switch_buffer(bufref_T *save_curbuf, buf_T *buf)
restore_buffer(bufref_T *save_curbuf)
{
unblock_autocmds();
- /* Check for valid buffer, just in case. */
+ // Check for valid buffer, just in case.
if (bufref_valid(save_curbuf))
{
--curbuf->b_nwindows;
diff --git a/src/evalfunc.c b/src/evalfunc.c
index f6ea57c63..892a7538f 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -1290,7 +1290,7 @@ f_balloon_split(typval_T *argvars, typval_T *rettv UNUSED)
int size = split_message(msg, &array);
int i;
- /* Skip the first and last item, they are always empty. */
+ // Skip the first and last item, they are always empty.
for (i = 1; i < size - 1; ++i)
list_append_string(rettv->vval.v_list, array[i].pum_text, -1);
while (size > 0)
@@ -1322,7 +1322,7 @@ tv_get_buf(typval_T *tv, int curtab_only)
buf = buflist_find_by_name(name, curtab_only);
- /* If not found, try expanding the name, like done for bufexists(). */
+ // If not found, try expanding the name, like done for bufexists().
if (buf == NULL)
buf = find_buffer(tv);
@@ -1357,7 +1357,7 @@ f_byte2line(typval_T *argvars UNUSED, typval_T *rettv)
#else
long boff = 0;
- boff = tv_get_number(&argvars[0]) - 1; /* boff gets -1 on type error */
+ boff = tv_get_number(&argvars[0]) - 1; // boff gets -1 on type error
if (boff < 0)
rettv->vval.v_number = -1;
else
@@ -1382,7 +1382,7 @@ byteidx(typval_T *argvars, typval_T *rettv, int comp UNUSED)
t = str;
for ( ; idx > 0; idx--)
{
- if (*t == NUL) /* EOL reached */
+ if (*t == NUL) // EOL reached
return;
if (enc_utf8 && comp)
t += utf_ptr2len(t);
@@ -1438,7 +1438,7 @@ f_call(typval_T *argvars, typval_T *rettv)
else
func = tv_get_string(&argvars[0]);
if (*func == NUL)
- return; /* type error or empty name */
+ return; // type error or empty name
if (argvars[2].v_type != VAR_UNKNOWN)
{
@@ -1533,7 +1533,7 @@ f_col(typval_T *argvars, typval_T *rettv)
{
if (fp->col == MAXCOL)
{
- /* '> can be MAXCOL, get the length of the line then */
+ // '> can be MAXCOL, get the length of the line then
if (fp->lnum <= curbuf->b_ml.ml_line_count)
col = (colnr_T)STRLEN(ml_get(fp->lnum)) + 1;
else
@@ -1542,8 +1542,8 @@ f_col(typval_T *argvars, typval_T *rettv)
else
{
col = fp->col + 1;
- /* col(".") when the cursor is on the NUL at the end of the line
- * because of "coladd" can be seen as an extra column. */
+ // col(".") when the cursor is on the NUL at the end of the line
+ // because of "coladd" can be seen as an extra column.
if (virtual_active() && fp == &curwin->w_cursor)
{
char_u *p = ml_get_cursor();
@@ -1701,16 +1701,16 @@ f_cursor(typval_T *argvars, typval_T *rettv)
coladd = (long)tv_get_number_chk(&argvars[2], NULL);
}
if (line < 0 || col < 0 || coladd < 0)
- return; /* type error; errmsg already given */
+ return; // type error; errmsg already given
if (line > 0)
curwin->w_cursor.lnum = line;
if (col > 0)
curwin->w_cursor.col = col - 1;
curwin->w_cursor.coladd = coladd;
- /* Make sure the cursor is in a valid position. */
+ // Make sure the cursor is in a valid position.
check_cursor();
- /* Correct cursor for multi-byte character. */
+ // Correct cursor for multi-byte character.
if (has_mbyte)
mb_adjust_cursor();
@@ -1949,9 +1949,9 @@ execute_redir_str(char_u *value, int value_len)
int len;
if (value_len == -1)
- len = (int)STRLEN(value); /* Append the entire string */
+ len = (int)STRLEN(value); // Append the entire string
else
- len = value_len; /* Append only "value_len" characters */
+ len = value_len; // Append only "value_len" characters
if (ga_grow(&redir_execute_ga, len) == OK)
{
mch_memmove((char *)redir_execute_ga.ga_data
@@ -2009,7 +2009,7 @@ execute_common(typval_T *argvars, typval_T *rettv, int arg_off)
{
list = argvars[arg_off].vval.v_list;
if (list == NULL || list->lv_first == NULL)
- /* empty list, no commands, empty output */
+ // empty list, no commands, empty output
return;
++list->lv_refcount;
}
@@ -2059,7 +2059,7 @@ execute_common(typval_T *argvars, typval_T *rettv, int arg_off)
--list->lv_refcount;
}
- /* Need to append a NUL to the result. */
+ // Need to append a NUL to the result.
if (ga_grow(&redir_execute_ga, 1) == OK)
{
((char *)redir_execute_ga.ga_data)[redir_execute_ga.ga_len] = NUL;
@@ -2109,27 +2109,27 @@ f_exists(typval_T *argvars, typval_T *rettv)
int n = FALSE;
p = tv_get_string(&argvars[0]);
- if (*p == '$') /* environment variable */
+ if (*p == '$') // environment variable
{
- /* first try "normal" environment variables (fast) */
+ // first try "normal" environment variables (fast)
if (mch_getenv(p + 1) != NULL)
n = TRUE;
else
{
- /* try expanding things like $VIM and ${HOME} */
+ // try expanding things like $VIM and ${HOME}
p = expand_env_save(p);
if (p != NULL && *p != '$')
n = TRUE;
vim_free(p);
}
}
- else if (*p == '&' || *p == '+') /* option */
+ else if (*p == '&' || *p == '+') // option
{
n = (get_option_tv(&p, NULL, TRUE) == OK);
if (*skipwhite(p) != NUL)
- n = FALSE; /* trailing garbage */
+ n = FALSE; // trailing garbage
}
- else if (*p == '*') /* internal or user defined function */
+ else if (*p == '*') // internal or user defined function
{
n = function_exists(p + 1, FALSE);
}
@@ -2144,7 +2144,7 @@ f_exists(typval_T *argvars, typval_T *rettv)
else
n = au_exists(p + 1);
}
- else /* internal variable */
+ else // internal variable
{
n = var_exists(p);
}
@@ -2207,8 +2207,8 @@ f_expand(typval_T *argvars, typval_T *rettv)
}
else
{
- /* When the optional second argument is non-zero, don't remove matches
- * for 'wildignore' and don't put matches for 'suffixes' at the end. */
+ // When the optional second argument is non-zero, don't remove matches
+ // for 'wildignore' and don't put matches for 'suffixes' at the end.
if (argvars[1].v_type != VAR_UNKNOWN
&& tv_get_number_chk(&argvars[1], &error))
options |= WILD_KEEP_ALL;
@@ -2281,9 +2281,9 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED)
int lowlevel = FALSE;
char_u *keys_esc;
- /* This is not allowed in the sandbox. If the commands would still be
- * executed in the sandbox it would be OK, but it probably happens later,
- * when "sandbox" is no longer set. */
+ // This is not allowed in the sandbox. If the commands would still be
+ // executed in the sandbox it would be OK, but it probably happens later,
+ // when "sandbox" is no longer set.
if (check_secure())
return;
@@ -2309,8 +2309,8 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED)
if (*keys != NUL || execute)
{
- /* Need to escape K_SPECIAL and CSI before putting the string in the
- * typeahead buffer. */
+ // Need to escape K_SPECIAL and CSI before putting the string in the
+ // typeahead buffer.
keys_esc = vim_strsave_escape_csi(keys);
if (keys_esc != NULL)
{
@@ -2339,7 +2339,7 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED)
{
int save_msg_scroll = msg_scroll;
- /* Avoid a 1 second delay when the keys start Insert mode. */
+ // Avoid a 1 second delay when the keys start Insert mode.
msg_scroll = FALSE;
if (!dangerous)
@@ -2446,19 +2446,19 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
if (argvars[0].v_type == VAR_FUNC)
{
- /* function(MyFunc, [arg], dict) */
+ // function(MyFunc, [arg], dict)
s = argvars[0].vval.v_string;
}
else if (argvars[0].v_type == VAR_PARTIAL
&& argvars[0].vval.v_partial != NULL)
{
- /* function(dict.MyFunc, [arg]) */
+ // function(dict.MyFunc, [arg])
arg_pt = argvars[0].vval.v_partial;
s = partial_name(arg_pt);
}
else
{
- /* function('MyFunc', [arg], dict) */
+ // function('MyFunc', [arg], dict)
s = tv_get_string(&argvars[0]);
use_string = TRUE;
}
@@ -2475,7 +2475,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s))
|| (is_funcref && trans_name == NULL))
semsg(_(e_invarg2), use_string ? tv_get_string(&argvars[0]) : s);
- /* Don't check an autoload name for existence here. */
+ // Don't check an autoload name for existence here.
else if (trans_name != NULL && (is_funcref
? find_func(trans_name) == NULL
: !translated_function_exists(trans_name)))
@@ -2491,10 +2491,10 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
char sid_buf[25];
int off = *s == 's' ? 2 : 5;
- /* Expand s: and <SID> into <SNR>nr_, so that the function can
- * also be called from another script. Using trans_function_name()
- * would also work, but some plugins depend on the name being
- * printable text. */
+ // Expand s: and <SID> into <SNR>nr_, so that the function can
+ // also be called from another script. Using trans_function_name()
+ // would also work, but some plugins depend on the name being
+ // printable text.
sprintf(sid_buf, "<SNR>%ld_", (long)current_sctx.sc_sid);
name = alloc(STRLEN(sid_buf) + STRLEN(s + off) + 1);
if (name != NULL)
@@ -2510,15 +2510,15 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
{
if (argvars[2].v_type != VAR_UNKNOWN)
{
- /* function(name, [args], dict) */
+ // function(name, [args], dict)
arg_idx = 1;
dict_idx = 2;
}
else if (argvars[1].v_type == VAR_DICT)
- /* function(name, dict) */
+ // function(name, dict)
dict_idx = 1;
else
- /* function(name, [args]) */
+ // function(name, [args])
arg_idx = 1;
if (dict_idx > 0)
{
@@ -2554,7 +2554,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
{
partial_T *pt = ALLOC_CLEAR_ONE(partial_T);
- /* result is a VAR_PARTIAL */
+ // result is a VAR_PARTIAL
if (pt == NULL)
vim_free(name);
else
@@ -2586,18 +2586,18 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
copy_tv(&li->li_tv, &pt->pt_argv[i++]);
}
- /* For "function(dict.func, [], dict)" and "func" is a partial
- * use "dict". That is backwards compatible. */
+ // For "function(dict.func, [], dict)" and "func" is a partial
+ // use "dict". That is backwards compatible.
if (dict_idx > 0)
{
- /* The dict is bound explicitly, pt_auto is FALSE. */
+ // The dict is bound explicitly, pt_auto is FALSE.
pt->pt_dict = argvars[dict_idx].vval.v_dict;
++pt->pt_dict->dv_refcount;
}
else if (arg_pt != NULL)
{
- /* If the dict was bound automatically the result is also
- * bound automatically. */
+ // If the dict was bound automatically the result is also
+ // bound automatically.
pt->pt_dict = arg_pt->pt_dict;
pt->pt_auto = arg_pt->pt_auto;
if (pt->pt_dict != NULL)
@@ -2628,7 +2628,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref)
}
else
{
- /* result is a VAR_FUNC */
+ // result is a VAR_FUNC
rettv->v_type = VAR_FUNC;
rettv->vval.v_string = name;
func_ref(name);
@@ -2662,8 +2662,8 @@ f_function(typval_T *argvars, typval_T *rettv)
static void
f_garbagecollect(typval_T *argvars, typval_T *rettv UNUSED)
{
- /* This is postponed until we are back at the toplevel, because we may be
- * using Lists and Dicts internally. E.g.: ":echo [garbagecollect()]". */
+ // This is postponed until we are back at the toplevel, because we may be
+ // using Lists and Dicts internally. E.g.: ":echo [garbagecollect()]".
want_garbage_collect = TRUE;
if (argvars[0].v_type != VAR_UNKNOWN && tv_get_number(&argvars[0]) == 1)
@@ -2922,19 +2922,19 @@ f_getfontname(typval_T *argvars UNUSED, typval_T *rettv)
if (argvars[0].v_type == VAR_UNKNOWN)
{
- /* Get the "Normal" font. Either the name saved by
- * hl_set_font_name() or from the font ID. */
+ // Get the "Normal" font. Either the name saved by
+ // hl_set_font_name() or from the font ID.
font = gui.norm_font;
name = hl_get_font_name();
}
else
{
name = tv_get_string(&argvars[0]);
- if (STRCMP(name, "*") == 0) /* don't use font dialog */
+ if (STRCMP(name, "*") == 0) // don't use font dialog
return;
font = gui_mch_get_font(name, FALSE);
if (font == NOFONT)
- return; /* Invalid font name, return empty string. */
+ return; // Invalid font name, return empty string.
}
rettv->vval.v_string = gui_mch_get_fontname(font, name);
if (argvars[0].v_type != VAR_UNKNOWN)
@@ -3137,7 +3137,7 @@ f_getregtype(typval_T *argvars, typval_T *rettv)
if (argvars[0].v_type != VAR_UNKNOWN)
{
strregname = tv_get_string_chk(&argvars[0]);
- if (strregname == NULL) /* type error; errmsg already given */
+ if (strregname == NULL) // type error; errmsg already given
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
@@ -3145,7 +3145,7 @@ f_getregtype(typval_T *argvars, typval_T *rettv)
}
}
else
- /* Default to v:register */
+ // Default to v:register
strregname = get_vim_var_str(VV_REG);
regname = (strregname == NULL ? '"' : *strregname);
@@ -3188,7 +3188,7 @@ f_gettagstack(typval_T *argvars, typval_T *rettv)
get_tagstack(wp, rettv->vval.v_dict);
}
-/* for VIM_VERSION_ defines */
+// for VIM_VERSION_ defines
#include "version.h"
/*
@@ -3221,11 +3221,11 @@ f_has(typval_T *argvars, typval_T *rettv)
"linux",
#endif
#ifdef MACOS_X
- "mac", /* Mac OS X (and, once, Mac OS Classic) */
- "osx", /* Mac OS X */
+ "mac", // Mac OS X (and, once, Mac OS Classic)
+ "osx", // Mac OS X
# ifdef MACOS_X_DARWIN
- "macunix", /* Mac OS X, with the darwin feature */
- "osxdarwin", /* synonym for macunix */
+ "macunix", // Mac OS X, with the darwin feature
+ "osxdarwin", // synonym for macunix
# endif
#endif
#ifdef __QNX__
@@ -3272,7 +3272,7 @@ f_has(typval_T *argvars, typval_T *rettv)
#endif
#ifdef FEAT_BEVAL_GUI
"balloon_eval",
-# ifndef FEAT_GUI_MSWIN /* other GUIs always have multiline balloons */
+# ifndef FEAT_GUI_MSWIN // other GUIs always have multiline balloons
"balloon_multiline",
# endif
#endif
@@ -3347,8 +3347,8 @@ f_has(typval_T *argvars, typval_T *rettv)
#ifdef FEAT_EMACS_TAGS
"emacs_tags",
#endif
- "eval", /* always present, of course! */
- "ex_extra", /* graduated feature */
+ "eval", // always present, of course!
+ "ex_extra", // graduated feature
#ifdef FEAT_SEARCH_EXTRA
"extra_search",
#endif
@@ -3422,7 +3422,7 @@ f_has(typval_T *argvars, typval_T *rettv)
#ifdef FEAT_KEYMAP
"keymap",
#endif
- "lambda", /* always with FEAT_EVAL, since 7.4.2120 with closure */
+ "lambda", // always with FEAT_EVAL, since 7.4.2120 with closure
#ifdef FEAT_LANGMAP
"langmap",
#endif
@@ -3629,7 +3629,7 @@ f_has(typval_T *argvars, typval_T *rettv)
#if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
"unnamedplus",
#endif
- "user-commands", /* was accidentally included in 5.4 */
+ "user-commands", // was accidentally included in 5.4
"user_commands",
#ifdef FEAT_VARTABS
"vartabs",
@@ -3670,7 +3670,7 @@ f_has(typval_T *argvars, typval_T *rettv)
#endif
#ifdef FEAT_XPM_W32
"xpm",
- "xpm_w32", /* for backward compatibility */
+ "xpm_w32", // for backward compatibility
#else
# if defined(HAVE_XPM)
"xpm",
@@ -3715,7 +3715,7 @@ f_has(typval_T *argvars, typval_T *rettv)
int major = atoi((char *)name + 6);
int minor = atoi((char *)name + 8);
- /* Expect "patch-9.9.01234". */
+ // Expect "patch-9.9.01234".
n = (major < VIM_VERSION_MAJOR
|| (major == VIM_VERSION_MAJOR
&& (minor < VIM_VERSION_MINOR
@@ -3791,7 +3791,7 @@ f_has(typval_T *argvars, typval_T *rettv)
n = (gui.in_use || gui.starting);
# ifdef FEAT_BROWSE
else if (STRICMP(name, "browse") == 0)
- n = gui.in_use; /* gui_mch_browse() works when GUI is running */
+ n = gui.in_use; // gui_mch_browse() works when GUI is running
# endif
#endif
#ifdef FEAT_SYN_HL
@@ -3929,7 +3929,7 @@ f_iconv(typval_T *argvars UNUSED, typval_T *rettv)
vimconv.vc_type = CONV_NONE;
convert_setup(&vimconv, from, to);
- /* If the encodings are equal, no conversion needed. */
+ // If the encodings are equal, no conversion needed.
if (vimconv.vc_type == CONV_NONE)
rettv->vval.v_string = vim_strsave(str);
else
@@ -3999,8 +3999,8 @@ f_index(typval_T *argvars, typval_T *rettv)
item = l->lv_first;
if (argvars[2].v_type != VAR_UNKNOWN)
{
- /* Start at specified item. Use the cached index that list_find()
- * sets, so that a negative number also works. */
+ // Start at specified item. Use the cached index that list_find()
+ // sets, so that a negative number also works.
item = list_find(l, (long)tv_get_number_chk(&argvars[2], &error));
idx = l->lv_idx;
if (argvars[3].v_type != VAR_UNKNOWN)
@@ -4037,7 +4037,7 @@ f_input(typval_T *argvars, typval_T *rettv)
f_inputdialog(typval_T *argvars, typval_T *rettv)
{
#if defined(FEAT_GUI_TEXTDIALOG)
- /* Use a GUI dialog if the GUI is running and 'c' is not in 'guioptions' */
+ // Use a GUI dialog if the GUI is running and 'c' is not in 'guioptions'
if (gui.in_use && vim_strchr(p_go, GO_CONDIALOG) == NULL)
{
char_u *message;
@@ -4082,8 +4082,8 @@ f_inputlist(typval_T *argvars, typval_T *rettv)
int mouse_used;
#ifdef NO_CONSOLE_INPUT
- /* While starting up, there is no place to enter text. When running tests
- * with --not-a-term we assume feedkeys() will be used. */
+ // While starting up, there is no place to enter text. When running tests
+ // with --not-a-term we assume feedkeys() will be used.
if (no_console_input() && !is_not_a_term())
return;
#endif
@@ -4094,8 +4094,8 @@ f_inputlist(typval_T *argvars, typval_T *rettv)
}
msg_start();
- msg_row = Rows - 1; /* for when 'cmdheight' > 1 */
- lines_left = Rows; /* avoid more prompt */
+ msg_row = Rows - 1; // for when 'cmdheight' > 1
+ lines_left = Rows; // avoid more prompt
msg_scroll = TRUE;
msg_clr_eos();
@@ -4105,7 +4105,7 @@ f_inputlist(typval_T *argvars, typval_T *rettv)
msg_putchar('\n');
}
- /* Ask for choice. */
+ // Ask for choice.
selected = prompt_for_number(&mouse_used);
if (mouse_used)
selected -= lines_left;
@@ -4126,12 +4126,12 @@ f_inputrestore(typval_T *argvars UNUSED, typval_T *rettv)
--ga_userinput.ga_len;
restore_typeahead((tasave_T *)(ga_userinput.ga_data)
+ ga_userinput.ga_len);
- /* default return is zero == OK */
+ // default return is zero == OK
}
else if (p_verbose > 1)
{
verb_msg(_("called inputrestore() more often than inputsave()"));
- rettv->vval.v_number = 1; /* Failed */
+ rettv->vval.v_number = 1; // Failed
}
}
@@ -4141,16 +4141,16 @@ f_inputrestore(typval_T *argvars UNUSED, typval_T *rettv)
static void
f_inputsave(typval_T *argvars UNUSED, typval_T *rettv)
{
- /* Add an entry to the stack of typeahead storage. */
+ // Add an entry to the stack of typeahead storage.
if (ga_grow(&ga_userinput, 1) == OK)
{
save_typeahead((tasave_T *)(ga_userinput.ga_data)
+ ga_userinput.ga_len);
++ga_userinput.ga_len;
- /* default return is zero == OK */
+ // default return is zero == OK
}
else
- rettv->vval.v_number = 1; /* Failed */
+ rettv->vval.v_number = 1; // Failed
}
/*
@@ -4224,11 +4224,10 @@ f_islocked(typval_T *argvars, typval_T *rettv)
di = find_var(lv.ll_name, NULL, TRUE);
if (di != NULL)
{
- /* Consider a variable locked when:
- * 1. the variable itself is locked
- * 2. the value of the variable is locked.
- * 3. the List or Dict value is locked.
- */
+ // Consider a variable locked when:
+ // 1. the variable itself is locked
+ // 2. the value of the variable is locked.
+ // 3. the List or Dict value is locked.
rettv->vval.v_number = ((di->di_flags & DI_FLAGS_LOCK)
|| tv_islocked(&di->di_tv));
}
@@ -4238,10 +4237,10 @@ f_islocked(typval_T *argvars, typval_T *rettv)
else if (lv.ll_newkey != NULL)
semsg(_(e_dictkey), lv.ll_newkey);
else if (lv.ll_list != NULL)
- /* List item. */
+ // List item.
rettv->vval.v_number = tv_islocked(&lv.ll_li->li_tv);
else
- /* Dictionary item. */
+ // Dictionary item.
rettv->vval.v_number = tv_islocked(&lv.ll_di->di_tv);
}
}
@@ -4338,7 +4337,7 @@ libcall_common(typval_T *argvars UNUSED, typval_T *rettv, int type)
return;
#ifdef FEAT_LIBCALL
- /* The first two args must be strings, otherwise it's meaningless */
+ // The first two args must be strings, otherwise it's meaningless
if (argvars[0].v_type == VAR_STRING && argvars[1].v_type == VAR_STRING)
{
string_in = NULL;
@@ -4518,11 +4517,11 @@ f_mapcheck(typval_T *argvars, typval_T *rettv)
typedef enum
{
- MATCH_END, /* matchend() */
- MATCH_MATCH, /* match() */
- MATCH_STR, /* matchstr() */
- MATCH_LIST, /* matchlist() */
- MATCH_POS /* matchstrpos() */
+ MATCH_END, // matchend()
+ MATCH_MATCH, // match()
+ MATCH_STR, // matchstr()
+ MATCH_LIST, // matchlist()
+ MATCH_POS // matchstrpos()
} matchtype_T;
static void
@@ -4545,15 +4544,15 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type)
long idx = 0;
char_u *tofree = NULL;
- /* Make 'cpoptions' empty, the 'l' flag should not be used here. */
+ // Make 'cpoptions' empty, the 'l' flag should not be used here.
save_cpo = p_cpo;
p_cpo = (char_u *)"";
rettv->vval.v_number = -1;
if (type == MATCH_LIST || type == MATCH_POS)
{
- /* type MATCH_LIST: return empty list when there are no matches.
- * type MATCH_POS: return ["", -1, -1, -1] */
+ // type MATCH_LIST: return empty list when there are no matches.
+ // type MATCH_POS: return ["", -1, -1, -1]
if (rettv_list_alloc(rettv) == FAIL)
goto theend;
if (type == MATCH_POS
@@ -4605,7 +4604,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type)
li = list_find(l, start);
if (li == NULL)
goto theend;
- idx = l->lv_idx; /* use the cached index */
+ idx = l->lv_idx; // use the cached index
}
else
{
@@ -4613,9 +4612,9 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type)
start = 0;
if (start > len)
goto theend;
- /* When "count" argument is there ignore matches before "start",
- * otherwise skip part of the string. Differs when pattern is "^"
- * or "\<". */
+ // When "count" argument is there ignore matches before "start",
+ // otherwise skip part of the string. Differs when pattern is "^"
+ // or "\<".
if (argvars[3].v_type != VAR_UNKNOWN)
startcol = start;
else
@@ -4658,7 +4657,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type)
if (l == NULL && !match)
break;
- /* Advance to just after the match. */
+ // Advance to just after the match.
if (l != NULL)
{
li = li->li_next;
@@ -4700,7 +4699,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type)
{
int i;
- /* return list with matched string and submatches */
+ // return list with matched string and submatches
for (i = 0; i < NSUBEXP; ++i)
{
if (regmatch.endp[i] == NULL)
@@ -4718,7 +4717,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type)
}
else if (type == MATCH_STR)
{
- /* return matched string */
+ // return matched string
if (l != NULL)
copy_tv(&li->li_tv, rettv);
else
@@ -4743,7 +4742,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type)
theend:
if (type == MATCH_POS && l == NULL && rettv->vval.v_list != NULL)
- /* matchstrpos() without a list: drop the second item. */
+ // matchstrpos() without a list: drop the second item.
listitem_remove(rettv->vval.v_list,
rettv->vval.v_list->lv_first->li_next);
vim_free(tofree);
@@ -5016,10 +5015,10 @@ f_prevnonblank(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = lnum;
}
-/* This dummy va_list is here because:
- * - passing a NULL pointer doesn't work when va_list isn't a pointer
- * - locally in the function results in a "used before set" warning
- * - using va_start() to initialize it gives "function with fixed args" error */
+// This dummy va_list is here because:
+// - passing a NULL pointer doesn't work when va_list isn't a pointer
+// - locally in the function results in a "used before set" warning
+// - using va_start() to initialize it gives "function with fixed args" error
static va_list ap;
/*
@@ -5037,7 +5036,7 @@ f_printf(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
- /* Get the required length, allocate the buffer and do it for real. */
+ // Get the required length, allocate the buffer and do it for real.
did_emsg = FALSE;
fmt = (char *)tv_get_string_buf(&argvars[0], buf);
len = vim_vsnprintf_typval(NULL, 0, fmt, ap, argvars + 1);
@@ -5244,7 +5243,7 @@ f_range(typval_T *argvars, typval_T *rettv)
}
if (error)
- return; /* type error; errmsg already given */
+ return; // type error; errmsg already given
if (stride == 0)
emsg(_("E726: Stride is zero"));
else if (stride > 0 ? end + 1 < start : end - 1 > start)
@@ -5312,7 +5311,7 @@ list2proftime(typval_T *arg, proftime_T *tm)
# endif
return error ? FAIL : OK;
}
-#endif /* FEAT_RELTIME */
+#endif // FEAT_RELTIME
/*
* "reltime()" function
@@ -5326,7 +5325,7 @@ f_reltime(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
if (argvars[0].v_type == VAR_UNKNOWN)
{
- /* No arguments: get current time. */
+ // No arguments: get current time.
profile_start(&res);
}
else if (argvars[1].v_type == VAR_UNKNOWN)
@@ -5337,7 +5336,7 @@ f_reltime(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
}
else
{
- /* Two arguments: compute the difference. */
+ // Two arguments: compute the difference.
if (list2proftime(&argvars[0], &start) == FAIL
|| list2proftime(&argvars[1], &res) == FAIL)
return;
@@ -5456,7 +5455,7 @@ remote_common(typval_T *argvars, typval_T *rettv, int expr)
server_name = tv_get_string_chk(&argvars[0]);
if (server_name == NULL)
- return; /* type error; errmsg already given */
+ return; // type error; errmsg already given
keys = tv_get_string_buf(&argvars[1], buf);
# ifdef MSWIN
if (serverSendToVim(server_name, keys, &r, &w, expr, timeout, TRUE) < 0)
@@ -5517,7 +5516,7 @@ f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
#ifdef FEAT_CLIENTSERVER
# ifdef MSWIN
- /* On Win32 it's done in this application. */
+ // On Win32 it's done in this application.
{
char_u *server_name = tv_get_string_chk(&argvars[0]);
@@ -5525,7 +5524,7 @@ f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
serverForeground(server_name);
}
# else
- /* Send a foreground() expression to the server. */
+ // Send a foreground() expression to the server.
argvars[1].v_type = VAR_STRING;
argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()");
argvars[2].v_type = VAR_UNKNOWN;
@@ -5557,7 +5556,7 @@ f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv)
if (serverid == NULL)
{
rettv->vval.v_number = -1;
- return; /* type error; errmsg already given */
+ return; // type error; errmsg already given
}
# ifdef MSWIN
sscanf((const char *)serverid, SCANF_HEX_LONG_U, &n);
@@ -5604,7 +5603,7 @@ f_remote_read(typval_T *argvars UNUSED, typval_T *rettv)
{
int timeout = 0;
# ifdef MSWIN
- /* The server's HWND is encoded in the 'id' parameter */
+ // The server's HWND is encoded in the 'id' parameter
long_u n = 0;
# endif
@@ -5651,7 +5650,7 @@ f_remote_startserver(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
char_u *server = tv_get_string_chk(&argvars[0]);
if (server == NULL)
- return; /* type error; errmsg already given */
+ return; // type error; errmsg already given
if (serverName != NULL)
emsg(_("E941: already started a server"));
else
@@ -5728,14 +5727,14 @@ f_repeat(typval_T *argvars, typval_T *rettv)
}
}
-#define SP_NOMOVE 0x01 /* don't move cursor */
-#define SP_REPEAT 0x02 /* repeat to find outer pair */
-#define SP_RETCOUNT 0x04 /* return matchcount */
-#define SP_SETPCMARK 0x08 /* set previous context mark */
-#define SP_START 0x10 /* accept match at start position */
-#define SP_SUBPAT 0x20 /* return nr of matching sub-pattern */
-#define SP_END 0x40 /* leave cursor at end of match */
-#define SP_COLUMN 0x80 /* start at cursor column */
+#define SP_NOMOVE 0x01 // don't move cursor
+#define SP_REPEAT 0x02 // repeat to find outer pair
+#define SP_RETCOUNT 0x04 // return matchcount
+#define SP_SETPCMARK 0x08 // set previous context mark
+#define SP_START 0x10 // accept match at start position
+#define SP_SUBPAT 0x20 // return nr of matching sub-pattern
+#define SP_END 0x40 // leave cursor at end of match
+#define SP_COLUMN 0x80 // start at cursor column
/*
* Get flags for a search function.
@@ -5754,7 +5753,7 @@ get_search_arg(typval_T *varp, int *flagsp)
{
flags = tv_get_string_buf_chk(varp, nbuf);
if (flags == NULL)
- return 0; /* type error; errmsg already given */
+ return 0; // type error; errmsg already given
while (*flags != NUL)
{
switch (*flags)
@@ -5803,7 +5802,7 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
pos_T save_cursor;
int save_p_ws = p_ws;
int dir;
- int retval = 0; /* default: FAIL */
+ int retval = 0; // default: FAIL
long lnum_stop = 0;
#ifdef FEAT_RELTIME
proftime_T tm;
@@ -5814,7 +5813,7 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
searchit_arg_T sia;
pat = tv_get_string(&argvars[0]);
- dir = get_search_arg(&argvars[1], flagsp); /* may set p_ws */
+ dir = get_search_arg(&argvars[1], flagsp); // may set p_ws
if (dir == 0)
goto theend;
flags = *flagsp;
@@ -5825,7 +5824,7 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
if (flags & SP_COLUMN)
options |= SEARCH_COL;
- /* Optional arguments: line number to stop searching and timeout. */
+ // Optional arguments: line number to stop searching and timeout.
if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN)
{
lnum_stop = (long)tv_get_number_chk(&argvars[2], NULL);
@@ -5842,7 +5841,7 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
}
#ifdef FEAT_RELTIME
- /* Set the time limit, if there is one. */
+ // Set the time limit, if there is one.
profile_setlimit(time_limit, &tm);
#endif
@@ -5878,16 +5877,16 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
curwin->w_cursor = pos;
if (match_pos != NULL)
{
- /* Store the match cursor position */
+ // Store the match cursor position
match_pos->lnum = pos.lnum;
match_pos->col = pos.col + 1;
}
- /* "/$" 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();
}
- /* If 'n' flag is used: restore cursor position. */
+ // If 'n' flag is used: restore cursor position.
if (flags & SP_NOMOVE)
curwin->w_cursor = save_cursor;
else
@@ -6098,7 +6097,7 @@ f_searchdecl(typval_T *argvars, typval_T *rettv)
int error = FALSE;
char_u *name;
- rettv->vval.v_number = 1; /* default: FAIL */
+ rettv->vval.v_number = 1; // default: FAIL
name = tv_get_string_chk(&argvars[0]);
if (argvars[1].v_type != VAR_UNKNOWN)
@@ -6125,26 +6124,25 @@ searchpair_cmn(typval_T *argvars, pos_T *match_pos)
int flags = 0;
char_u nbuf1[NUMBUFLEN];
char_u nbuf2[NUMBUFLEN];
- int retval = 0; /* default: FAIL */
+ int retval = 0; // default: FAIL
long lnum_stop = 0;
long time_limit = 0;
- /* Get the three pattern arguments: start, middle, end. Will result in an
- * error if not a valid argument. */
+ // Get the three pattern arguments: start, middle, end. Will result in an
+ // error if not a valid argument.
spat = tv_get_string_chk(&argvars[0]);
mpat = tv_get_string_buf_chk(&argvars[1], nbuf1);
epat = tv_get_string_buf_chk(&argvars[2], nbuf2);
if (spat == NULL || mpat == NULL || epat == NULL)
- goto theend; /* type error */
+ goto theend; // type error
- /* Handle the optional fourth argument: flags */
- dir = get_search_arg(&argvars[3], &flags); /* may set p_ws */
+ // Handle the optional fourth argument: flags
+ dir = get_search_arg(&argvars[3], &flags); // may set p_ws
if (dir == 0)
goto theend;
- /* Don't accept SP_END or SP_SUBPAT.
- * Only one of the SP_NOMOVE or SP_SETPCMARK flags can be set.
- */
+ // Don't accept SP_END or SP_SUBPAT.
+ // Only one of the SP_NOMOVE or SP_SETPCMARK flags can be set.
if ((flags & (SP_END | SP_SUBPAT)) != 0
|| ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK)))
{
@@ -6152,11 +6150,11 @@ searchpair_cmn(typval_T *argvars, pos_T *match_pos)
goto theend;
}
- /* Using 'r' implies 'W', otherwise it doesn't work. */
+ // Using 'r' implies 'W', otherwise it doesn't work.
if (flags & SP_REPEAT)
p_ws = FALSE;
- /* Optional fifth argument: skip expression */
+ // Optional fifth argument: skip expression
if (argvars[3].v_type == VAR_UNKNOWN
|| argvars[4].v_type == VAR_UNKNOWN)
skip = NULL;
@@ -6166,7 +6164,7 @@ searchpair_cmn(typval_T *argvars, pos_T *match_pos)
if (skip->v_type != VAR_FUNC && skip->v_type != VAR_PARTIAL
&& skip->v_type != VAR_STRING)
{
- /* Type error */
+ // Type error
semsg(_(e_invarg2), tv_get_string(&argvars[4]));
goto theend;
}
@@ -6240,15 +6238,15 @@ f_searchpairpos(typval_T *argvars, typval_T *rettv)
*/
long
do_searchpair(
- char_u *spat, /* start pattern */
- char_u *mpat, /* middle pattern */
- char_u *epat, /* end pattern */
- int dir, /* BACKWARD or FORWARD */
- typval_T *skip, /* skip expression */
- int flags, /* SP_SETPCMARK and other SP_ values */
+ char_u *spat, // start pattern
+ char_u *mpat, // middle pattern
+ char_u *epat, // end pattern
+ int dir, // BACKWARD or FORWARD
+ typval_T *skip, // skip expression
+ int flags, // SP_SETPCMARK and other SP_ values
pos_T *match_pos,
- linenr_T lnum_stop, /* stop at this line if not zero */
- long time_limit UNUSED) /* stop after this many msec */
+ linenr_T lnum_stop, // stop at this line if not zero
+ long time_limit UNUSED) // stop after this many msec
{
char_u *save_cpo;
char_u *pat, *pat2 = NULL, *pat3 = NULL;
@@ -6268,17 +6266,17 @@ do_searchpair(
proftime_T tm;
#endif
- /* Make 'cpoptions' empty, the 'l' flag should not be used here. */
+ // Make 'cpoptions' empty, the 'l' flag should not be used here.
save_cpo = p_cpo;
p_cpo = empty_option;
#ifdef FEAT_RELTIME
- /* Set the time limit, if there is one. */
+ // Set the time limit, if there is one.
profile_setlimit(time_limit, &tm);
#endif
- /* Make two search patterns: start/end (pat2, for in nested pairs) and
- * start/middle/end (pat3, for the top pair). */
+ // Make two search patterns: start/end (pat2, for in nested pairs) and
+ // start/middle/end (pat3, for the top pair).
pat2 = alloc(STRLEN(spat) + STRLEN(epat) + 17);
pat3 = alloc(STRLEN(spat) + STRLEN(mpat) + STRLEN(epat) + 25);
if (pat2 == NULL || pat3 == NULL)
@@ -6294,7 +6292,7 @@ do_searchpair(
if (skip != NULL)
{
- /* Empty string means to not use the skip expression. */
+ // Empty string means to not use the skip expression.
if (skip->v_type == VAR_STRING || skip->v_type == VAR_FUNC)
use_skip = skip->vval.v_string != NULL
&& *skip->vval.v_string != NUL;
@@ -6317,16 +6315,16 @@ do_searchpair(
n = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L,
options, RE_SEARCH, &sia);
if (n == FAIL || (firstpos.lnum != 0 && EQUAL_POS(pos, firstpos)))
- /* didn't find it or found the first match again: FAIL */
+ // didn't find it or found the first match again: FAIL
break;
if (firstpos.lnum == 0)
firstpos = pos;
if (EQUAL_POS(pos, foundpos))
{
- /* Found the same position again. Can happen with a pattern that
- * has "\zs" at the end and searching backwards. Advance one
- * character and try again. */
+ // Found the same position again. Can happen with a pattern that
+ // has "\zs" at the end and searching backwards. Advance one
+ // character and try again.
if (dir == BACKWARD)
decl(&pos);
else
@@ -6334,10 +6332,10 @@ do_searchpair(
}
foundpos = pos;
- /* clear the start flag to avoid getting stuck here */
+ // clear the start flag to avoid getting stuck here
options &= ~SEARCH_START;
- /* If the skip pattern matches, ignore this match. */
+ // If the skip pattern matches, ignore this match.
if (use_skip)
{
save_pos = curwin->w_cursor;
@@ -6347,7 +6345,7 @@ do_searchpair(
curwin->w_cursor = save_pos;
if (err)
{
- /* Evaluating {skip} caused an error, break here. */
+ // Evaluating {skip} caused an error, break here.
curwin->w_cursor = save_cursor;
retval = -1;
break;
@@ -6358,22 +6356,22 @@ do_searchpair(
if ((dir == BACKWARD && n == 3) || (dir == FORWARD && n == 2))
{
- /* Found end when searching backwards or start when searching
- * forward: nested pair. */
+ // Found end when searching backwards or start when searching
+ // forward: nested pair.
++nest;
- pat = pat2; /* nested, don't search for middle */
+ pat = pat2; // nested, don't search for middle
}
else
{
- /* Found end when searching forward or start when searching
- * backward: end of (nested) pair; or found middle in outer pair. */
+ // Found end when searching forward or start when searching
+ // backward: end of (nested) pair; or found middle in outer pair.
if (--nest == 1)
- pat = pat3; /* outer level, search for middle */
+ pat = pat3; // outer level, search for middle
}
if (nest == 0)
{
- /* Found the match: return matchcount or line number. */
+ // Found the match: return matchcount or line number.
if (flags & SP_RETCOUNT)
++retval;
else
@@ -6383,18 +6381,18 @@ do_searchpair(
curwin->w_cursor = pos;
if (!(flags & SP_REPEAT))
break;
- nest = 1; /* search for next unmatched */
+ nest = 1; // search for next unmatched
}
}
if (match_pos != NULL)
{
- /* Store the match cursor position */
+ // Store the match cursor position
match_pos->lnum = curwin->w_cursor.lnum;
match_pos->col = curwin->w_cursor.col + 1;
}
- /* If 'n' flag is used or search failed: restore cursor position. */
+ // If 'n' flag is used or search failed: restore cursor position.
if ((flags & SP_NOMOVE) || retval == 0)
curwin->w_cursor = save_cursor;
@@ -6404,7 +6402,7 @@ theend:
if (p_cpo == empty_option)
p_cpo = save_cpo;
else
- /* Darn, evaluating the {skip} expression changed the value. */
+ // Darn, evaluating the {skip} expression changed the value.
free_string_option(save_cpo);
return retval;
@@ -6600,7 +6598,7 @@ f_setpos(typval_T *argvars, typval_T *rettv)
pos.col = 0;
if (name[0] == '.' && name[1] == NUL)
{
- /* set cursor; "fnum" is ignored */
+ // set cursor; "fnum" is ignored
curwin->w_cursor = pos;
if (curswant >= 0)
{
@@ -6612,7 +6610,7 @@ f_setpos(typval_T *argvars, typval_T *rettv)
}
else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL)
{
- /* set mark */
+ // set mark
if (setmark_pos(name[1], &pos, fnum) == OK)
rettv->vval.v_number = 0;
}
@@ -6641,10 +6639,10 @@ f_setreg(typval_T *argvars, typval_T *rettv)
append = FALSE;
strregname = tv_get_string_chk(argvars);
- rettv->vval.v_number = 1; /* FAIL is default */
+ rettv->vval.v_number = 1; // FAIL is default
if (strregname == NULL)
- return; /* type error; errmsg already given */
+ return; // type error; errmsg already given
regname = *strregname;
if (regname == 0 || regname == '@')
regname = '"';
@@ -6653,20 +6651,20 @@ f_setreg(typval_T *argvars, typval_T *rettv)
{
stropt = tv_get_string_chk(&argvars[2]);
if (stropt == NULL)
- return; /* type error */
+ return; // type error
for (; *stropt != NUL; ++stropt)
switch (*stropt)
{
- case 'a': case 'A': /* append */
+ case 'a': case 'A': // append
append = TRUE;
break;
- case 'v': case 'c': /* character-wise selection */
+ case 'v': case 'c': // character-wise selection
yank_type = MCHAR;
break;
- case 'V': case 'l': /* line-wise selection */
+ case 'V': case 'l': // line-wise selection
yank_type = MLINE;
break;
- case 'b': case Ctrl_V: /* block-wise selection */
+ case 'b': case Ctrl_V: // block-wise selection
yank_type = MBLOCK;
if (VIM_ISDIGIT(stropt[1]))
{
@@ -6689,11 +6687,11 @@ f_setreg(typval_T *argvars, typval_T *rettv)
listitem_T *li;
int len;
- /* If the list is NULL handle like an empty list. */
+ // If the list is NULL handle like an empty list.
len = ll == NULL ? 0 : ll->lv_len;
- /* First half: use for pointers to result lines; second half: use for
- * pointers to allocated copies. */
+ // First half: use for pointers to result lines; second half: use for
+ // pointers to allocated copies.
lstval = ALLOC_MULT(char_u *, (len + 1) * 2);
if (lstval == NULL)
return;
@@ -6709,8 +6707,8 @@ f_setreg(typval_T *argvars, typval_T *rettv)
goto free_lstval;
if (strval == buf)
{
- /* Need to make a copy, next tv_get_string_buf_chk() will
- * overwrite the string. */
+ // Need to make a copy, next tv_get_string_buf_chk() will
+ // overwrite the string.
strval = vim_strsave(buf);
if (strval == NULL)
goto free_lstval;
@@ -6808,7 +6806,7 @@ f_sha256(typval_T *argvars, typval_T *rettv)
sha256_bytes(p, (int)STRLEN(p), NULL, 0));
rettv->v_type = VAR_STRING;
}
-#endif /* FEAT_CRYPT */
+#endif // FEAT_CRYPT
/*
* "shellescape({string})" function
@@ -6912,7 +6910,7 @@ f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv)
#ifdef FEAT_SPELL
if (argvars[0].v_type == VAR_UNKNOWN)
{
- /* Find the start and length of the badly spelled word. */
+ // Find the start and length of the badly spelled word.
len = spell_move_to(curwin, FORWARD, TRUE, TRUE, &attr);
if (len != 0)
{
@@ -6927,7 +6925,7 @@ f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv)
if (str != NULL)
{
- /* Check the argument for spelling. */
+ // Check the argument for spelling.
while (*str != NUL)
{
len = spell_check(curwin, str, &attr, &capcol, FALSE);
@@ -7027,7 +7025,7 @@ f_split(typval_T *argvars, typval_T *rettv)
int keepempty = FALSE;
int typeerr = FALSE;
- /* Make 'cpoptions' empty, the 'l' flag should not be used here. */
+ // Make 'cpoptions' empty, the 'l' flag should not be used here.
save_cpo = p_cpo;
p_cpo = (char_u *)"";
@@ -7055,7 +7053,7 @@ f_split(typval_T *argvars, typval_T *rettv)
while (*str != NUL || keepempty)
{
if (*str == NUL)
- match = FALSE; /* empty item at the end */
+ match = FALSE; // empty item at the end
else
match = vim_regexec_nl(&regmatch, str, col);
if (match)
@@ -7294,7 +7292,7 @@ f_strftime(typval_T *argvars, typval_T *rettv)
else
seconds = (time_t)tv_get_number(&argvars[1]);
curtime = vim_localtime(&seconds, &tmval);
- /* MSVC returns NULL for an invalid value of seconds. */
+ // MSVC returns NULL for an invalid value of seconds.
if (curtime == NULL)
rettv->vval.v_string = vim_strsave((char_u *)_("(Invalid)"));
else
@@ -7321,7 +7319,7 @@ f_strftime(typval_T *argvars, typval_T *rettv)
else
rettv->vval.v_string = vim_strsave(result_buf);
- /* Release conversion descriptors */
+ // Release conversion descriptors
convert_setup(&conv, NULL, NULL);
vim_free(enc);
}
@@ -7378,7 +7376,7 @@ f_stridx(typval_T *argvars, typval_T *rettv)
save_haystack = haystack = tv_get_string_buf_chk(&argvars[0], buf);
rettv->vval.v_number = -1;
if (needle == NULL || haystack == NULL)
- return; /* type error; errmsg already given */
+ return; // type error; errmsg already given
if (argvars[2].v_type != VAR_UNKNOWN)
{
@@ -7408,7 +7406,7 @@ f_string(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = tv2string(&argvars[0], &tofree, numbuf,
get_copyID());
- /* Make a copy if we have a value but it's not in allocated memory. */
+ // Make a copy if we have a value but it's not in allocated memory.
if (rettv->vval.v_string != NULL && tofree == NULL)
rettv->vval.v_string = vim_strsave(rettv->vval.v_string);
}
@@ -7519,7 +7517,7 @@ f_strcharpart(typval_T *argvars, typval_T *rettv)
}
}
else
- len = slen - nbyte; /* default: all bytes that are available. */
+ len = slen - nbyte; // default: all bytes that are available.
}
/*
@@ -7563,7 +7561,7 @@ f_strpart(typval_T *argvars, typval_T *rettv)
else if (argvars[2].v_type != VAR_UNKNOWN)
len = (int)tv_get_number(&argvars[2]);
else
- len = slen - n; /* default len: all bytes that are available. */
+ len = slen - n; // default len: all bytes that are available.
/*
* Only return the overlap between the specified part and the actual
@@ -7637,22 +7635,22 @@ f_strridx(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = -1;
if (needle == NULL || haystack == NULL)
- return; /* type error; errmsg already given */
+ return; // type error; errmsg already given
haystack_len = (int)STRLEN(haystack);
if (argvars[2].v_type != VAR_UNKNOWN)
{
- /* Third argument: upper limit for index */
+ // Third argument: upper limit for index
end_idx = (int)tv_get_number_chk(&argvars[2], NULL);
if (end_idx < 0)
- return; /* can never find a match */
+ return; // can never find a match
}
else
end_idx = haystack_len;
if (*needle == NUL)
{
- /* Empty string matches past the end. */
+ // Empty string matches past the end.
lastmatch = haystack + end_idx;
}
else
@@ -7786,8 +7784,8 @@ f_synID(typval_T *argvars UNUSED, typval_T *rettv)
int trans;
int transerr = FALSE;
- lnum = tv_get_lnum(argvars); /* -1 on type error */
- col = (linenr_T)tv_get_number(&argvars[1]) - 1; /* -1 on type error */
+ lnum = tv_get_lnum(argvars); // -1 on type error
+ col = (linenr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error
trans = (int)tv_get_number_chk(&argvars[2], &transerr);
if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
@@ -7819,7 +7817,7 @@ f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv)
mode = tv_get_string_buf(&argvars[2], modebuf);
modec = TOLOWER_ASC(mode[0]);
if (modec != 't' && modec != 'c' && modec != 'g')
- modec = 0; /* replace invalid with current */
+ modec = 0; // replace invalid with current
}
else
{
@@ -7837,48 +7835,48 @@ f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv)
switch (TOLOWER_ASC(what[0]))
{
case 'b':
- if (TOLOWER_ASC(what[1]) == 'g') /* bg[#] */
+ if (TOLOWER_ASC(what[1]) == 'g') // bg[#]
p = highlight_color(id, what, modec);
- else /* bold */
+ else // bold
p = highlight_has_attr(id, HL_BOLD, modec);
break;
- case 'f': /* fg[#] or font */
+ case 'f': // fg[#] or font
p = highlight_color(id, what, modec);
break;
case 'i':
- if (TOLOWER_ASC(what[1]) == 'n') /* inverse */
+ if (TOLOWER_ASC(what[1]) == 'n') // inverse
p = highlight_has_attr(id, HL_INVERSE, modec);
- else /* italic */
+ else // italic
p = highlight_has_attr(id, HL_ITALIC, modec);
break;
- case 'n': /* name */
+ case 'n': // name
p = get_highlight_name_ext(NULL, id - 1, FALSE);
break;
- case 'r': /* reverse */
+ case 'r': // reverse
p = highlight_has_attr(id, HL_INVERSE, modec);
break;
case 's':
- if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */
+ if (TOLOWER_ASC(what[1]) == 'p') // sp[#]
p = highlight_color(id, what, modec);
- /* strikeout */
+ // strikeout
else if (TOLOWER_ASC(what[1]) == 't' &&
TOLOWER_ASC(what[2]) == 'r')
p = highlight_has_attr(id, HL_STRIKETHROUGH, modec);
- else /* standout */
+ else // standout
p = highlight_has_attr(id, HL_STANDOUT, modec);
break;
case 'u':
if (STRLEN(what) <= 5 || TOLOWER_ASC(what[5]) != 'c')
- /* underline */
+ // underline
p = highlight_has_attr(id, HL_UNDERLINE, modec);
else
- /* undercurl */
+ // undercurl
p = highlight_has_attr(id, HL_UNDERCURL, modec);
break;
}
@@ -7928,8 +7926,8 @@ f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv)
rettv_list_set(rettv, NULL);
#if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL)
- lnum = tv_get_lnum(argvars); /* -1 on type error */
- col = (colnr_T)tv_get_number(&argvars[1]) - 1; /* -1 on type error */
+ lnum = tv_get_lnum(argvars); // -1 on type error
+ col = (colnr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error
vim_memset(str, NUL, sizeof(str));
@@ -7942,7 +7940,7 @@ f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv)
(void)syn_get_id(curwin, lnum, col, FALSE, NULL, FALSE);
syntax_flags = get_syntax_info(&matchid);
- /* get the conceal character */
+ // get the conceal character
if ((syntax_flags & HL_CONCEAL) && curwin->w_p_cole < 3)
{
cchar = syn_get_sub_char();
@@ -7960,7 +7958,7 @@ f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv)
list_append_number(rettv->vval.v_list,
(syntax_flags & HL_CONCEAL) != 0);
- /* -1 to auto-determine strlen */
+ // -1 to auto-determine strlen
list_append_string(rettv->vval.v_list, str, -1);
list_append_number(rettv->vval.v_list, matchid);
}
@@ -7983,8 +7981,8 @@ f_synstack(typval_T *argvars UNUSED, typval_T *rettv)
rettv_list_set(rettv, NULL);
#ifdef FEAT_SYN_HL
- lnum = tv_get_lnum(argvars); /* -1 on type error */
- col = (colnr_T)tv_get_number(&argvars[1]) - 1; /* -1 on type error */
+ lnum = tv_get_lnum(argvars); // -1 on type error
+ col = (colnr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
&& col >= 0 && col <= (long)STRLEN(ml_get(lnum))
@@ -8151,15 +8149,15 @@ f_tr(typval_T *argvars, typval_T *rettv)
fromstr = tv_get_string_buf_chk(&argvars[1], buf);
tostr = tv_get_string_buf_chk(&argvars[2], buf2);
- /* Default return value: empty string. */
+ // Default return value: empty string.
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
if (fromstr == NULL || tostr == NULL)
- return; /* type error; errmsg already given */
+ return; // type error; errmsg already given
ga_init2(&ga, (int)sizeof(char), 80);
if (!has_mbyte)
- /* not multi-byte: fromstr and tostr must be the same length */
+ // not multi-byte: fromstr and tostr must be the same length
if (STRLEN(fromstr) != STRLEN(tostr))
{
error:
@@ -8168,7 +8166,7 @@ error:
return;
}
- /* fromstr and tostr have to contain the same number of chars */
+ // fromstr and tostr have to contain the same number of chars
while (*in_str != NUL)
{
if (has_mbyte)
@@ -8192,7 +8190,7 @@ error:
break;
}
}
- if (*p == NUL) /* tostr is shorter than fromstr */
+ if (*p == NUL) // tostr is shorter than fromstr
goto error;
break;
}
@@ -8201,9 +8199,9 @@ error:
if (first && cpstr == in_str)
{
- /* Check that fromstr and tostr have the same number of
- * (multi-byte) characters. Done only once when a character
- * of in_str doesn't appear in fromstr. */
+ // Check that fromstr and tostr have the same number of
+ // (multi-byte) characters. Done only once when a character
+ // of in_str doesn't appear in fromstr.
first = FALSE;
for (p = tostr; *p != NUL; p += tolen)
{
@@ -8222,7 +8220,7 @@ error:
}
else
{
- /* When not using multi-byte chars we can do it faster. */
+ // When not using multi-byte chars we can do it faster.
p = vim_strchr(fromstr, *in_str);
if (p != NULL)
ga_append(&ga, tostr[p - fromstr]);
@@ -8232,7 +8230,7 @@ error:
}
}
- /* add a terminating NUL */
+ // add a terminating NUL
(void)ga_grow(&ga, 1);
ga_append(&ga, NUL);
@@ -8316,7 +8314,7 @@ f_trunc(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_FLOAT;
if (get_float_arg(argvars, &f) == OK)
- /* trunc() is not in C90, use floor() or ceil() instead. */
+ // trunc() is not in C90, use floor() or ceil() instead.
rettv->vval.v_float = f > 0 ? floor(f) : ceil(f);
else
rettv->vval.v_float = 0.0;
@@ -8392,7 +8390,7 @@ f_visualmode(typval_T *argvars, typval_T *rettv)
str[1] = NUL;
rettv->vval.v_string = vim_strsave(str);
- /* A non-zero number or non-empty string argument: reset mode. */
+ // A non-zero number or non-empty string argument: reset mode.
if (non_zero_arg(&argvars[0]))
curbuf->b_visual_mode_eval = NUL;
}
@@ -8430,4 +8428,4 @@ f_xor(typval_T *argvars, typval_T *rettv)
^ tv_get_number_chk(&argvars[1], NULL);
}
-#endif /* FEAT_EVAL */
+#endif // FEAT_EVAL
diff --git a/src/version.c b/src/version.c
index 4d50222d2..cc5b4b99d 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 */
/**/
+ 2378,
+/**/
2377,
/**/
2376,