mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 9.0.1245: 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 #11879)
This commit is contained in:
committed by
Bram Moolenaar
parent
0f843ef091
commit
032713f829
18
src/tag.c
18
src/tag.c
@@ -3263,8 +3263,9 @@ static garray_T tag_fnames = GA_EMPTY;
|
|||||||
static void
|
static void
|
||||||
found_tagfile_cb(char_u *fname, void *cookie UNUSED)
|
found_tagfile_cb(char_u *fname, void *cookie UNUSED)
|
||||||
{
|
{
|
||||||
if (ga_grow(&tag_fnames, 1) == OK)
|
if (ga_grow(&tag_fnames, 1) == FAIL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
char_u *tag_fname = vim_strsave(fname);
|
char_u *tag_fname = vim_strsave(fname);
|
||||||
|
|
||||||
#ifdef BACKSLASH_IN_FILENAME
|
#ifdef BACKSLASH_IN_FILENAME
|
||||||
@@ -3273,7 +3274,6 @@ found_tagfile_cb(char_u *fname, void *cookie UNUSED)
|
|||||||
simplify_filename(tag_fname);
|
simplify_filename(tag_fname);
|
||||||
((char_u **)(tag_fnames.ga_data))[tag_fnames.ga_len++] = tag_fname;
|
((char_u **)(tag_fnames.ga_data))[tag_fnames.ga_len++] = tag_fname;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(EXITFREE) || defined(PROTO)
|
#if defined(EXITFREE) || defined(PROTO)
|
||||||
void
|
void
|
||||||
@@ -3587,8 +3587,9 @@ parse_match(
|
|||||||
tagp->tagline = 0;
|
tagp->tagline = 0;
|
||||||
tagp->command_end = NULL;
|
tagp->command_end = NULL;
|
||||||
|
|
||||||
if (retval == OK)
|
if (retval != OK)
|
||||||
{
|
return retval;
|
||||||
|
|
||||||
// Try to find a kind field: "kind:<kind>" or just "<kind>"
|
// Try to find a kind field: "kind:<kind>" or just "<kind>"
|
||||||
p = tagp->command;
|
p = tagp->command;
|
||||||
if (find_extra(&p) == OK)
|
if (find_extra(&p) == OK)
|
||||||
@@ -3635,7 +3636,6 @@ parse_match(
|
|||||||
;
|
;
|
||||||
tagp->user_data_end = p;
|
tagp->user_data_end = p;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4372,8 +4372,9 @@ get_tags(list_T *list, char_u *pat, char_u *buf_fname)
|
|||||||
|
|
||||||
ret = find_tags(pat, &num_matches, &matches,
|
ret = find_tags(pat, &num_matches, &matches,
|
||||||
TAG_REGEXP | TAG_NOIC, (int)MAXCOL, buf_fname);
|
TAG_REGEXP | TAG_NOIC, (int)MAXCOL, buf_fname);
|
||||||
if (ret == OK && num_matches > 0)
|
if (ret != OK || num_matches <= 0)
|
||||||
{
|
return ret;
|
||||||
|
|
||||||
for (i = 0; i < num_matches; ++i)
|
for (i = 0; i < num_matches; ++i)
|
||||||
{
|
{
|
||||||
if (parse_match(matches[i], &tp) == FAIL)
|
if (parse_match(matches[i], &tp) == FAIL)
|
||||||
@@ -4459,7 +4460,6 @@ get_tags(list_T *list, char_u *pat, char_u *buf_fname)
|
|||||||
vim_free(matches[i]);
|
vim_free(matches[i]);
|
||||||
}
|
}
|
||||||
vim_free(matches);
|
vim_free(matches);
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
108
src/term.c
108
src/term.c
@@ -1644,8 +1644,9 @@ set_color_count(int nr)
|
|||||||
static void
|
static void
|
||||||
may_adjust_color_count(int val)
|
may_adjust_color_count(int val)
|
||||||
{
|
{
|
||||||
if (val != t_colors)
|
if (val == t_colors)
|
||||||
{
|
return;
|
||||||
|
|
||||||
// Nr of colors changed, initialize highlighting and redraw everything.
|
// Nr of colors changed, initialize highlighting and redraw everything.
|
||||||
// This causes a redraw, which usually clears the message. Try keeping
|
// This causes a redraw, which usually clears the message. Try keeping
|
||||||
// the message if it might work.
|
// the message if it might work.
|
||||||
@@ -1662,7 +1663,6 @@ may_adjust_color_count(int val)
|
|||||||
redraw_asap(UPD_CLEAR);
|
redraw_asap(UPD_CLEAR);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_TGETENT
|
#ifdef HAVE_TGETENT
|
||||||
static char *(key_names[]) =
|
static char *(key_names[]) =
|
||||||
@@ -2419,14 +2419,15 @@ getlinecol(
|
|||||||
{
|
{
|
||||||
char_u tbuf[TBUFSZ];
|
char_u tbuf[TBUFSZ];
|
||||||
|
|
||||||
if (T_NAME != NULL && *T_NAME != NUL && invoke_tgetent(tbuf, T_NAME) == NULL)
|
if (T_NAME == NULL || *T_NAME == NUL
|
||||||
{
|
|| invoke_tgetent(tbuf, T_NAME) != NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (*cp == 0)
|
if (*cp == 0)
|
||||||
*cp = tgetnum("co");
|
*cp = tgetnum("co");
|
||||||
if (*rp == 0)
|
if (*rp == 0)
|
||||||
*rp = tgetnum("li");
|
*rp = tgetnum("li");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif // defined(HAVE_TGETENT) && defined(UNIX)
|
#endif // defined(HAVE_TGETENT) && defined(UNIX)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2569,15 +2570,15 @@ term_is_8bit(char_u *name)
|
|||||||
static int
|
static int
|
||||||
term_7to8bit(char_u *p)
|
term_7to8bit(char_u *p)
|
||||||
{
|
{
|
||||||
if (*p == ESC)
|
if (*p != ESC)
|
||||||
{
|
return 0;
|
||||||
|
|
||||||
if (p[1] == '[')
|
if (p[1] == '[')
|
||||||
return CSI;
|
return CSI;
|
||||||
if (p[1] == ']')
|
else if (p[1] == ']')
|
||||||
return OSC;
|
return OSC;
|
||||||
if (p[1] == 'O')
|
else if (p[1] == 'O')
|
||||||
return 0x8f;
|
return 0x8f;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2712,8 +2713,9 @@ out_flush(void)
|
|||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (out_pos != 0)
|
if (out_pos == 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
// set out_pos to 0 before ui_write, to avoid recursiveness
|
// set out_pos to 0 before ui_write, to avoid recursiveness
|
||||||
len = out_pos;
|
len = out_pos;
|
||||||
out_pos = 0;
|
out_pos = 0;
|
||||||
@@ -2733,7 +2735,6 @@ out_flush(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* out_flush_cursor(): flush the output buffer and redraw the cursor.
|
* out_flush_cursor(): flush the output buffer and redraw the cursor.
|
||||||
@@ -2846,8 +2847,9 @@ out_str_nf(char_u *s)
|
|||||||
void
|
void
|
||||||
out_str_cf(char_u *s)
|
out_str_cf(char_u *s)
|
||||||
{
|
{
|
||||||
if (s != NULL && *s)
|
if (s == NULL || *s == NUL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
#ifdef HAVE_TGETENT
|
#ifdef HAVE_TGETENT
|
||||||
char_u *p;
|
char_u *p;
|
||||||
#endif
|
#endif
|
||||||
@@ -2906,7 +2908,6 @@ out_str_cf(char_u *s)
|
|||||||
if (p_wd)
|
if (p_wd)
|
||||||
out_flush();
|
out_flush();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* out_str(s): Put a character string a byte at a time into the output buffer.
|
* out_str(s): Put a character string a byte at a time into the output buffer.
|
||||||
@@ -2917,8 +2918,9 @@ out_str_cf(char_u *s)
|
|||||||
void
|
void
|
||||||
out_str(char_u *s)
|
out_str(char_u *s)
|
||||||
{
|
{
|
||||||
if (s != NULL && *s)
|
if (s == NULL || *s == NUL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
// Don't use tputs() when GUI is used, ncurses crashes.
|
// Don't use tputs() when GUI is used, ncurses crashes.
|
||||||
if (gui.in_use)
|
if (gui.in_use)
|
||||||
@@ -2941,7 +2943,6 @@ out_str(char_u *s)
|
|||||||
if (p_wd)
|
if (p_wd)
|
||||||
out_flush();
|
out_flush();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* cursor positioning using termcap parser. (jw)
|
* cursor positioning using termcap parser. (jw)
|
||||||
@@ -3468,14 +3469,13 @@ get_long_from_buf(char_u *buf, long_u *val)
|
|||||||
|
|
||||||
*val = 0;
|
*val = 0;
|
||||||
len = get_bytes_from_buf(buf, bytes, (int)sizeof(long_u));
|
len = get_bytes_from_buf(buf, bytes, (int)sizeof(long_u));
|
||||||
if (len != -1)
|
if (len == -1)
|
||||||
{
|
return -1;
|
||||||
for (i = 0; i < (int)sizeof(long_u); i++)
|
for (i = 0; i < (int)sizeof(long_u); i++)
|
||||||
{
|
{
|
||||||
shift = 8 * (sizeof(long_u) - 1 - i);
|
shift = 8 * (sizeof(long_u) - 1 - i);
|
||||||
*val += (long_u)bytes[i] << shift;
|
*val += (long_u)bytes[i] << shift;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -3598,20 +3598,20 @@ shell_resized_check(void)
|
|||||||
int old_Rows = Rows;
|
int old_Rows = Rows;
|
||||||
int old_Columns = Columns;
|
int old_Columns = Columns;
|
||||||
|
|
||||||
if (!exiting
|
if (exiting
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
// Do not get the size when executing a shell command during
|
// Do not get the size when executing a shell command during
|
||||||
// startup.
|
// startup.
|
||||||
&& !gui.starting
|
|| gui.starting
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
return;
|
||||||
|
|
||||||
(void)ui_get_shellsize();
|
(void)ui_get_shellsize();
|
||||||
check_shellsize();
|
check_shellsize();
|
||||||
if (old_Rows != Rows || old_Columns != Columns)
|
if (old_Rows != Rows || old_Columns != Columns)
|
||||||
shell_resized();
|
shell_resized();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set size of the Vim shell.
|
* Set size of the Vim shell.
|
||||||
@@ -3843,8 +3843,9 @@ settmode(tmode_T tmode)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (full_screen)
|
if (!full_screen)
|
||||||
{
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When returning after calling a shell cur_tmode is TMODE_UNKNOWN,
|
* When returning after calling a shell cur_tmode is TMODE_UNKNOWN,
|
||||||
* set the terminal to raw mode, even though we think it already is,
|
* set the terminal to raw mode, even though we think it already is,
|
||||||
@@ -3902,13 +3903,13 @@ settmode(tmode_T tmode)
|
|||||||
may_req_termresponse();
|
may_req_termresponse();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
starttermcap(void)
|
starttermcap(void)
|
||||||
{
|
{
|
||||||
if (full_screen && !termcap_active)
|
if (!full_screen || termcap_active)
|
||||||
{
|
return;
|
||||||
|
|
||||||
MAY_WANT_TO_LOG_THIS;
|
MAY_WANT_TO_LOG_THIS;
|
||||||
|
|
||||||
out_str(T_TI); // start termcap mode
|
out_str(T_TI); // start termcap mode
|
||||||
@@ -3938,15 +3939,16 @@ starttermcap(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
stoptermcap(void)
|
stoptermcap(void)
|
||||||
{
|
{
|
||||||
screen_stop_highlight();
|
screen_stop_highlight();
|
||||||
reset_cterm_colors();
|
reset_cterm_colors();
|
||||||
if (termcap_active)
|
|
||||||
{
|
if (!termcap_active)
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef FEAT_TERMRESPONSE
|
#ifdef FEAT_TERMRESPONSE
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
if (!gui.in_use && !gui.starting)
|
if (!gui.in_use && !gui.starting)
|
||||||
@@ -4002,7 +4004,6 @@ stoptermcap(void)
|
|||||||
screen_start(); // don't know where cursor is now
|
screen_start(); // don't know where cursor is now
|
||||||
out_flush();
|
out_flush();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(FEAT_TERMRESPONSE) || defined(PROTO)
|
#if defined(FEAT_TERMRESPONSE) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
@@ -4219,14 +4220,14 @@ swapping_screen(void)
|
|||||||
void
|
void
|
||||||
scroll_start(void)
|
scroll_start(void)
|
||||||
{
|
{
|
||||||
if (*T_VS != NUL && *T_CVS != NUL)
|
if (*T_VS == NUL || *T_CVS == NUL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
MAY_WANT_TO_LOG_THIS;
|
MAY_WANT_TO_LOG_THIS;
|
||||||
out_str(T_VS);
|
out_str(T_VS);
|
||||||
out_str(T_CVS);
|
out_str(T_CVS);
|
||||||
screen_start(); // don't know where cursor is now
|
screen_start(); // don't know where cursor is now
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// True if cursor is not visible
|
// True if cursor is not visible
|
||||||
static int cursor_is_off = FALSE;
|
static int cursor_is_off = FALSE;
|
||||||
@@ -4355,14 +4356,14 @@ term_cursor_mode(int forced)
|
|||||||
void
|
void
|
||||||
term_cursor_color(char_u *color)
|
term_cursor_color(char_u *color)
|
||||||
{
|
{
|
||||||
if (*T_CSC != NUL)
|
if (*T_CSC == NUL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
out_str(T_CSC); // set cursor color start
|
out_str(T_CSC); // set cursor color start
|
||||||
out_str_nf(color);
|
out_str_nf(color);
|
||||||
out_str(T_CEC); // set cursor color end
|
out_str(T_CEC); // set cursor color end
|
||||||
out_flush();
|
out_flush();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -4922,8 +4923,9 @@ modifiers2keycode(int modifiers, int *key, char_u *string)
|
|||||||
{
|
{
|
||||||
int new_slen = 0;
|
int new_slen = 0;
|
||||||
|
|
||||||
if (modifiers != 0)
|
if (modifiers == 0)
|
||||||
{
|
return 0;
|
||||||
|
|
||||||
// Some keys have the modifier included. Need to handle that here to
|
// Some keys have the modifier included. Need to handle that here to
|
||||||
// make mappings work. This may result in a special key, such as
|
// make mappings work. This may result in a special key, such as
|
||||||
// K_S_TAB.
|
// K_S_TAB.
|
||||||
@@ -4934,7 +4936,6 @@ modifiers2keycode(int modifiers, int *key, char_u *string)
|
|||||||
string[new_slen++] = (int)KS_MODIFIER;
|
string[new_slen++] = (int)KS_MODIFIER;
|
||||||
string[new_slen++] = modifiers;
|
string[new_slen++] = modifiers;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return new_slen;
|
return new_slen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6523,13 +6524,13 @@ check_termcode(
|
|||||||
void
|
void
|
||||||
term_get_fg_color(char_u *r, char_u *g, char_u *b)
|
term_get_fg_color(char_u *r, char_u *g, char_u *b)
|
||||||
{
|
{
|
||||||
if (rfg_status.tr_progress == STATUS_GOT)
|
if (rfg_status.tr_progress != STATUS_GOT)
|
||||||
{
|
return;
|
||||||
|
|
||||||
*r = fg_r;
|
*r = fg_r;
|
||||||
*g = fg_g;
|
*g = fg_g;
|
||||||
*b = fg_b;
|
*b = fg_b;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the text background color, if known.
|
* Get the text background color, if known.
|
||||||
@@ -6537,13 +6538,13 @@ term_get_fg_color(char_u *r, char_u *g, char_u *b)
|
|||||||
void
|
void
|
||||||
term_get_bg_color(char_u *r, char_u *g, char_u *b)
|
term_get_bg_color(char_u *r, char_u *g, char_u *b)
|
||||||
{
|
{
|
||||||
if (rbg_status.tr_progress == STATUS_GOT)
|
if (rbg_status.tr_progress != STATUS_GOT)
|
||||||
{
|
return;
|
||||||
|
|
||||||
*r = bg_r;
|
*r = bg_r;
|
||||||
*g = bg_g;
|
*g = bg_g;
|
||||||
*b = bg_b;
|
*b = bg_b;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -7283,15 +7284,14 @@ find_first_tcap(
|
|||||||
int code)
|
int code)
|
||||||
{
|
{
|
||||||
tcap_entry_T *p = find_builtin_term(name);
|
tcap_entry_T *p = find_builtin_term(name);
|
||||||
if (p != NULL)
|
if (p == NULL)
|
||||||
{
|
return NULL;
|
||||||
while (p->bt_string != NULL)
|
while (p->bt_string != NULL)
|
||||||
{
|
{
|
||||||
if (p->bt_entry == code)
|
if (p->bt_entry == code)
|
||||||
return p;
|
return p;
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
107
src/terminal.c
107
src/terminal.c
@@ -259,8 +259,9 @@ parse_termwinsize(win_T *wp, int *rows, int *cols)
|
|||||||
*rows = 0;
|
*rows = 0;
|
||||||
*cols = 0;
|
*cols = 0;
|
||||||
|
|
||||||
if (*wp->w_p_tws != NUL)
|
if (*wp->w_p_tws == NUL)
|
||||||
{
|
return FALSE;
|
||||||
|
|
||||||
char_u *p = vim_strchr(wp->w_p_tws, 'x');
|
char_u *p = vim_strchr(wp->w_p_tws, 'x');
|
||||||
|
|
||||||
// Syntax of value was already checked when it's set.
|
// Syntax of value was already checked when it's set.
|
||||||
@@ -271,7 +272,6 @@ parse_termwinsize(win_T *wp, int *rows, int *cols)
|
|||||||
}
|
}
|
||||||
*rows = atoi((char *)wp->w_p_tws);
|
*rows = atoi((char *)wp->w_p_tws);
|
||||||
*cols = atoi((char *)p + 1);
|
*cols = atoi((char *)p + 1);
|
||||||
}
|
|
||||||
return minsize;
|
return minsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1620,10 +1620,11 @@ term_job_running_check(term_T *term, int check_job_status)
|
|||||||
{
|
{
|
||||||
// Also consider the job finished when the channel is closed, to avoid a
|
// Also consider the job finished when the channel is closed, to avoid a
|
||||||
// race condition when updating the title.
|
// race condition when updating the title.
|
||||||
if (term != NULL
|
if (term == NULL
|
||||||
&& term->tl_job != NULL
|
|| term->tl_job == NULL
|
||||||
&& channel_is_open(term->tl_job->jv_channel))
|
|| !channel_is_open(term->tl_job->jv_channel))
|
||||||
{
|
return FALSE;
|
||||||
|
|
||||||
job_T *job = term->tl_job;
|
job_T *job = term->tl_job;
|
||||||
|
|
||||||
// Careful: Checking the job status may invoke callbacks, which close
|
// Careful: Checking the job status may invoke callbacks, which close
|
||||||
@@ -1634,8 +1635,6 @@ term_job_running_check(term_T *term, int check_job_status)
|
|||||||
return (job->jv_status == JOB_STARTED
|
return (job->jv_status == JOB_STARTED
|
||||||
|| (job->jv_channel != NULL && job->jv_channel->ch_keep_open));
|
|| (job->jv_channel != NULL && job->jv_channel->ch_keep_open));
|
||||||
}
|
}
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return TRUE if the job for "term" is still running.
|
* Return TRUE if the job for "term" is still running.
|
||||||
@@ -1807,8 +1806,9 @@ equal_celattr(cellattr_T *a, cellattr_T *b)
|
|||||||
static int
|
static int
|
||||||
add_empty_scrollback(term_T *term, cellattr_T *fill_attr, int lnum)
|
add_empty_scrollback(term_T *term, cellattr_T *fill_attr, int lnum)
|
||||||
{
|
{
|
||||||
if (ga_grow(&term->tl_scrollback, 1) == OK)
|
if (ga_grow(&term->tl_scrollback, 1) == FAIL)
|
||||||
{
|
return FALSE;
|
||||||
|
|
||||||
sb_line_T *line = (sb_line_T *)term->tl_scrollback.ga_data
|
sb_line_T *line = (sb_line_T *)term->tl_scrollback.ga_data
|
||||||
+ term->tl_scrollback.ga_len;
|
+ term->tl_scrollback.ga_len;
|
||||||
|
|
||||||
@@ -1828,8 +1828,6 @@ add_empty_scrollback(term_T *term, cellattr_T *fill_attr, int lnum)
|
|||||||
++term->tl_scrollback.ga_len;
|
++term->tl_scrollback.ga_len;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove the terminal contents from the scrollback and the buffer.
|
* Remove the terminal contents from the scrollback and the buffer.
|
||||||
@@ -2409,8 +2407,9 @@ term_paste_register(int prev_c UNUSED)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
l = (list_T *)get_reg_contents(c, GREG_LIST);
|
l = (list_T *)get_reg_contents(c, GREG_LIST);
|
||||||
if (l != NULL)
|
if (l == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
type = get_reg_type(c, ®len);
|
type = get_reg_type(c, ®len);
|
||||||
FOR_ALL_LIST_ITEMS(l, item)
|
FOR_ALL_LIST_ITEMS(l, item)
|
||||||
{
|
{
|
||||||
@@ -2446,7 +2445,6 @@ term_paste_register(int prev_c UNUSED)
|
|||||||
}
|
}
|
||||||
list_free(l);
|
list_free(l);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return TRUE when waiting for a character in the terminal, the cursor of the
|
* Return TRUE when waiting for a character in the terminal, the cursor of the
|
||||||
@@ -2615,8 +2613,9 @@ term_win_entered()
|
|||||||
{
|
{
|
||||||
term_T *term = curbuf->b_term;
|
term_T *term = curbuf->b_term;
|
||||||
|
|
||||||
if (term != NULL)
|
if (term == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (term_use_loop_check(TRUE))
|
if (term_use_loop_check(TRUE))
|
||||||
{
|
{
|
||||||
reset_VIsual_and_resel();
|
reset_VIsual_and_resel();
|
||||||
@@ -2627,15 +2626,15 @@ term_win_entered()
|
|||||||
enter_mouse_col = mouse_col;
|
enter_mouse_col = mouse_col;
|
||||||
enter_mouse_row = mouse_row;
|
enter_mouse_row = mouse_row;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
term_focus_change(int in_focus)
|
term_focus_change(int in_focus)
|
||||||
{
|
{
|
||||||
term_T *term = curbuf->b_term;
|
term_T *term = curbuf->b_term;
|
||||||
|
|
||||||
if (term != NULL && term->tl_vterm != NULL)
|
if (term == NULL || term->tl_vterm == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
VTermState *state = vterm_obtain_state(term->tl_vterm);
|
VTermState *state = vterm_obtain_state(term->tl_vterm);
|
||||||
|
|
||||||
if (in_focus)
|
if (in_focus)
|
||||||
@@ -2644,7 +2643,6 @@ term_focus_change(int in_focus)
|
|||||||
vterm_state_focus_out(state);
|
vterm_state_focus_out(state);
|
||||||
term_forward_output(term);
|
term_forward_output(term);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* vgetc() may not include CTRL in the key when modify_other_keys is set.
|
* vgetc() may not include CTRL in the key when modify_other_keys is set.
|
||||||
@@ -2886,14 +2884,14 @@ theend:
|
|||||||
static void
|
static void
|
||||||
may_toggle_cursor(term_T *term)
|
may_toggle_cursor(term_T *term)
|
||||||
{
|
{
|
||||||
if (in_terminal_loop == term)
|
if (in_terminal_loop != term)
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (term->tl_cursor_visible)
|
if (term->tl_cursor_visible)
|
||||||
cursor_on();
|
cursor_on();
|
||||||
else
|
else
|
||||||
cursor_off();
|
cursor_off();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reverse engineer the RGB value into a cterm color index.
|
* Reverse engineer the RGB value into a cterm color index.
|
||||||
@@ -3320,8 +3318,9 @@ handle_resize(int rows, int cols, void *user)
|
|||||||
static void
|
static void
|
||||||
limit_scrollback(term_T *term, garray_T *gap, int update_buffer)
|
limit_scrollback(term_T *term, garray_T *gap, int update_buffer)
|
||||||
{
|
{
|
||||||
if (gap->ga_len >= term->tl_buffer->b_p_twsl)
|
if (gap->ga_len < term->tl_buffer->b_p_twsl)
|
||||||
{
|
return;
|
||||||
|
|
||||||
int todo = term->tl_buffer->b_p_twsl / 10;
|
int todo = term->tl_buffer->b_p_twsl / 10;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -3341,7 +3340,6 @@ limit_scrollback(term_T *term, garray_T *gap, int update_buffer)
|
|||||||
if (update_buffer)
|
if (update_buffer)
|
||||||
term->tl_scrollback_scrolled -= todo;
|
term->tl_scrollback_scrolled -= todo;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle a line that is pushed off the top of the screen.
|
* Handle a line that is pushed off the top of the screen.
|
||||||
@@ -3371,8 +3369,9 @@ handle_pushline(int cols, const VTermScreenCell *cells, void *user)
|
|||||||
|
|
||||||
limit_scrollback(term, gap, update_buffer);
|
limit_scrollback(term, gap, update_buffer);
|
||||||
|
|
||||||
if (ga_grow(gap, 1) == OK)
|
if (ga_grow(gap, 1) == FAIL)
|
||||||
{
|
return 0;
|
||||||
|
|
||||||
cellattr_T *p = NULL;
|
cellattr_T *p = NULL;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int i;
|
int i;
|
||||||
@@ -3442,7 +3441,6 @@ handle_pushline(int cols, const VTermScreenCell *cells, void *user)
|
|||||||
ga_init(&ga); // text is kept in tl_scrollback_postponed
|
ga_init(&ga); // text is kept in tl_scrollback_postponed
|
||||||
}
|
}
|
||||||
++gap->ga_len;
|
++gap->ga_len;
|
||||||
}
|
|
||||||
return 0; // ignored
|
return 0; // ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3612,9 +3610,10 @@ term_after_channel_closed(term_T *term)
|
|||||||
int
|
int
|
||||||
may_close_term_popup(void)
|
may_close_term_popup(void)
|
||||||
{
|
{
|
||||||
if (popup_is_popup(curwin) && curbuf->b_term != NULL
|
if (!popup_is_popup(curwin) || curbuf->b_term == NULL
|
||||||
&& !term_job_running_not_none(curbuf->b_term))
|
|| term_job_running_not_none(curbuf->b_term))
|
||||||
{
|
return FAIL;
|
||||||
|
|
||||||
win_T *pwin = curwin;
|
win_T *pwin = curwin;
|
||||||
|
|
||||||
if (win_valid(prevwin))
|
if (win_valid(prevwin))
|
||||||
@@ -3622,8 +3621,6 @@ may_close_term_popup(void)
|
|||||||
popup_close_with_retval(pwin, 0);
|
popup_close_with_retval(pwin, 0);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -4002,13 +3999,13 @@ term_did_update_window(win_T *wp)
|
|||||||
{
|
{
|
||||||
term_T *term = wp->w_buffer->b_term;
|
term_T *term = wp->w_buffer->b_term;
|
||||||
|
|
||||||
if (term != NULL && term->tl_vterm != NULL && !term->tl_normal_mode
|
if (term == NULL || term->tl_vterm == NULL || term->tl_normal_mode
|
||||||
&& wp->w_redr_type == 0)
|
|| wp->w_redr_type != 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
term->tl_dirty_row_start = MAX_ROW;
|
term->tl_dirty_row_start = MAX_ROW;
|
||||||
term->tl_dirty_row_end = 0;
|
term->tl_dirty_row_end = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return TRUE if "wp" is a terminal window where the job has finished.
|
* Return TRUE if "wp" is a terminal window where the job has finished.
|
||||||
@@ -4040,8 +4037,9 @@ term_change_in_curbuf(void)
|
|||||||
{
|
{
|
||||||
term_T *term = curbuf->b_term;
|
term_T *term = curbuf->b_term;
|
||||||
|
|
||||||
if (term_is_finished(curbuf) && term->tl_scrollback.ga_len > 0)
|
if (!term_is_finished(curbuf) || term->tl_scrollback.ga_len <= 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
free_scrollback(term);
|
free_scrollback(term);
|
||||||
redraw_buf_later(term->tl_buffer, UPD_NOT_VALID);
|
redraw_buf_later(term->tl_buffer, UPD_NOT_VALID);
|
||||||
|
|
||||||
@@ -4050,7 +4048,6 @@ term_change_in_curbuf(void)
|
|||||||
set_string_option_direct((char_u *)"buftype", -1,
|
set_string_option_direct((char_u *)"buftype", -1,
|
||||||
(char_u *)"", OPT_FREE|OPT_LOCAL, 0);
|
(char_u *)"", OPT_FREE|OPT_LOCAL, 0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the screen attribute for a position in the buffer.
|
* Get the screen attribute for a position in the buffer.
|
||||||
@@ -4908,8 +4905,9 @@ term_update_colors_all(void)
|
|||||||
char_u *
|
char_u *
|
||||||
term_get_status_text(term_T *term)
|
term_get_status_text(term_T *term)
|
||||||
{
|
{
|
||||||
if (term->tl_status_text == NULL)
|
if (term->tl_status_text != NULL)
|
||||||
{
|
return term->tl_status_text;
|
||||||
|
|
||||||
char_u *txt;
|
char_u *txt;
|
||||||
size_t len;
|
size_t len;
|
||||||
char_u *fname;
|
char_u *fname;
|
||||||
@@ -4935,7 +4933,6 @@ term_get_status_text(term_T *term)
|
|||||||
if (term->tl_status_text != NULL)
|
if (term->tl_status_text != NULL)
|
||||||
vim_snprintf((char *)term->tl_status_text, len, "%s [%s]",
|
vim_snprintf((char *)term->tl_status_text, len, "%s [%s]",
|
||||||
fname, txt);
|
fname, txt);
|
||||||
}
|
|
||||||
return term->tl_status_text;
|
return term->tl_status_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5236,12 +5233,12 @@ dump_is_corrupt(garray_T *gap)
|
|||||||
static void
|
static void
|
||||||
append_cell(garray_T *gap, cellattr_T *cell)
|
append_cell(garray_T *gap, cellattr_T *cell)
|
||||||
{
|
{
|
||||||
if (ga_grow(gap, 1) == OK)
|
if (ga_grow(gap, 1) == FAIL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
*(((cellattr_T *)gap->ga_data) + gap->ga_len) = *cell;
|
*(((cellattr_T *)gap->ga_data) + gap->ga_len) = *cell;
|
||||||
++gap->ga_len;
|
++gap->ga_len;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clear_cellattr(cellattr_T *cell)
|
clear_cellattr(cellattr_T *cell)
|
||||||
@@ -6036,8 +6033,9 @@ f_term_getcursor(typval_T *argvars, typval_T *rettv)
|
|||||||
list_append_number(l, term->tl_cursor_pos.col + 1);
|
list_append_number(l, term->tl_cursor_pos.col + 1);
|
||||||
|
|
||||||
d = dict_alloc();
|
d = dict_alloc();
|
||||||
if (d != NULL)
|
if (d == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
dict_add_number(d, "visible", term->tl_cursor_visible);
|
dict_add_number(d, "visible", term->tl_cursor_visible);
|
||||||
dict_add_number(d, "blink", blink_state_is_inverted()
|
dict_add_number(d, "blink", blink_state_is_inverted()
|
||||||
? !term->tl_cursor_blink : term->tl_cursor_blink);
|
? !term->tl_cursor_blink : term->tl_cursor_blink);
|
||||||
@@ -6045,7 +6043,6 @@ f_term_getcursor(typval_T *argvars, typval_T *rettv)
|
|||||||
dict_add_string(d, "color", cursor_color_get(term->tl_cursor_color));
|
dict_add_string(d, "color", cursor_color_get(term->tl_cursor_color));
|
||||||
list_append_dict(l, d);
|
list_append_dict(l, d);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "term_getjob(buf)" function
|
* "term_getjob(buf)" function
|
||||||
@@ -7692,8 +7689,9 @@ term_free_vterm(term_T *term)
|
|||||||
term_report_winsize(term_T *term, int rows, int cols)
|
term_report_winsize(term_T *term, int rows, int cols)
|
||||||
{
|
{
|
||||||
// Use an ioctl() to report the new window size to the job.
|
// Use an ioctl() to report the new window size to the job.
|
||||||
if (term->tl_job != NULL && term->tl_job->jv_channel != NULL)
|
if (term->tl_job == NULL || term->tl_job->jv_channel == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
int part;
|
int part;
|
||||||
|
|
||||||
@@ -7706,7 +7704,6 @@ term_report_winsize(term_T *term, int rows, int cols)
|
|||||||
if (part < PART_COUNT && mch_report_winsize(fd, rows, cols) == OK)
|
if (part < PART_COUNT && mch_report_winsize(fd, rows, cols) == OK)
|
||||||
mch_signal_job(term->tl_job, (char_u *)"winch");
|
mch_signal_job(term->tl_job, (char_u *)"winch");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
@@ -55,8 +55,10 @@ ga_concat_esc(garray_T *gap, char_u *p, int clen)
|
|||||||
mch_memmove(buf, p, clen);
|
mch_memmove(buf, p, clen);
|
||||||
buf[clen] = NUL;
|
buf[clen] = NUL;
|
||||||
ga_concat(gap, buf);
|
ga_concat(gap, buf);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else switch (*p)
|
|
||||||
|
switch (*p)
|
||||||
{
|
{
|
||||||
case BS: ga_concat(gap, (char_u *)"\\b"); break;
|
case BS: ga_concat(gap, (char_u *)"\\b"); break;
|
||||||
case ESC: ga_concat(gap, (char_u *)"\\e"); break;
|
case ESC: ga_concat(gap, (char_u *)"\\e"); break;
|
||||||
|
@@ -752,8 +752,9 @@ check_auto_format(
|
|||||||
int c = ' ';
|
int c = ' ';
|
||||||
int cc;
|
int cc;
|
||||||
|
|
||||||
if (did_add_space)
|
if (!did_add_space)
|
||||||
{
|
return;
|
||||||
|
|
||||||
cc = gchar_cursor();
|
cc = gchar_cursor();
|
||||||
if (!WHITECHAR(cc))
|
if (!WHITECHAR(cc))
|
||||||
// Somehow the space was removed already.
|
// Somehow the space was removed already.
|
||||||
@@ -774,7 +775,6 @@ check_auto_format(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find out textwidth to be used for formatting:
|
* Find out textwidth to be used for formatting:
|
||||||
|
@@ -1939,8 +1939,9 @@ f_prop_type_delete(typval_T *argvars, typval_T *rettv UNUSED)
|
|||||||
}
|
}
|
||||||
|
|
||||||
hi = find_prop_type_hi(name, buf);
|
hi = find_prop_type_hi(name, buf);
|
||||||
if (hi != NULL)
|
if (hi == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
hashtab_T *ht;
|
hashtab_T *ht;
|
||||||
proptype_T *prop = HI2PT(hi);
|
proptype_T *prop = HI2PT(hi);
|
||||||
|
|
||||||
@@ -1961,7 +1962,6 @@ f_prop_type_delete(typval_T *argvars, typval_T *rettv UNUSED)
|
|||||||
redraw_all_later(UPD_CLEAR);
|
redraw_all_later(UPD_CLEAR);
|
||||||
changed_window_setting_buf(buf == NULL ? curbuf : buf);
|
changed_window_setting_buf(buf == NULL ? curbuf : buf);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* prop_type_get({name} [, {props}])
|
* prop_type_get({name} [, {props}])
|
||||||
@@ -1982,8 +1982,10 @@ f_prop_type_get(typval_T *argvars, typval_T *rettv)
|
|||||||
semsg(_(e_invalid_argument_str), "\"\"");
|
semsg(_(e_invalid_argument_str), "\"\"");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (rettv_dict_alloc(rettv) == OK)
|
|
||||||
{
|
if (rettv_dict_alloc(rettv) == FAIL)
|
||||||
|
return;
|
||||||
|
|
||||||
proptype_T *prop = NULL;
|
proptype_T *prop = NULL;
|
||||||
buf_T *buf = NULL;
|
buf_T *buf = NULL;
|
||||||
|
|
||||||
@@ -1994,8 +1996,9 @@ f_prop_type_get(typval_T *argvars, typval_T *rettv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
prop = find_prop_type(name, buf);
|
prop = find_prop_type(name, buf);
|
||||||
if (prop != NULL)
|
if (prop == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
dict_T *d = rettv->vval.v_dict;
|
dict_T *d = rettv->vval.v_dict;
|
||||||
|
|
||||||
if (prop->pt_hl_id > 0)
|
if (prop->pt_hl_id > 0)
|
||||||
@@ -2010,8 +2013,6 @@ f_prop_type_get(typval_T *argvars, typval_T *rettv)
|
|||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
dict_add_number(d, "bufnr", buf->b_fnum);
|
dict_add_number(d, "bufnr", buf->b_fnum);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
list_types(hashtab_T *ht, list_T *l)
|
list_types(hashtab_T *ht, list_T *l)
|
||||||
@@ -2040,8 +2041,9 @@ f_prop_type_list(typval_T *argvars, typval_T *rettv UNUSED)
|
|||||||
{
|
{
|
||||||
buf_T *buf = NULL;
|
buf_T *buf = NULL;
|
||||||
|
|
||||||
if (rettv_list_alloc(rettv) == OK)
|
if (rettv_list_alloc(rettv) == FAIL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (in_vim9script() && check_for_opt_dict_arg(argvars, 0) == FAIL)
|
if (in_vim9script() && check_for_opt_dict_arg(argvars, 0) == FAIL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -2058,7 +2060,6 @@ f_prop_type_list(typval_T *argvars, typval_T *rettv UNUSED)
|
|||||||
else if (buf->b_proptypes != NULL)
|
else if (buf->b_proptypes != NULL)
|
||||||
list_types(buf->b_proptypes, rettv->vval.v_list);
|
list_types(buf->b_proptypes, rettv->vval.v_list);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free all property types in "ht".
|
* Free all property types in "ht".
|
||||||
|
36
src/time.c
36
src/time.c
@@ -302,9 +302,11 @@ f_strftime(typval_T *argvars, typval_T *rettv)
|
|||||||
curtime = vim_localtime(&seconds, &tmval);
|
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)
|
if (curtime == NULL)
|
||||||
rettv->vval.v_string = vim_strsave((char_u *)_("(Invalid)"));
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
rettv->vval.v_string = vim_strsave((char_u *)_("(Invalid)"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
# ifdef MSWIN
|
# ifdef MSWIN
|
||||||
WCHAR result_buf[256];
|
WCHAR result_buf[256];
|
||||||
WCHAR *wp;
|
WCHAR *wp;
|
||||||
@@ -343,7 +345,6 @@ f_strftime(typval_T *argvars, typval_T *rettv)
|
|||||||
vim_free(enc);
|
vim_free(enc);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined(HAVE_STRPTIME) || defined(PROTO)
|
# if defined(HAVE_STRPTIME) || defined(PROTO)
|
||||||
@@ -672,12 +673,12 @@ find_timer(long id)
|
|||||||
{
|
{
|
||||||
timer_T *timer;
|
timer_T *timer;
|
||||||
|
|
||||||
if (id >= 0)
|
if (id < 0)
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
FOR_ALL_TIMERS(timer)
|
FOR_ALL_TIMERS(timer)
|
||||||
if (timer->tr_id == id)
|
if (timer->tr_id == id)
|
||||||
return timer;
|
return timer;
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -791,7 +792,9 @@ timer_valid(timer_T *timer)
|
|||||||
{
|
{
|
||||||
if (timer == NULL)
|
if (timer == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
for (timer_T *t = first_timer; t != NULL; t = t->tr_next)
|
|
||||||
|
timer_T *t;
|
||||||
|
FOR_ALL_TIMERS(t)
|
||||||
if (t == timer)
|
if (t == timer)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -848,16 +851,17 @@ f_timer_pause(typval_T *argvars, typval_T *rettv UNUSED)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (argvars[0].v_type != VAR_NUMBER)
|
if (argvars[0].v_type != VAR_NUMBER)
|
||||||
emsg(_(e_number_expected));
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
emsg(_(e_number_expected));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int paused = (int)tv_get_bool(&argvars[1]);
|
int paused = (int)tv_get_bool(&argvars[1]);
|
||||||
|
|
||||||
timer = find_timer((int)tv_get_number(&argvars[0]));
|
timer = find_timer((int)tv_get_number(&argvars[0]));
|
||||||
if (timer != NULL)
|
if (timer != NULL)
|
||||||
timer->tr_paused = paused;
|
timer->tr_paused = paused;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "timer_start(time, callback [, options])" function
|
* "timer_start(time, callback [, options])" function
|
||||||
@@ -904,15 +908,15 @@ f_timer_start(typval_T *argvars, typval_T *rettv)
|
|||||||
|
|
||||||
timer = create_timer(msec, repeat);
|
timer = create_timer(msec, repeat);
|
||||||
if (timer == NULL)
|
if (timer == NULL)
|
||||||
free_callback(&callback);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
free_callback(&callback);
|
||||||
|
return;
|
||||||
|
}
|
||||||
set_callback(&timer->tr_callback, &callback);
|
set_callback(&timer->tr_callback, &callback);
|
||||||
if (callback.cb_free_name)
|
if (callback.cb_free_name)
|
||||||
vim_free(callback.cb_name);
|
vim_free(callback.cb_name);
|
||||||
rettv->vval.v_number = (varnumber_T)timer->tr_id;
|
rettv->vval.v_number = (varnumber_T)timer->tr_id;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "timer_stop(timer)" function
|
* "timer_stop(timer)" function
|
||||||
@@ -1019,8 +1023,9 @@ time_msg(
|
|||||||
static struct timeval start;
|
static struct timeval start;
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
|
|
||||||
if (time_fd != NULL)
|
if (time_fd == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (strstr(mesg, "STARTING") != NULL)
|
if (strstr(mesg, "STARTING") != NULL)
|
||||||
{
|
{
|
||||||
gettimeofday(&start, NULL);
|
gettimeofday(&start, NULL);
|
||||||
@@ -1041,7 +1046,6 @@ time_msg(
|
|||||||
prev_timeval = now;
|
prev_timeval = now;
|
||||||
fprintf(time_fd, ": %s\n", mesg);
|
fprintf(time_fd, ": %s\n", mesg);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
# endif // STARTUPTIME
|
# endif // STARTUPTIME
|
||||||
#endif // FEAT_EVAL
|
#endif // FEAT_EVAL
|
||||||
|
|
||||||
|
12
src/typval.c
12
src/typval.c
@@ -52,8 +52,9 @@ alloc_string_tv(char_u *s)
|
|||||||
void
|
void
|
||||||
free_tv(typval_T *varp)
|
free_tv(typval_T *varp)
|
||||||
{
|
{
|
||||||
if (varp != NULL)
|
if (varp == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
switch (varp->v_type)
|
switch (varp->v_type)
|
||||||
{
|
{
|
||||||
case VAR_FUNC:
|
case VAR_FUNC:
|
||||||
@@ -103,7 +104,6 @@ free_tv(typval_T *varp)
|
|||||||
}
|
}
|
||||||
vim_free(varp);
|
vim_free(varp);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free the memory for a variable value and set the value to NULL or 0.
|
* Free the memory for a variable value and set the value to NULL or 0.
|
||||||
@@ -111,8 +111,9 @@ free_tv(typval_T *varp)
|
|||||||
void
|
void
|
||||||
clear_tv(typval_T *varp)
|
clear_tv(typval_T *varp)
|
||||||
{
|
{
|
||||||
if (varp != NULL)
|
if (varp == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
switch (varp->v_type)
|
switch (varp->v_type)
|
||||||
{
|
{
|
||||||
case VAR_FUNC:
|
case VAR_FUNC:
|
||||||
@@ -175,7 +176,6 @@ clear_tv(typval_T *varp)
|
|||||||
}
|
}
|
||||||
varp->v_lock = 0;
|
varp->v_lock = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the value of a variable to NULL without freeing items.
|
* Set the value of a variable to NULL without freeing items.
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
1245,
|
||||||
/**/
|
/**/
|
||||||
1244,
|
1244,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user