forked from aniani/vim
patch 9.0.1196: code is indented more than necessary
Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11813)
This commit is contained in:
committed by
Bram Moolenaar
parent
378e6c03f9
commit
e857598896
36
src/job.c
36
src/job.c
@@ -793,11 +793,11 @@ job_free_job(job_T *job)
|
|||||||
static void
|
static void
|
||||||
job_free(job_T *job)
|
job_free(job_T *job)
|
||||||
{
|
{
|
||||||
if (!in_free_unref_items)
|
if (in_free_unref_items)
|
||||||
{
|
return;
|
||||||
|
|
||||||
job_free_contents(job);
|
job_free_contents(job);
|
||||||
job_free_job(job);
|
job_free_job(job);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static job_T *jobs_to_free = NULL;
|
static job_T *jobs_to_free = NULL;
|
||||||
@@ -1087,12 +1087,14 @@ set_ref_in_job(int copyID)
|
|||||||
void
|
void
|
||||||
job_unref(job_T *job)
|
job_unref(job_T *job)
|
||||||
{
|
{
|
||||||
if (job != NULL && --job->jv_refcount <= 0)
|
if (job == NULL || --job->jv_refcount > 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
// Do not free the job if there is a channel where the close callback
|
// Do not free the job if there is a channel where the close callback
|
||||||
// may get the job info.
|
// may get the job info.
|
||||||
if (!job_channel_still_useful(job))
|
if (job_channel_still_useful(job))
|
||||||
{
|
return;
|
||||||
|
|
||||||
// Do not free the job when it has not ended yet and there is a
|
// Do not free the job when it has not ended yet and there is a
|
||||||
// "stoponexit" flag or an exit callback.
|
// "stoponexit" flag or an exit callback.
|
||||||
if (!job_need_end_check(job))
|
if (!job_need_end_check(job))
|
||||||
@@ -1108,8 +1110,6 @@ job_unref(job_T *job)
|
|||||||
channel_unref(job->jv_channel);
|
channel_unref(job->jv_channel);
|
||||||
job->jv_channel = NULL;
|
job->jv_channel = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -1157,8 +1157,9 @@ job_alloc(void)
|
|||||||
job_T *job;
|
job_T *job;
|
||||||
|
|
||||||
job = ALLOC_CLEAR_ONE(job_T);
|
job = ALLOC_CLEAR_ONE(job_T);
|
||||||
if (job != NULL)
|
if (job == NULL)
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
job->jv_refcount = 1;
|
job->jv_refcount = 1;
|
||||||
job->jv_stoponexit = vim_strsave((char_u *)"term");
|
job->jv_stoponexit = vim_strsave((char_u *)"term");
|
||||||
|
|
||||||
@@ -1168,7 +1169,6 @@ job_alloc(void)
|
|||||||
job->jv_next = first_job;
|
job->jv_next = first_job;
|
||||||
}
|
}
|
||||||
first_job = job;
|
first_job = job;
|
||||||
}
|
|
||||||
return job;
|
return job;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1803,13 +1803,13 @@ f_job_getchannel(typval_T *argvars, typval_T *rettv)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
job = get_job_arg(&argvars[0]);
|
job = get_job_arg(&argvars[0]);
|
||||||
if (job != NULL)
|
if (job == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
rettv->v_type = VAR_CHANNEL;
|
rettv->v_type = VAR_CHANNEL;
|
||||||
rettv->vval.v_channel = job->jv_channel;
|
rettv->vval.v_channel = job->jv_channel;
|
||||||
if (job->jv_channel != NULL)
|
if (job->jv_channel != NULL)
|
||||||
++job->jv_channel->ch_refcount;
|
++job->jv_channel->ch_refcount;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1855,13 +1855,13 @@ job_info(job_T *job, dict_T *dict)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
l = list_alloc();
|
l = list_alloc();
|
||||||
if (l != NULL)
|
if (l == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
dict_add_list(dict, "cmd", l);
|
dict_add_list(dict, "cmd", l);
|
||||||
if (job->jv_argv != NULL)
|
if (job->jv_argv != NULL)
|
||||||
for (i = 0; job->jv_argv[i] != NULL; i++)
|
for (i = 0; job->jv_argv[i] != NULL; i++)
|
||||||
list_append_string(l, (char_u *)job->jv_argv[i], -1);
|
list_append_string(l, (char_u *)job->jv_argv[i], -1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
42
src/list.c
42
src/list.c
@@ -124,8 +124,9 @@ list_alloc_with_items(int count)
|
|||||||
|
|
||||||
list_init(l);
|
list_init(l);
|
||||||
|
|
||||||
if (count > 0)
|
if (count <= 0)
|
||||||
{
|
return l;
|
||||||
|
|
||||||
listitem_T *li = (listitem_T *)(l + 1);
|
listitem_T *li = (listitem_T *)(l + 1);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -145,7 +146,6 @@ list_alloc_with_items(int count)
|
|||||||
li->li_next = li + 1;
|
li->li_next = li + 1;
|
||||||
++li;
|
++li;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
@@ -297,11 +297,11 @@ list_free_items(int copyID)
|
|||||||
void
|
void
|
||||||
list_free(list_T *l)
|
list_free(list_T *l)
|
||||||
{
|
{
|
||||||
if (!in_free_unref_items)
|
if (in_free_unref_items)
|
||||||
{
|
return;
|
||||||
|
|
||||||
list_free_contents(l);
|
list_free_contents(l);
|
||||||
list_free_list(l);
|
list_free_list(l);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -540,14 +540,14 @@ list_find_index(list_T *l, long *idx)
|
|||||||
{
|
{
|
||||||
listitem_T *li = list_find(l, *idx);
|
listitem_T *li = list_find(l, *idx);
|
||||||
|
|
||||||
if (li == NULL)
|
if (li != NULL)
|
||||||
{
|
return li;
|
||||||
|
|
||||||
if (*idx < 0)
|
if (*idx < 0)
|
||||||
{
|
{
|
||||||
*idx = 0;
|
*idx = 0;
|
||||||
li = list_find(l, *idx);
|
li = list_find(l, *idx);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return li;
|
return li;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -772,8 +772,9 @@ check_range_index_one(list_T *l, long *n1, int can_append, int quiet)
|
|||||||
long orig_n1 = *n1;
|
long orig_n1 = *n1;
|
||||||
listitem_T *li = list_find_index(l, n1);
|
listitem_T *li = list_find_index(l, n1);
|
||||||
|
|
||||||
if (li == NULL)
|
if (li != NULL)
|
||||||
{
|
return li;
|
||||||
|
|
||||||
// Vim9: Allow for adding an item at the end.
|
// Vim9: Allow for adding an item at the end.
|
||||||
if (can_append && in_vim9script()
|
if (can_append && in_vim9script()
|
||||||
&& *n1 == l->lv_len && l->lv_lock == 0)
|
&& *n1 == l->lv_len && l->lv_lock == 0)
|
||||||
@@ -787,7 +788,6 @@ check_range_index_one(list_T *l, long *n1, int can_append, int quiet)
|
|||||||
semsg(_(e_list_index_out_of_range_nr), orig_n1);
|
semsg(_(e_list_index_out_of_range_nr), orig_n1);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return li;
|
return li;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1286,8 +1286,9 @@ list_copy(list_T *orig, int deep, int top, int copyID)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
copy = list_alloc();
|
copy = list_alloc();
|
||||||
if (copy != NULL)
|
if (copy == NULL)
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
if (orig->lv_type == NULL || top || deep)
|
if (orig->lv_type == NULL || top || deep)
|
||||||
copy->lv_type = NULL;
|
copy->lv_type = NULL;
|
||||||
else
|
else
|
||||||
@@ -1325,7 +1326,6 @@ list_copy(list_T *orig, int deep, int top, int copyID)
|
|||||||
list_unref(copy);
|
list_unref(copy);
|
||||||
copy = NULL;
|
copy = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
@@ -1491,9 +1491,10 @@ list_join(
|
|||||||
retval = list_join_inner(gap, l, sep, echo_style, restore_copyID,
|
retval = list_join_inner(gap, l, sep, echo_style, restore_copyID,
|
||||||
copyID, &join_ga);
|
copyID, &join_ga);
|
||||||
|
|
||||||
|
if (join_ga.ga_data == NULL)
|
||||||
|
return retval;
|
||||||
|
|
||||||
// Dispose each item in join_ga.
|
// Dispose each item in join_ga.
|
||||||
if (join_ga.ga_data != NULL)
|
|
||||||
{
|
|
||||||
p = (join_T *)join_ga.ga_data;
|
p = (join_T *)join_ga.ga_data;
|
||||||
for (i = 0; i < join_ga.ga_len; ++i)
|
for (i = 0; i < join_ga.ga_len; ++i)
|
||||||
{
|
{
|
||||||
@@ -1501,7 +1502,6 @@ list_join(
|
|||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
ga_clear(&join_ga);
|
ga_clear(&join_ga);
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@@ -2560,8 +2560,9 @@ filter_map(typval_T *argvars, typval_T *rettv, filtermap_T filtermap)
|
|||||||
// message. Avoid a misleading error message for an empty string that
|
// message. Avoid a misleading error message for an empty string that
|
||||||
// was not passed as argument.
|
// was not passed as argument.
|
||||||
expr = &argvars[1];
|
expr = &argvars[1];
|
||||||
if (expr->v_type != VAR_UNKNOWN)
|
if (expr->v_type == VAR_UNKNOWN)
|
||||||
{
|
return;
|
||||||
|
|
||||||
typval_T save_val;
|
typval_T save_val;
|
||||||
typval_T save_key;
|
typval_T save_key;
|
||||||
|
|
||||||
@@ -2589,7 +2590,6 @@ filter_map(typval_T *argvars, typval_T *rettv, filtermap_T filtermap)
|
|||||||
restore_vimvar(VV_VAL, &save_val);
|
restore_vimvar(VV_VAL, &save_val);
|
||||||
|
|
||||||
did_emsg |= save_did_emsg;
|
did_emsg |= save_did_emsg;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
25
src/locale.c
25
src/locale.c
@@ -151,11 +151,13 @@ get_mess_env(void)
|
|||||||
char_u *p;
|
char_u *p;
|
||||||
|
|
||||||
p = mch_getenv((char_u *)"LC_ALL");
|
p = mch_getenv((char_u *)"LC_ALL");
|
||||||
if (p == NULL || *p == NUL)
|
if (p != NULL && *p != NUL)
|
||||||
{
|
return p;
|
||||||
|
|
||||||
p = mch_getenv((char_u *)"LC_MESSAGES");
|
p = mch_getenv((char_u *)"LC_MESSAGES");
|
||||||
if (p == NULL || *p == NUL)
|
if (p != NULL && *p != NUL)
|
||||||
{
|
return p;
|
||||||
|
|
||||||
p = mch_getenv((char_u *)"LANG");
|
p = mch_getenv((char_u *)"LANG");
|
||||||
if (p != NULL && VIM_ISDIGIT(*p))
|
if (p != NULL && VIM_ISDIGIT(*p))
|
||||||
p = NULL; // ignore something like "1043"
|
p = NULL; // ignore something like "1043"
|
||||||
@@ -163,8 +165,6 @@ get_mess_env(void)
|
|||||||
if (p == NULL || *p == NUL)
|
if (p == NULL || *p == NUL)
|
||||||
p = get_locale_val(LC_CTYPE);
|
p = get_locale_val(LC_CTYPE);
|
||||||
# endif
|
# endif
|
||||||
}
|
|
||||||
}
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -504,11 +504,11 @@ find_locales(void)
|
|||||||
static void
|
static void
|
||||||
init_locales(void)
|
init_locales(void)
|
||||||
{
|
{
|
||||||
if (!did_init_locales)
|
if (did_init_locales)
|
||||||
{
|
return;
|
||||||
|
|
||||||
did_init_locales = TRUE;
|
did_init_locales = TRUE;
|
||||||
locales = find_locales();
|
locales = find_locales();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# if defined(EXITFREE) || defined(PROTO)
|
# if defined(EXITFREE) || defined(PROTO)
|
||||||
@@ -516,12 +516,13 @@ init_locales(void)
|
|||||||
free_locales(void)
|
free_locales(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (locales != NULL)
|
|
||||||
{
|
if (locales == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0; locales[i] != NULL; i++)
|
for (i = 0; locales[i] != NULL; i++)
|
||||||
vim_free(locales[i]);
|
vim_free(locales[i]);
|
||||||
VIM_CLEAR(locales);
|
VIM_CLEAR(locales);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
13
src/main.c
13
src/main.c
@@ -3099,8 +3099,9 @@ exe_pre_commands(mparm_T *parmp)
|
|||||||
int i;
|
int i;
|
||||||
ESTACK_CHECK_DECLARATION
|
ESTACK_CHECK_DECLARATION
|
||||||
|
|
||||||
if (cnt > 0)
|
if (cnt <= 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
curwin->w_cursor.lnum = 0; // just in case..
|
curwin->w_cursor.lnum = 0; // just in case..
|
||||||
estack_push(ETYPE_ARGS, (char_u *)_("pre-vimrc command line"), 0);
|
estack_push(ETYPE_ARGS, (char_u *)_("pre-vimrc command line"), 0);
|
||||||
ESTACK_CHECK_SETUP
|
ESTACK_CHECK_SETUP
|
||||||
@@ -3115,7 +3116,6 @@ exe_pre_commands(mparm_T *parmp)
|
|||||||
current_sctx.sc_sid = 0;
|
current_sctx.sc_sid = 0;
|
||||||
# endif
|
# endif
|
||||||
TIME_MSG("--cmd commands");
|
TIME_MSG("--cmd commands");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3369,8 +3369,9 @@ process_env(
|
|||||||
|
|
||||||
ESTACK_CHECK_DECLARATION
|
ESTACK_CHECK_DECLARATION
|
||||||
|
|
||||||
if ((initstr = mch_getenv(env)) != NULL && *initstr != NUL)
|
if ((initstr = mch_getenv(env)) == NULL || *initstr == NUL)
|
||||||
{
|
return FAIL;
|
||||||
|
|
||||||
if (is_viminit)
|
if (is_viminit)
|
||||||
vimrc_found(NULL, NULL);
|
vimrc_found(NULL, NULL);
|
||||||
estack_push(ETYPE_ENV, env, 0);
|
estack_push(ETYPE_ENV, env, 0);
|
||||||
@@ -3389,8 +3390,6 @@ process_env(
|
|||||||
estack_pop();
|
estack_pop();
|
||||||
current_sctx = save_current_sctx;
|
current_sctx = save_current_sctx;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
|
||||||
return FAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined(UNIX) || defined(VMS)) && !defined(NO_VIM_MAIN)
|
#if (defined(UNIX) || defined(VMS)) && !defined(NO_VIM_MAIN)
|
||||||
|
17
src/map.c
17
src/map.c
@@ -67,11 +67,11 @@ is_maphash_valid(void)
|
|||||||
static void
|
static void
|
||||||
validate_maphash(void)
|
validate_maphash(void)
|
||||||
{
|
{
|
||||||
if (!maphash_valid)
|
if (maphash_valid)
|
||||||
{
|
return;
|
||||||
|
|
||||||
CLEAR_FIELD(maphash);
|
CLEAR_FIELD(maphash);
|
||||||
maphash_valid = TRUE;
|
maphash_valid = TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -581,8 +581,8 @@ do_map(
|
|||||||
// needs to be freed later (*keys_buf and *arg_buf).
|
// needs to be freed later (*keys_buf and *arg_buf).
|
||||||
// replace_termcodes() also removes CTRL-Vs and sometimes backslashes.
|
// replace_termcodes() also removes CTRL-Vs and sometimes backslashes.
|
||||||
// If something like <C-H> is simplified to 0x08 then mark it as simplified
|
// If something like <C-H> is simplified to 0x08 then mark it as simplified
|
||||||
// and also add a n entry with a modifier, which will work when
|
// and also add an entry with a modifier, which will work when using a key
|
||||||
// modifyOtherKeys is working.
|
// protocol.
|
||||||
if (haskey)
|
if (haskey)
|
||||||
{
|
{
|
||||||
char_u *new_keys;
|
char_u *new_keys;
|
||||||
@@ -1843,8 +1843,9 @@ vim_strsave_escape_csi(char_u *p)
|
|||||||
// illegal utf-8 byte:
|
// illegal utf-8 byte:
|
||||||
// 0xc0 -> 0xc3 0x80 -> 0xc3 K_SPECIAL KS_SPECIAL KE_FILLER
|
// 0xc0 -> 0xc3 0x80 -> 0xc3 K_SPECIAL KS_SPECIAL KE_FILLER
|
||||||
res = alloc(STRLEN(p) * 4 + 1);
|
res = alloc(STRLEN(p) * 4 + 1);
|
||||||
if (res != NULL)
|
if (res == NULL)
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
d = res;
|
d = res;
|
||||||
for (s = p; *s != NUL; )
|
for (s = p; *s != NUL; )
|
||||||
{
|
{
|
||||||
@@ -1868,7 +1869,7 @@ vim_strsave_escape_csi(char_u *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*d = NUL;
|
*d = NUL;
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -485,8 +485,9 @@ fname2fnum(xfmark_T *fm)
|
|||||||
{
|
{
|
||||||
char_u *p;
|
char_u *p;
|
||||||
|
|
||||||
if (fm->fname != NULL)
|
if (fm->fname == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First expand "~/" in the file name to the home directory.
|
* First expand "~/" in the file name to the home directory.
|
||||||
* Don't expand the whole name, it may contain other '~' chars.
|
* Don't expand the whole name, it may contain other '~' chars.
|
||||||
@@ -512,7 +513,6 @@ fname2fnum(xfmark_T *fm)
|
|||||||
|
|
||||||
// buflist_new() will call fmarks_check_names()
|
// buflist_new() will call fmarks_check_names()
|
||||||
(void)buflist_new(NameBuff, p, (linenr_T)1, 0);
|
(void)buflist_new(NameBuff, p, (linenr_T)1, 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
12
src/match.c
12
src/match.c
@@ -978,15 +978,15 @@ matchadd_dict_arg(typval_T *tv, char_u **conceal_char, win_T **win)
|
|||||||
if (dict_has_key(tv->vval.v_dict, "conceal"))
|
if (dict_has_key(tv->vval.v_dict, "conceal"))
|
||||||
*conceal_char = dict_get_string(tv->vval.v_dict, "conceal", FALSE);
|
*conceal_char = dict_get_string(tv->vval.v_dict, "conceal", FALSE);
|
||||||
|
|
||||||
if ((di = dict_find(tv->vval.v_dict, (char_u *)"window", -1)) != NULL)
|
if ((di = dict_find(tv->vval.v_dict, (char_u *)"window", -1)) == NULL)
|
||||||
{
|
return OK;
|
||||||
|
|
||||||
*win = find_win_by_nr_or_id(&di->di_tv);
|
*win = find_win_by_nr_or_id(&di->di_tv);
|
||||||
if (*win == NULL)
|
if (*win == NULL)
|
||||||
{
|
{
|
||||||
emsg(_(e_invalid_window_number));
|
emsg(_(e_invalid_window_number));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -1330,8 +1330,9 @@ f_matchaddpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
|||||||
void
|
void
|
||||||
f_matcharg(typval_T *argvars UNUSED, typval_T *rettv)
|
f_matcharg(typval_T *argvars UNUSED, typval_T *rettv)
|
||||||
{
|
{
|
||||||
if (rettv_list_alloc(rettv) == OK)
|
if (rettv_list_alloc(rettv) != OK)
|
||||||
{
|
return;
|
||||||
|
|
||||||
# ifdef FEAT_SEARCH_EXTRA
|
# ifdef FEAT_SEARCH_EXTRA
|
||||||
int id;
|
int id;
|
||||||
matchitem_T *m;
|
matchitem_T *m;
|
||||||
@@ -1355,7 +1356,6 @@ f_matcharg(typval_T *argvars UNUSED, typval_T *rettv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
18
src/mbyte.c
18
src/mbyte.c
@@ -809,8 +809,9 @@ bomb_size(void)
|
|||||||
void
|
void
|
||||||
remove_bom(char_u *s)
|
remove_bom(char_u *s)
|
||||||
{
|
{
|
||||||
if (enc_utf8)
|
if (!enc_utf8)
|
||||||
{
|
return;
|
||||||
|
|
||||||
char_u *p = s;
|
char_u *p = s;
|
||||||
|
|
||||||
while ((p = vim_strbyte(p, 0xef)) != NULL)
|
while ((p = vim_strbyte(p, 0xef)) != NULL)
|
||||||
@@ -820,7 +821,6 @@ remove_bom(char_u *s)
|
|||||||
else
|
else
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -4590,8 +4590,9 @@ enc_canonize(char_u *enc)
|
|||||||
|
|
||||||
// copy "enc" to allocated memory, with room for two '-'
|
// copy "enc" to allocated memory, with room for two '-'
|
||||||
r = alloc(STRLEN(enc) + 3);
|
r = alloc(STRLEN(enc) + 3);
|
||||||
if (r != NULL)
|
if (r == NULL)
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
// Make it all lower case and replace '_' with '-'.
|
// Make it all lower case and replace '_' with '-'.
|
||||||
p = r;
|
p = r;
|
||||||
for (s = enc; *s != NUL; ++s)
|
for (s = enc; *s != NUL; ++s)
|
||||||
@@ -4640,7 +4641,6 @@ enc_canonize(char_u *enc)
|
|||||||
vim_free(r);
|
vim_free(r);
|
||||||
r = vim_strsave((char_u *)enc_canon_table[i].name);
|
r = vim_strsave((char_u *)enc_canon_table[i].name);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5269,8 +5269,9 @@ convert_input_safe(
|
|||||||
|
|
||||||
d = string_convert_ext(&input_conv, ptr, &dlen,
|
d = string_convert_ext(&input_conv, ptr, &dlen,
|
||||||
restp == NULL ? NULL : &unconvertlen);
|
restp == NULL ? NULL : &unconvertlen);
|
||||||
if (d != NULL)
|
if (d == NULL)
|
||||||
{
|
return dlen;
|
||||||
|
|
||||||
if (dlen <= maxlen)
|
if (dlen <= maxlen)
|
||||||
{
|
{
|
||||||
if (unconvertlen > 0)
|
if (unconvertlen > 0)
|
||||||
@@ -5288,7 +5289,6 @@ convert_input_safe(
|
|||||||
// have done something wrong!)
|
// have done something wrong!)
|
||||||
dlen = len;
|
dlen = len;
|
||||||
vim_free(d);
|
vim_free(d);
|
||||||
}
|
|
||||||
return dlen;
|
return dlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -879,8 +879,9 @@ mf_alloc_bhdr(memfile_T *mfp, int page_count)
|
|||||||
{
|
{
|
||||||
bhdr_T *hp;
|
bhdr_T *hp;
|
||||||
|
|
||||||
if ((hp = ALLOC_ONE(bhdr_T)) != NULL)
|
if ((hp = ALLOC_ONE(bhdr_T)) == NULL)
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
if ((hp->bh_data = alloc((size_t)mfp->mf_page_size * page_count))
|
if ((hp->bh_data = alloc((size_t)mfp->mf_page_size * page_count))
|
||||||
== NULL)
|
== NULL)
|
||||||
{
|
{
|
||||||
@@ -888,7 +889,6 @@ mf_alloc_bhdr(memfile_T *mfp, int page_count)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
hp->bh_page_count = page_count;
|
hp->bh_page_count = page_count;
|
||||||
}
|
|
||||||
return hp;
|
return hp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1209,12 +1209,12 @@ mf_set_ffname(memfile_T *mfp)
|
|||||||
void
|
void
|
||||||
mf_fullname(memfile_T *mfp)
|
mf_fullname(memfile_T *mfp)
|
||||||
{
|
{
|
||||||
if (mfp != NULL && mfp->mf_fname != NULL && mfp->mf_ffname != NULL)
|
if (mfp == NULL || mfp->mf_fname == NULL || mfp->mf_ffname == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
vim_free(mfp->mf_fname);
|
vim_free(mfp->mf_fname);
|
||||||
mfp->mf_fname = mfp->mf_ffname;
|
mfp->mf_fname = mfp->mf_ffname;
|
||||||
mfp->mf_ffname = NULL;
|
mfp->mf_ffname = NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -422,8 +422,9 @@ error:
|
|||||||
static void
|
static void
|
||||||
ml_set_mfp_crypt(buf_T *buf)
|
ml_set_mfp_crypt(buf_T *buf)
|
||||||
{
|
{
|
||||||
if (*buf->b_p_key != NUL)
|
if (*buf->b_p_key == NUL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
int method_nr = crypt_get_method_nr(buf);
|
int method_nr = crypt_get_method_nr(buf);
|
||||||
|
|
||||||
if (method_nr > CRYPT_M_ZIP && method_nr < CRYPT_M_SOD)
|
if (method_nr > CRYPT_M_ZIP && method_nr < CRYPT_M_SOD)
|
||||||
@@ -435,8 +436,7 @@ ml_set_mfp_crypt(buf_T *buf)
|
|||||||
else if (method_nr == CRYPT_M_SOD)
|
else if (method_nr == CRYPT_M_SOD)
|
||||||
crypt_sodium_randombytes_buf(buf->b_ml.ml_mfp->mf_seed,
|
crypt_sodium_randombytes_buf(buf->b_ml.ml_mfp->mf_seed,
|
||||||
MF_SEED_LEN);
|
MF_SEED_LEN);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2090,8 +2090,9 @@ make_percent_swname(char_u *dir, char_u *name)
|
|||||||
char_u *d = NULL, *s, *f;
|
char_u *d = NULL, *s, *f;
|
||||||
|
|
||||||
f = fix_fname(name != NULL ? name : (char_u *)"");
|
f = fix_fname(name != NULL ? name : (char_u *)"");
|
||||||
if (f != NULL)
|
if (f == NULL)
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
s = alloc(STRLEN(f) + 1);
|
s = alloc(STRLEN(f) + 1);
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
{
|
{
|
||||||
@@ -2105,7 +2106,6 @@ make_percent_swname(char_u *dir, char_u *name)
|
|||||||
vim_free(s);
|
vim_free(s);
|
||||||
}
|
}
|
||||||
vim_free(f);
|
vim_free(f);
|
||||||
}
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -5473,8 +5473,9 @@ ml_decrypt_data(
|
|||||||
int text_len;
|
int text_len;
|
||||||
cryptstate_T *state;
|
cryptstate_T *state;
|
||||||
|
|
||||||
if (dp->db_id == DATA_ID)
|
if (dp->db_id != DATA_ID)
|
||||||
{
|
return;
|
||||||
|
|
||||||
head_end = (char_u *)(&dp->db_index[dp->db_line_count]);
|
head_end = (char_u *)(&dp->db_index[dp->db_line_count]);
|
||||||
text_start = (char_u *)dp + dp->db_txt_start;
|
text_start = (char_u *)dp + dp->db_txt_start;
|
||||||
text_len = dp->db_txt_end - dp->db_txt_start;
|
text_len = dp->db_txt_end - dp->db_txt_start;
|
||||||
@@ -5484,13 +5485,12 @@ ml_decrypt_data(
|
|||||||
return; // data was messed up
|
return; // data was messed up
|
||||||
|
|
||||||
state = ml_crypt_prepare(mfp, offset, TRUE);
|
state = ml_crypt_prepare(mfp, offset, TRUE);
|
||||||
if (state != NULL)
|
if (state == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
// Decrypt the text in place.
|
// Decrypt the text in place.
|
||||||
crypt_decode_inplace(state, text_start, text_len, FALSE);
|
crypt_decode_inplace(state, text_start, text_len, FALSE);
|
||||||
crypt_free_state(state);
|
crypt_free_state(state);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
24
src/menu.c
24
src/menu.c
@@ -1763,12 +1763,12 @@ popup_mode_name(char_u *name, int idx)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
p = vim_strnsave(name, len + mode_chars_len);
|
p = vim_strnsave(name, len + mode_chars_len);
|
||||||
if (p != NULL)
|
if (p == NULL)
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
mch_memmove(p + 5 + mode_chars_len, p + 5, (size_t)(len - 4));
|
mch_memmove(p + 5 + mode_chars_len, p + 5, (size_t)(len - 4));
|
||||||
for (i = 0; i < mode_chars_len; ++i)
|
for (i = 0; i < mode_chars_len; ++i)
|
||||||
p[5 + i] = menu_mode_chars[idx][i];
|
p[5 + i] = menu_mode_chars[idx][i];
|
||||||
}
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2008,8 +2008,9 @@ show_popupmenu(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// Only show a popup when it is defined and has entries
|
// Only show a popup when it is defined and has entries
|
||||||
if (menu != NULL && menu->children != NULL)
|
if (menu == NULL || menu->children == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
# if defined(FEAT_GUI)
|
# if defined(FEAT_GUI)
|
||||||
if (gui.in_use)
|
if (gui.in_use)
|
||||||
{
|
{
|
||||||
@@ -2025,7 +2026,6 @@ show_popupmenu(void)
|
|||||||
# if defined(FEAT_TERM_POPUP_MENU)
|
# if defined(FEAT_TERM_POPUP_MENU)
|
||||||
pum_show_popupmenu(menu);
|
pum_show_popupmenu(menu);
|
||||||
# endif
|
# endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2255,8 +2255,9 @@ gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx)
|
|||||||
vimmenu_T menuarg;
|
vimmenu_T menuarg;
|
||||||
|
|
||||||
tbuf = alloc(5 + (unsigned int)STRLEN(tearpath));
|
tbuf = alloc(5 + (unsigned int)STRLEN(tearpath));
|
||||||
if (tbuf != NULL)
|
if (tbuf == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
tbuf[0] = K_SPECIAL;
|
tbuf[0] = K_SPECIAL;
|
||||||
tbuf[1] = K_SECOND(K_TEAROFF);
|
tbuf[1] = K_SECOND(K_TEAROFF);
|
||||||
tbuf[2] = K_THIRD(K_TEAROFF);
|
tbuf[2] = K_THIRD(K_TEAROFF);
|
||||||
@@ -2287,7 +2288,6 @@ gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx)
|
|||||||
|
|
||||||
pri_tab[pri_idx + 1] = t;
|
pri_tab[pri_idx + 1] = t;
|
||||||
vim_free(tbuf);
|
vim_free(tbuf);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2789,8 +2789,9 @@ menutrans_lookup(char_u *name, int len)
|
|||||||
name[len] = NUL;
|
name[len] = NUL;
|
||||||
dname = menu_text(name, NULL, NULL);
|
dname = menu_text(name, NULL, NULL);
|
||||||
name[len] = i;
|
name[len] = i;
|
||||||
if (dname != NULL)
|
if (dname == NULL)
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < menutrans_ga.ga_len; ++i)
|
for (i = 0; i < menutrans_ga.ga_len; ++i)
|
||||||
if (STRICMP(dname, tp[i].from_noamp) == 0)
|
if (STRICMP(dname, tp[i].from_noamp) == 0)
|
||||||
{
|
{
|
||||||
@@ -2798,7 +2799,6 @@ menutrans_lookup(char_u *name, int len)
|
|||||||
return tp[i].to;
|
return tp[i].to;
|
||||||
}
|
}
|
||||||
vim_free(dname);
|
vim_free(dname);
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -375,15 +375,13 @@ smsg(const char *s, ...)
|
|||||||
// give the raw message so the user at least gets a hint.
|
// give the raw message so the user at least gets a hint.
|
||||||
return msg((char *)s);
|
return msg((char *)s);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
va_list arglist;
|
va_list arglist;
|
||||||
|
|
||||||
va_start(arglist, s);
|
va_start(arglist, s);
|
||||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||||
va_end(arglist);
|
va_end(arglist);
|
||||||
return msg((char *)IObuff);
|
return msg((char *)IObuff);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -395,15 +393,13 @@ smsg_attr(int attr, const char *s, ...)
|
|||||||
// give the raw message so the user at least gets a hint.
|
// give the raw message so the user at least gets a hint.
|
||||||
return msg_attr((char *)s, attr);
|
return msg_attr((char *)s, attr);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
va_list arglist;
|
va_list arglist;
|
||||||
|
|
||||||
va_start(arglist, s);
|
va_start(arglist, s);
|
||||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||||
va_end(arglist);
|
va_end(arglist);
|
||||||
return msg_attr((char *)IObuff, attr);
|
return msg_attr((char *)IObuff, attr);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -415,15 +411,13 @@ smsg_attr_keep(int attr, const char *s, ...)
|
|||||||
// give the raw message so the user at least gets a hint.
|
// give the raw message so the user at least gets a hint.
|
||||||
return msg_attr_keep((char *)s, attr, TRUE);
|
return msg_attr_keep((char *)s, attr, TRUE);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
va_list arglist;
|
va_list arglist;
|
||||||
|
|
||||||
va_start(arglist, s);
|
va_start(arglist, s);
|
||||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||||
va_end(arglist);
|
va_end(arglist);
|
||||||
return msg_attr_keep((char *)IObuff, attr, TRUE);
|
return msg_attr_keep((char *)IObuff, attr, TRUE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -834,8 +828,9 @@ semsg(const char *s, ...)
|
|||||||
void
|
void
|
||||||
iemsg(char *s)
|
iemsg(char *s)
|
||||||
{
|
{
|
||||||
if (!emsg_not_now())
|
if (emsg_not_now())
|
||||||
{
|
return;
|
||||||
|
|
||||||
emsg_core((char_u *)s);
|
emsg_core((char_u *)s);
|
||||||
#if defined(ABORT_ON_INTERNAL_ERROR) && defined(FEAT_EVAL)
|
#if defined(ABORT_ON_INTERNAL_ERROR) && defined(FEAT_EVAL)
|
||||||
set_vim_var_string(VV_ERRMSG, (char_u *)s, -1);
|
set_vim_var_string(VV_ERRMSG, (char_u *)s, -1);
|
||||||
@@ -843,7 +838,6 @@ iemsg(char *s)
|
|||||||
out_flush();
|
out_flush();
|
||||||
abort();
|
abort();
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PROTO // manual proto with __attribute__
|
#ifndef PROTO // manual proto with __attribute__
|
||||||
@@ -856,8 +850,9 @@ iemsg(char *s)
|
|||||||
void
|
void
|
||||||
siemsg(const char *s, ...)
|
siemsg(const char *s, ...)
|
||||||
{
|
{
|
||||||
if (!emsg_not_now())
|
if (emsg_not_now())
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (IObuff == NULL)
|
if (IObuff == NULL)
|
||||||
{
|
{
|
||||||
// Very early in initialisation and already something wrong, just
|
// Very early in initialisation and already something wrong, just
|
||||||
@@ -878,7 +873,6 @@ siemsg(const char *s, ...)
|
|||||||
out_flush();
|
out_flush();
|
||||||
abort();
|
abort();
|
||||||
# endif
|
# endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1006,8 +1000,9 @@ add_msg_hist(
|
|||||||
|
|
||||||
// allocate an entry and add the message at the end of the history
|
// allocate an entry and add the message at the end of the history
|
||||||
p = ALLOC_ONE(struct msg_hist);
|
p = ALLOC_ONE(struct msg_hist);
|
||||||
if (p != NULL)
|
if (p == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
len = (int)STRLEN(s);
|
len = (int)STRLEN(s);
|
||||||
// remove leading and trailing newlines
|
// remove leading and trailing newlines
|
||||||
@@ -1027,7 +1022,6 @@ add_msg_hist(
|
|||||||
if (first_msg_hist == NULL)
|
if (first_msg_hist == NULL)
|
||||||
first_msg_hist = last_msg_hist;
|
first_msg_hist = last_msg_hist;
|
||||||
++msg_hist_len;
|
++msg_hist_len;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -1119,8 +1119,9 @@ vim_beep(unsigned val)
|
|||||||
called_vim_beep = TRUE;
|
called_vim_beep = TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (emsg_silent == 0 && !in_assert_fails)
|
if (emsg_silent != 0 || in_assert_fails)
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (!((bo_flags & val) || (bo_flags & BO_ALL)))
|
if (!((bo_flags & val) || (bo_flags & BO_ALL)))
|
||||||
{
|
{
|
||||||
#ifdef ELAPSED_FUNC
|
#ifdef ELAPSED_FUNC
|
||||||
@@ -1172,7 +1173,6 @@ vim_beep(unsigned val)
|
|||||||
msg_source(HL_ATTR(HLF_W));
|
msg_source(HL_ATTR(HLF_W));
|
||||||
msg_attr(_("Beep!"), HL_ATTR(HLF_W));
|
msg_attr(_("Beep!"), HL_ATTR(HLF_W));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
18
src/misc2.c
18
src/misc2.c
@@ -1130,8 +1130,9 @@ simplify_key(int key, int *modifiers)
|
|||||||
int key0;
|
int key0;
|
||||||
int key1;
|
int key1;
|
||||||
|
|
||||||
if (*modifiers & (MOD_MASK_SHIFT | MOD_MASK_CTRL | MOD_MASK_ALT))
|
if (!(*modifiers & (MOD_MASK_SHIFT | MOD_MASK_CTRL | MOD_MASK_ALT)))
|
||||||
{
|
return key;
|
||||||
|
|
||||||
// TAB is a special case
|
// TAB is a special case
|
||||||
if (key == TAB && (*modifiers & MOD_MASK_SHIFT))
|
if (key == TAB && (*modifiers & MOD_MASK_SHIFT))
|
||||||
{
|
{
|
||||||
@@ -1141,6 +1142,7 @@ simplify_key(int key, int *modifiers)
|
|||||||
key0 = KEY2TERMCAP0(key);
|
key0 = KEY2TERMCAP0(key);
|
||||||
key1 = KEY2TERMCAP1(key);
|
key1 = KEY2TERMCAP1(key);
|
||||||
for (i = 0; modifier_keys_table[i] != NUL; i += MOD_KEYS_ENTRY_SIZE)
|
for (i = 0; modifier_keys_table[i] != NUL; i += MOD_KEYS_ENTRY_SIZE)
|
||||||
|
{
|
||||||
if (key0 == modifier_keys_table[i + 3]
|
if (key0 == modifier_keys_table[i + 3]
|
||||||
&& key1 == modifier_keys_table[i + 4]
|
&& key1 == modifier_keys_table[i + 4]
|
||||||
&& (*modifiers & modifier_keys_table[i]))
|
&& (*modifiers & modifier_keys_table[i]))
|
||||||
@@ -1537,8 +1539,9 @@ find_special_key(
|
|||||||
int
|
int
|
||||||
may_adjust_key_for_ctrl(int modifiers, int key)
|
may_adjust_key_for_ctrl(int modifiers, int key)
|
||||||
{
|
{
|
||||||
if (modifiers & MOD_MASK_CTRL)
|
if (!(modifiers & MOD_MASK_CTRL))
|
||||||
{
|
return key;
|
||||||
|
|
||||||
if (ASCII_ISALPHA(key))
|
if (ASCII_ISALPHA(key))
|
||||||
{
|
{
|
||||||
#ifdef FEAT_TERMINAL
|
#ifdef FEAT_TERMINAL
|
||||||
@@ -1552,7 +1555,6 @@ may_adjust_key_for_ctrl(int modifiers, int key)
|
|||||||
return '^';
|
return '^';
|
||||||
if (key == '-')
|
if (key == '-')
|
||||||
return '_';
|
return '_';
|
||||||
}
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2820,8 +2822,9 @@ read_string(FILE *fd, int cnt)
|
|||||||
|
|
||||||
// allocate memory
|
// allocate memory
|
||||||
str = alloc(cnt + 1);
|
str = alloc(cnt + 1);
|
||||||
if (str != NULL)
|
if (str == NULL)
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
// Read the string. Quit when running into the EOF.
|
// Read the string. Quit when running into the EOF.
|
||||||
for (i = 0; i < cnt; ++i)
|
for (i = 0; i < cnt; ++i)
|
||||||
{
|
{
|
||||||
@@ -2834,7 +2837,6 @@ read_string(FILE *fd, int cnt)
|
|||||||
str[i] = c;
|
str[i] = c;
|
||||||
}
|
}
|
||||||
str[i] = NUL;
|
str[i] = NUL;
|
||||||
}
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
src/move.c
33
src/move.c
@@ -244,15 +244,15 @@ skipcol_from_plines(win_T *wp, int plines_off)
|
|||||||
static void
|
static void
|
||||||
reset_skipcol(void)
|
reset_skipcol(void)
|
||||||
{
|
{
|
||||||
if (curwin->w_skipcol != 0)
|
if (curwin->w_skipcol == 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
curwin->w_skipcol = 0;
|
curwin->w_skipcol = 0;
|
||||||
|
|
||||||
// Should use the least expensive way that displays all that changed.
|
// Should use the least expensive way that displays all that changed.
|
||||||
// UPD_NOT_VALID is too expensive, UPD_REDRAW_TOP does not redraw
|
// UPD_NOT_VALID is too expensive, UPD_REDRAW_TOP does not redraw
|
||||||
// enough when the top line gets another screen line.
|
// enough when the top line gets another screen line.
|
||||||
redraw_later(UPD_SOME_VALID);
|
redraw_later(UPD_SOME_VALID);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -980,8 +980,10 @@ validate_virtcol(void)
|
|||||||
validate_virtcol_win(win_T *wp)
|
validate_virtcol_win(win_T *wp)
|
||||||
{
|
{
|
||||||
check_cursor_moved(wp);
|
check_cursor_moved(wp);
|
||||||
if (!(wp->w_valid & VALID_VIRTCOL))
|
|
||||||
{
|
if (wp->w_valid & VALID_VIRTCOL)
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef FEAT_PROP_POPUP
|
#ifdef FEAT_PROP_POPUP
|
||||||
wp->w_virtcol_first_char = 0;
|
wp->w_virtcol_first_char = 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -990,7 +992,6 @@ validate_virtcol_win(win_T *wp)
|
|||||||
redraw_for_cursorcolumn(wp);
|
redraw_for_cursorcolumn(wp);
|
||||||
#endif
|
#endif
|
||||||
wp->w_valid |= VALID_VIRTCOL;
|
wp->w_valid |= VALID_VIRTCOL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1000,8 +1001,10 @@ validate_virtcol_win(win_T *wp)
|
|||||||
validate_cheight(void)
|
validate_cheight(void)
|
||||||
{
|
{
|
||||||
check_cursor_moved(curwin);
|
check_cursor_moved(curwin);
|
||||||
if (!(curwin->w_valid & VALID_CHEIGHT))
|
|
||||||
{
|
if (curwin->w_valid & VALID_CHEIGHT)
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
if (curwin->w_cursor.lnum == curwin->w_topline)
|
if (curwin->w_cursor.lnum == curwin->w_topline)
|
||||||
curwin->w_cline_height = plines_nofill(curwin->w_cursor.lnum)
|
curwin->w_cline_height = plines_nofill(curwin->w_cursor.lnum)
|
||||||
@@ -1013,7 +1016,6 @@ validate_cheight(void)
|
|||||||
curwin->w_cline_folded = hasFolding(curwin->w_cursor.lnum, NULL, NULL);
|
curwin->w_cline_folded = hasFolding(curwin->w_cursor.lnum, NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
curwin->w_valid |= VALID_CHEIGHT;
|
curwin->w_valid |= VALID_CHEIGHT;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1027,8 +1029,10 @@ validate_cursor_col(void)
|
|||||||
int width;
|
int width;
|
||||||
|
|
||||||
validate_virtcol();
|
validate_virtcol();
|
||||||
if (!(curwin->w_valid & VALID_WCOL))
|
|
||||||
{
|
if (curwin->w_valid & VALID_WCOL)
|
||||||
|
return;
|
||||||
|
|
||||||
col = curwin->w_virtcol;
|
col = curwin->w_virtcol;
|
||||||
off = curwin_col_off();
|
off = curwin_col_off();
|
||||||
col += off;
|
col += off;
|
||||||
@@ -1050,7 +1054,6 @@ validate_cursor_col(void)
|
|||||||
#ifdef FEAT_PROP_POPUP
|
#ifdef FEAT_PROP_POPUP
|
||||||
curwin->w_flags &= ~WFLAG_WCOL_OFF_ADDED;
|
curwin->w_flags &= ~WFLAG_WCOL_OFF_ADDED;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1999,8 +2002,9 @@ check_topfill(
|
|||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (wp->w_topfill > 0)
|
if (wp->w_topfill <= 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
n = plines_win_nofill(wp, wp->w_topline, TRUE);
|
n = plines_win_nofill(wp, wp->w_topline, TRUE);
|
||||||
if (wp->w_topfill + n > wp->w_height)
|
if (wp->w_topfill + n > wp->w_height)
|
||||||
{
|
{
|
||||||
@@ -2016,7 +2020,6 @@ check_topfill(
|
|||||||
wp->w_topfill = 0;
|
wp->w_topfill = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1196,
|
||||||
/**/
|
/**/
|
||||||
1195,
|
1195,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user