From eb40b7ec404e8651137513ced43d503bc6656f17 Mon Sep 17 00:00:00 2001 From: KunMing Xie Date: Wed, 2 Aug 2017 16:22:04 +0800 Subject: vim-patch:8.0.0133 (#7107) Problem: "2;'(" causes ml_get errors in an empty buffer. (Dominique Pelle) Solution: Check the cursor line earlier. https://github.com/vim/vim/commit/fe38b494fff56cd9b2fcaeef26a8fd7b6557d69c --- src/nvim/ex_docmd.c | 13 +++++++------ src/nvim/testdir/test_cmdline.vim | 7 +++++++ src/nvim/version.c | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index d7821fc636..80c75f24c4 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1665,11 +1665,15 @@ static char_u * do_one_cmd(char_u **cmdlinep, ea.addr_count++; if (*ea.cmd == ';') { - if (!ea.skip) + if (!ea.skip) { curwin->w_cursor.lnum = ea.line2; - } else if (*ea.cmd != ',') + // Don't leave the cursor on an illegal line (caused by ';') + check_cursor_lnum(); + } + } else if (*ea.cmd != ',') { break; - ++ea.cmd; + } + ea.cmd++; } /* One address given: set start and end lines */ @@ -1680,9 +1684,6 @@ static char_u * do_one_cmd(char_u **cmdlinep, ea.addr_count = 0; } - /* Don't leave the cursor on an illegal line (caused by ';') */ - check_cursor_lnum(); - /* * 5. Parse the command. */ diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index c3bfae1b7b..09f4b942ad 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -232,3 +232,10 @@ func Test_paste_in_cmdline() call assert_equal('"aaa a;b-c*d bbb', @:) bwipe! endfunc + +func Test_illegal_address() + new + 2;'( + 2;') + quit +endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index 1035963136..a018585976 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -596,7 +596,7 @@ static const int included_patches[] = { 136, 135, // 134, - // 133, + 133, // 132, // 131, // 130 NA -- cgit From 8160a0e04244d054c4555a5a1af09963470964a1 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 3 Aug 2017 09:31:05 +0200 Subject: Revert "vim-patch:8.0.0133 (#7107)" This reverts commit eb40b7ec404e8651137513ced43d503bc6656f17. The change caused this error on QuickBuild: INFO - # test/functional/core/job_spec.lua @ 668: pty process teardown does not prevent/delay exit. #4798 #4900 INFO - not ok 321 - pty process teardown does not prevent/delay exit. #4798 #4900 INFO - # test/functional/core/job_spec.lua @ 668 INFO - # Failure message: ./test/functional/ui/screen.lua:302: Row 1 did not match. INFO - # Expected: INFO - # |* | INFO - # |[Process exited 0] | INFO - # | | INFO - # | | INFO - # | | INFO - # |-- TERMINAL -- | INFO - # Actual: INFO - # |*E575: Error while reading ShaD| INFO - # |a file: mark entry at position| INFO - # | 92 has invalid line number | INFO - # |Press ENTER or type command to| INFO - # | continue | INFO - # |-- TERMINAL -- | INFO - # INFO - # To print the expect() call that would assert the current screen state, use INFO - # screen:snaphot_util(). In case of non-deterministic failures, use INFO - # screen:redraw_debug() to show all intermediate screen states. INFO - # stack traceback: INFO - # ./test/functional/ui/screen.lua:302: in function 'wait' INFO - # ./test/functional/ui/screen.lua:216: in function 'expect' INFO - # test/functional/core/job_spec.lua:677: in function --- src/nvim/ex_docmd.c | 13 ++++++------- src/nvim/testdir/test_cmdline.vim | 7 ------- src/nvim/version.c | 2 +- 3 files changed, 7 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 80c75f24c4..d7821fc636 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1665,15 +1665,11 @@ static char_u * do_one_cmd(char_u **cmdlinep, ea.addr_count++; if (*ea.cmd == ';') { - if (!ea.skip) { + if (!ea.skip) curwin->w_cursor.lnum = ea.line2; - // Don't leave the cursor on an illegal line (caused by ';') - check_cursor_lnum(); - } - } else if (*ea.cmd != ',') { + } else if (*ea.cmd != ',') break; - } - ea.cmd++; + ++ea.cmd; } /* One address given: set start and end lines */ @@ -1684,6 +1680,9 @@ static char_u * do_one_cmd(char_u **cmdlinep, ea.addr_count = 0; } + /* Don't leave the cursor on an illegal line (caused by ';') */ + check_cursor_lnum(); + /* * 5. Parse the command. */ diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 09f4b942ad..c3bfae1b7b 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -232,10 +232,3 @@ func Test_paste_in_cmdline() call assert_equal('"aaa a;b-c*d bbb', @:) bwipe! endfunc - -func Test_illegal_address() - new - 2;'( - 2;') - quit -endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index a018585976..1035963136 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -596,7 +596,7 @@ static const int included_patches[] = { 136, 135, // 134, - 133, + // 133, // 132, // 131, // 130 NA -- cgit From 99aeb607f4753907529e13d4d347ca3551da9cc5 Mon Sep 17 00:00:00 2001 From: lonerover Date: Fri, 4 Aug 2017 19:58:10 +0800 Subject: vim-patch:8.0.0081 Problem: Inconsistent function names. Solution: Rename do_cscope to ex_cscope. Clean up comments. https://github.com/vim/vim/commit/d4db7719bdfbc54df396eac08d8cbb2389feacf4 --- src/nvim/ex_cmds.lua | 8 ++-- src/nvim/ex_docmd.c | 2 +- src/nvim/if_cscope.c | 129 ++++++++++++++------------------------------------- src/nvim/version.c | 2 +- 4 files changed, 40 insertions(+), 101 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua index 46f7a7bc40..5757964f0f 100644 --- a/src/nvim/ex_cmds.lua +++ b/src/nvim/ex_cmds.lua @@ -628,13 +628,13 @@ return { command='cscope', flags=bit.bor(EXTRA, NOTRLCOM, XFILE), addr_type=ADDR_LINES, - func='do_cscope', + func='ex_cscope', }, { command='cstag', flags=bit.bor(BANG, TRLBAR, WORD1), addr_type=ADDR_LINES, - func='do_cstag', + func='ex_cstag', }, { command='cunmap', @@ -1324,7 +1324,7 @@ return { command='lcscope', flags=bit.bor(EXTRA, NOTRLCOM, XFILE), addr_type=ADDR_LINES, - func='do_cscope', + func='ex_cscope', }, { command='ldo', @@ -2334,7 +2334,7 @@ return { command='scscope', flags=bit.bor(EXTRA, NOTRLCOM), addr_type=ADDR_LINES, - func='do_scscope', + func='ex_scscope', }, { command='set', diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index d7821fc636..30156621d6 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -8321,7 +8321,7 @@ static void ex_tag_cmd(exarg_T *eap, char_u *name) break; default: /* ":tag" */ if (p_cst && *eap->arg != NUL) { - do_cstag(eap); + ex_cstag(eap); return; } cmd = DT_TAG; diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index f7706f5a0d..607fd2bbee 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -173,8 +173,6 @@ void set_context_in_cscope_cmd(expand_T *xp, const char *arg, cmdidx_T cmdidx) /* - * PRIVATE: do_cscope_general - * * Find the command, print help if invalid, and then call the corresponding * command function. */ @@ -209,28 +207,25 @@ do_cscope_general ( } /* - * PUBLIC: do_cscope + * Implementation of ":cscope" and ":lcscope" */ -void do_cscope(exarg_T *eap) +void ex_cscope(exarg_T *eap) { do_cscope_general(eap, FALSE); } /* - * PUBLIC: do_scscope - * - * same as do_cscope, but splits window, too. + * Implementation of ":scscope". Same as ex_cscope(), but splits window, too. */ -void do_scscope(exarg_T *eap) +void ex_scscope(exarg_T *eap) { do_cscope_general(eap, TRUE); } /* - * PUBLIC: do_cstag - * + * Implementation of ":cstag" */ -void do_cstag(exarg_T *eap) +void ex_cstag(exarg_T *eap) { int ret = FALSE; @@ -286,13 +281,11 @@ void do_cstag(exarg_T *eap) g_do_tagpreview = 0; } -} /* do_cscope */ +} /* - * PUBLIC: cs_find - * - * this simulates a vim_fgets(), but for cscope, returns the next line + * This simulates a vim_fgets(), but for cscope, returns the next line * from the cscope output. should only be called from find_tags() * * returns TRUE if eof, FALSE otherwise @@ -310,9 +303,7 @@ int cs_fgets(char_u *buf, int size) /* - * PUBLIC: cs_free_tags - * - * called only from do_tag(), when popping the tag stack + * Called only from do_tag(), when popping the tag stack. */ void cs_free_tags(void) { @@ -320,9 +311,7 @@ void cs_free_tags(void) } /* - * PUBLIC: cs_print_tags - * - * called from do_tag() + * Called from do_tag(). */ void cs_print_tags(void) { @@ -405,12 +394,8 @@ int cs_connection(int num, char_u *dbpath, char_u *ppath) ****************************************************************************/ /* - * PRIVATE: cs_add - * - * add cscope database or a directory name (to look for cscope.out) - * to the cscope connection list - * - * MAXPATHL 256 + * Add cscope database or a directory name (to look for cscope.out) + * to the cscope connection list. */ static int cs_add(exarg_T *eap) { @@ -438,10 +423,8 @@ static void cs_stat_emsg(char *fname) /* - * PRIVATE: cs_add_common - * - * the common routine to add a new cscope connection. called by - * cs_add() and cs_reset(). i really don't like to do this, but this + * The common routine to add a new cscope connection. Called by + * cs_add() and cs_reset(). I really don't like to do this, but this * routine uses a number of goto statements. */ static int @@ -562,9 +545,7 @@ static int cs_check_for_tags(void) } /* cs_check_for_tags */ /* - * PRIVATE: cs_cnt_connections - * - * count the number of cscope connections + * Count the number of cscope connections. */ static size_t cs_cnt_connections(void) { @@ -586,9 +567,7 @@ static void cs_reading_emsg( #define CSREAD_BUFSIZE 2048 /* - * PRIVATE: cs_cnt_matches - * - * count the number of matches for a given cscope connection. + * Count the number of matches for a given cscope connection. */ static int cs_cnt_matches(size_t idx) { @@ -640,8 +619,6 @@ static int cs_cnt_matches(size_t idx) /* - * PRIVATE: cs_create_cmd - * * Creates the actual cscope command query from what the user entered. */ static char *cs_create_cmd(char *csoption, char *pattern) @@ -700,8 +677,6 @@ static char *cs_create_cmd(char *csoption, char *pattern) /* - * PRIVATE: cs_create_connection - * * This piece of code was taken/adapted from nvi. do we need to add * the BSD license notice? */ @@ -894,10 +869,8 @@ err_closing: /* - * PRIVATE: cs_find - * - * query cscope using command line interface. parse the output and use tselect - * to allow choices. like Nvi, creates a pipe to send to/from query/cscope. + * Query cscope using command line interface. Parse the output and use tselect + * to allow choices. Like Nvi, creates a pipe to send to/from query/cscope. * * returns TRUE if we jump to a tag or abort, FALSE if not. */ @@ -935,9 +908,7 @@ static int cs_find(exarg_T *eap) /* - * PRIVATE: cs_find_common - * - * common code for cscope find, shared by cs_find() and do_cstag() + * Common code for cscope find, shared by cs_find() and ex_cstag(). */ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int use_ll, char_u *cmdline) @@ -1112,9 +1083,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, } /* cs_find_common */ /* - * PRIVATE: cs_help - * - * print help + * Print help. */ static int cs_help(exarg_T *eap) { @@ -1164,9 +1133,7 @@ static void clear_csinfo(size_t i) } /* - * PRIVATE: cs_insert_filelist - * - * insert a new cscope database filename into the filelist + * Insert a new cscope database filename into the filelist. */ static int cs_insert_filelist(char *fname, char *ppath, char *flags, FileInfo *file_info) @@ -1228,9 +1195,7 @@ static int cs_insert_filelist(char *fname, char *ppath, char *flags, /* - * PRIVATE: cs_lookup_cmd - * - * find cscope command in command table + * Find cscope command in command table. */ static cscmd_T * cs_lookup_cmd(exarg_T *eap) { @@ -1257,9 +1222,7 @@ static cscmd_T * cs_lookup_cmd(exarg_T *eap) /* - * PRIVATE: cs_kill - * - * nuke em + * Nuke em. */ static int cs_kill(exarg_T *eap) { @@ -1318,8 +1281,6 @@ static int cs_kill(exarg_T *eap) /* - * PRIVATE: cs_kill_execute - * * Actually kills a specific cscope connection. */ static void cs_kill_execute( @@ -1337,22 +1298,20 @@ static void cs_kill_execute( /* - * PRIVATE: cs_make_vim_style_matches - * - * convert the cscope output into a ctags style entry (as might be found + * Convert the cscope output into a ctags style entry (as might be found * in a ctags tags file). there's one catch though: cscope doesn't tell you * the type of the tag you are looking for. for example, in Darren Hiebert's * ctags (the one that comes with vim), #define's use a line number to find the * tag in a file while function definitions use a regexp search pattern. * - * i'm going to always use the line number because cscope does something + * I'm going to always use the line number because cscope does something * quirky (and probably other things i don't know about): * * if you have "# define" in your source file, which is * perfectly legal, cscope thinks you have "#define". this * will result in a failed regexp search. :( * - * besides, even if this particular case didn't happen, the search pattern + * Besides, even if this particular case didn't happen, the search pattern * would still have to be modified to escape all the special regular expression * characters to comply with ctags formatting. */ @@ -1390,9 +1349,7 @@ static char *cs_make_vim_style_matches(char *fname, char *slno, char *search, /* - * PRIVATE: cs_manage_matches - * - * this is kind of hokey, but i don't see an easy way round this.. + * This is kind of hokey, but i don't see an easy way round this. * * Store: keep a ptr to the (malloc'd) memory of matches originally * generated from cs_find(). the matches are originally lines directly @@ -1462,9 +1419,7 @@ static char *cs_manage_matches(char **matches, char **contexts, /* - * PRIVATE: cs_parse_results - * - * parse cscope output + * Parse cscope output. */ static char *cs_parse_results(size_t cnumber, char *buf, int bufsize, char **context, char **linenumber, char **search) @@ -1516,9 +1471,7 @@ static char *cs_parse_results(size_t cnumber, char *buf, int bufsize, } /* - * PRIVATE: cs_file_results - * - * write cscope find results to file + * Write cscope find results to file. */ static void cs_file_results(FILE *f, int *nummatches_a) { @@ -1561,10 +1514,8 @@ static void cs_file_results(FILE *f, int *nummatches_a) } /* - * PRIVATE: cs_fill_results - * - * get parsed cscope output and calls cs_make_vim_style_matches to convert - * into ctags format + * Get parsed cscope output and calls cs_make_vim_style_matches to convert + * into ctags format. * When there are no matches sets "*matches_p" to NULL. */ static void cs_fill_results(char *tagstr, size_t totmatches, int *nummatches_a, @@ -1759,9 +1710,7 @@ static void cs_print_tags_priv(char **matches, char **cntxts, } /* - * PRIVATE: cs_read_prompt - * - * read a cscope prompt (basically, skip over the ">> ") + * Read a cscope prompt (basically, skip over the ">> "). */ static int cs_read_prompt(size_t i) { @@ -1848,8 +1797,6 @@ static void sig_handler(int s) { #endif /* - * PRIVATE: cs_release_csp - * * Does the actual free'ing for the cs ptr with an optional flag of whether * or not to free the filename. Called by cs_kill and cs_reset. */ @@ -1965,9 +1912,7 @@ static void cs_release_csp(size_t i, int freefnpp) /* - * PRIVATE: cs_reset - * - * calls cs_kill on all cscope connections then reinits + * Calls cs_kill on all cscope connections then reinits. */ static int cs_reset(exarg_T *eap) { @@ -2019,8 +1964,6 @@ static int cs_reset(exarg_T *eap) /* - * PRIVATE: cs_resolve_file - * * Construct the full pathname to a file found in the cscope database. * (Prepends ppath, if there is one and if it's not already prepended, * otherwise just uses the name found.) @@ -2075,9 +2018,7 @@ static char *cs_resolve_file(size_t i, char *name) /* - * PRIVATE: cs_show - * - * show all cscope connections + * Show all cscope connections. */ static int cs_show(exarg_T *eap) { @@ -2107,8 +2048,6 @@ static int cs_show(exarg_T *eap) /* - * PUBLIC: cs_end - * * Only called when VIM exits to quit any cscope sessions. */ void cs_end(void) diff --git a/src/nvim/version.c b/src/nvim/version.c index 1035963136..c68bc6351e 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -648,7 +648,7 @@ static const int included_patches[] = { 84, 83, // 82 NA - // 81, + 81, // 80 NA 79, 78, -- cgit From 0c3f4f39211bf7247397a53d4d5f8de80fc97cdc Mon Sep 17 00:00:00 2001 From: lonerover Date: Fri, 4 Aug 2017 21:47:40 +0800 Subject: fix lint error --- src/nvim/if_cscope.c | 233 +++++++++++++++++++-------------------------------- 1 file changed, 85 insertions(+), 148 deletions(-) (limited to 'src') diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index 607fd2bbee..0f9ecdf2d7 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -172,12 +172,10 @@ void set_context_in_cscope_cmd(expand_T *xp, const char *arg, cmdidx_T cmdidx) } -/* - * Find the command, print help if invalid, and then call the corresponding - * command function. - */ -static void -do_cscope_general ( +/// Find the command, print help if invalid, and then call the corresponding +/// command function. +static void +do_cscope_general( exarg_T *eap, int make_split /* whether to split window */ ) @@ -206,25 +204,19 @@ do_cscope_general ( postponed_split_tab = 0; } -/* - * Implementation of ":cscope" and ":lcscope" - */ +/// Implementation of ":cscope" and ":lcscope" void ex_cscope(exarg_T *eap) { do_cscope_general(eap, FALSE); } -/* - * Implementation of ":scscope". Same as ex_cscope(), but splits window, too. - */ +/// Implementation of ":scscope". Same as ex_cscope(), but splits window, too. void ex_scscope(exarg_T *eap) { do_cscope_general(eap, TRUE); } -/* - * Implementation of ":cstag" - */ +/// Implementation of ":cstag" void ex_cstag(exarg_T *eap) { int ret = FALSE; @@ -280,16 +272,13 @@ void ex_cstag(exarg_T *eap) (void)EMSG(_("E257: cstag: tag not found")); g_do_tagpreview = 0; } - } -/* - * This simulates a vim_fgets(), but for cscope, returns the next line - * from the cscope output. should only be called from find_tags() - * - * returns TRUE if eof, FALSE otherwise - */ +/// This simulates a vim_fgets(), but for cscope, returns the next line +/// from the cscope output. should only be called from find_tags() +/// +/// @return TRUE if eof, FALSE otherwise int cs_fgets(char_u *buf, int size) { char *p; @@ -302,17 +291,13 @@ int cs_fgets(char_u *buf, int size) } /* cs_fgets */ -/* - * Called only from do_tag(), when popping the tag stack. - */ +/// Called only from do_tag(), when popping the tag stack. void cs_free_tags(void) { cs_manage_matches(NULL, NULL, 0, Free); } -/* - * Called from do_tag(). - */ +/// Called from do_tag(). void cs_print_tags(void) { cs_manage_matches(NULL, NULL, 0, Print); @@ -393,10 +378,8 @@ int cs_connection(int num, char_u *dbpath, char_u *ppath) * PRIVATE functions ****************************************************************************/ -/* - * Add cscope database or a directory name (to look for cscope.out) - * to the cscope connection list. - */ +/// Add cscope database or a directory name (to look for cscope.out) +/// to the cscope connection list. static int cs_add(exarg_T *eap) { char *fname, *ppath, *flags = NULL; @@ -422,15 +405,13 @@ static void cs_stat_emsg(char *fname) } -/* - * The common routine to add a new cscope connection. Called by - * cs_add() and cs_reset(). I really don't like to do this, but this - * routine uses a number of goto statements. - */ -static int -cs_add_common ( - char *arg1, /* filename - may contain environment variables */ - char *arg2, /* prepend path - may contain environment variables */ +/// The common routine to add a new cscope connection. Called by +/// cs_add() and cs_reset(). I really don't like to do this, but this +/// routine uses a number of goto statements. +static int +cs_add_common( + char *arg1, // filename - may contain environment variables + char *arg2, // prepend path - may contain environment variables char *flags ) { @@ -544,9 +525,7 @@ static int cs_check_for_tags(void) return p_tags[0] != NUL && curbuf->b_p_tags != NULL; } /* cs_check_for_tags */ -/* - * Count the number of cscope connections. - */ +/// Count the number of cscope connections. static size_t cs_cnt_connections(void) { size_t cnt = 0; @@ -566,9 +545,7 @@ static void cs_reading_emsg( } #define CSREAD_BUFSIZE 2048 -/* - * Count the number of matches for a given cscope connection. - */ +/// Count the number of matches for a given cscope connection. static int cs_cnt_matches(size_t idx) { char *stok; @@ -618,9 +595,7 @@ static int cs_cnt_matches(size_t idx) } /* cs_cnt_matches */ -/* - * Creates the actual cscope command query from what the user entered. - */ +/// Creates the actual cscope command query from what the user entered. static char *cs_create_cmd(char *csoption, char *pattern) { char *cmd; @@ -676,10 +651,8 @@ static char *cs_create_cmd(char *csoption, char *pattern) } /* cs_create_cmd */ -/* - * This piece of code was taken/adapted from nvi. do we need to add - * the BSD license notice? - */ +/// This piece of code was taken/adapted from nvi. do we need to add +/// the BSD license notice? static int cs_create_connection(size_t i) { #ifdef UNIX @@ -868,12 +841,10 @@ err_closing: } /* cs_create_connection */ -/* - * Query cscope using command line interface. Parse the output and use tselect - * to allow choices. Like Nvi, creates a pipe to send to/from query/cscope. - * - * returns TRUE if we jump to a tag or abort, FALSE if not. - */ +/// Query cscope using command line interface. Parse the output and use tselect +/// to allow choices. Like Nvi, creates a pipe to send to/from query/cscope. +/// +/// @return TRUE if we jump to a tag or abort, FALSE if not. static int cs_find(exarg_T *eap) { char *opt, *pat; @@ -907,9 +878,7 @@ static int cs_find(exarg_T *eap) } /* cs_find */ -/* - * Common code for cscope find, shared by cs_find() and ex_cstag(). - */ +/// Common code for cscope find, shared by cs_find() and ex_cstag(). static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int use_ll, char_u *cmdline) { @@ -1082,9 +1051,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, } /* cs_find_common */ -/* - * Print help. - */ +/// Print help. static int cs_help(exarg_T *eap) { cscmd_T *cmdp = cs_cmds; @@ -1132,9 +1099,7 @@ static void clear_csinfo(size_t i) csinfo[i].to_fp = NULL; } -/* - * Insert a new cscope database filename into the filelist. - */ +/// Insert a new cscope database filename into the filelist. static int cs_insert_filelist(char *fname, char *ppath, char *flags, FileInfo *file_info) { @@ -1194,9 +1159,7 @@ static int cs_insert_filelist(char *fname, char *ppath, char *flags, } /* cs_insert_filelist */ -/* - * Find cscope command in command table. - */ +/// Find cscope command in command table. static cscmd_T * cs_lookup_cmd(exarg_T *eap) { cscmd_T *cmdp; @@ -1221,9 +1184,7 @@ static cscmd_T * cs_lookup_cmd(exarg_T *eap) } /* cs_lookup_cmd */ -/* - * Nuke em. - */ +/// Nuke em. static int cs_kill(exarg_T *eap) { char *stok; @@ -1280,9 +1241,7 @@ static int cs_kill(exarg_T *eap) } /* cs_kill */ -/* - * Actually kills a specific cscope connection. - */ +/// Actually kills a specific cscope connection. static void cs_kill_execute( size_t i, /* cscope table index */ char *cname /* cscope database name */ @@ -1297,24 +1256,22 @@ static void cs_kill_execute( } -/* - * Convert the cscope output into a ctags style entry (as might be found - * in a ctags tags file). there's one catch though: cscope doesn't tell you - * the type of the tag you are looking for. for example, in Darren Hiebert's - * ctags (the one that comes with vim), #define's use a line number to find the - * tag in a file while function definitions use a regexp search pattern. - * - * I'm going to always use the line number because cscope does something - * quirky (and probably other things i don't know about): - * - * if you have "# define" in your source file, which is - * perfectly legal, cscope thinks you have "#define". this - * will result in a failed regexp search. :( - * - * Besides, even if this particular case didn't happen, the search pattern - * would still have to be modified to escape all the special regular expression - * characters to comply with ctags formatting. - */ +/// Convert the cscope output into a ctags style entry (as might be found +/// in a ctags tags file). there's one catch though: cscope doesn't tell you +/// the type of the tag you are looking for. for example, in Darren Hiebert's +/// ctags (the one that comes with vim), #define's use a line number to find the +/// tag in a file while function definitions use a regexp search pattern. +/// +/// I'm going to always use the line number because cscope does something +/// quirky (and probably other things i don't know about): +/// +/// if you have "# define" in your source file, which is +/// perfectly legal, cscope thinks you have "#define". this +/// will result in a failed regexp search. :( +/// +/// Besides, even if this particular case didn't happen, the search pattern +/// would still have to be modified to escape all the special regular expression +/// characters to comply with ctags formatting. static char *cs_make_vim_style_matches(char *fname, char *slno, char *search, char *tagstr) { @@ -1348,22 +1305,20 @@ static char *cs_make_vim_style_matches(char *fname, char *slno, char *search, } /* cs_make_vim_style_matches */ -/* - * This is kind of hokey, but i don't see an easy way round this. - * - * Store: keep a ptr to the (malloc'd) memory of matches originally - * generated from cs_find(). the matches are originally lines directly - * from cscope output, but transformed to look like something out of a - * ctags. see cs_make_vim_style_matches for more details. - * - * Get: used only from cs_fgets(), this simulates a vim_fgets() to return - * the next line from the cscope output. it basically keeps track of which - * lines have been "used" and returns the next one. - * - * Free: frees up everything and resets - * - * Print: prints the tags - */ +/// This is kind of hokey, but i don't see an easy way round this. +/// +/// Store: keep a ptr to the (malloc'd) memory of matches originally +/// generated from cs_find(). the matches are originally lines directly +/// from cscope output, but transformed to look like something out of a +/// ctags. see cs_make_vim_style_matches for more details. +/// +/// Get: used only from cs_fgets(), this simulates a vim_fgets() to return +/// the next line from the cscope output. it basically keeps track of which +/// lines have been "used" and returns the next one. +/// +/// Free: frees up everything and resets +/// +/// Print: prints the tags static char *cs_manage_matches(char **matches, char **contexts, size_t totmatches, mcmd_e cmd) { @@ -1418,9 +1373,7 @@ static char *cs_manage_matches(char **matches, char **contexts, } /* cs_manage_matches */ -/* - * Parse cscope output. - */ +/// Parse cscope output. static char *cs_parse_results(size_t cnumber, char *buf, int bufsize, char **context, char **linenumber, char **search) { @@ -1470,9 +1423,7 @@ static char *cs_parse_results(size_t cnumber, char *buf, int bufsize, return name; } -/* - * Write cscope find results to file. - */ +/// Write cscope find results to file. static void cs_file_results(FILE *f, int *nummatches_a) { char *search, *slno; @@ -1513,11 +1464,9 @@ static void cs_file_results(FILE *f, int *nummatches_a) xfree(buf); } -/* - * Get parsed cscope output and calls cs_make_vim_style_matches to convert - * into ctags format. - * When there are no matches sets "*matches_p" to NULL. - */ +/// Get parsed cscope output and calls cs_make_vim_style_matches to convert +/// into ctags format. +/// When there are no matches sets "*matches_p" to NULL. static void cs_fill_results(char *tagstr, size_t totmatches, int *nummatches_a, char ***matches_p, char ***cntxts_p, size_t *matched) @@ -1709,9 +1658,7 @@ static void cs_print_tags_priv(char **matches, char **cntxts, xfree(buf); } -/* - * Read a cscope prompt (basically, skip over the ">> "). - */ +/// Read a cscope prompt (basically, skip over the ">> "). static int cs_read_prompt(size_t i) { int ch; @@ -1796,10 +1743,8 @@ static void sig_handler(int s) { #endif -/* - * Does the actual free'ing for the cs ptr with an optional flag of whether - * or not to free the filename. Called by cs_kill and cs_reset. - */ +/// Does the actual free'ing for the cs ptr with an optional flag of whether +/// or not to free the filename. Called by cs_kill and cs_reset. static void cs_release_csp(size_t i, int freefnpp) { // Trying to exit normally (not sure whether it is fit to Unix cscope) @@ -1911,9 +1856,7 @@ static void cs_release_csp(size_t i, int freefnpp) } /* cs_release_csp */ -/* - * Calls cs_kill on all cscope connections then reinits. - */ +/// Calls cs_kill on all cscope connections then reinits. static int cs_reset(exarg_T *eap) { char **dblist = NULL, **pplist = NULL, **fllist = NULL; @@ -1963,15 +1906,13 @@ static int cs_reset(exarg_T *eap) } /* cs_reset */ -/* - * Construct the full pathname to a file found in the cscope database. - * (Prepends ppath, if there is one and if it's not already prepended, - * otherwise just uses the name found.) - * - * We need to prepend the prefix because on some cscope's (e.g., the one that - * ships with Solaris 2.6), the output never has the prefix prepended. - * Contrast this with my development system (Digital Unix), which does. - */ +/// Construct the full pathname to a file found in the cscope database. +/// (Prepends ppath, if there is one and if it's not already prepended, +/// otherwise just uses the name found.) +/// +/// We need to prepend the prefix because on some cscope's (e.g., the one that +/// ships with Solaris 2.6), the output never has the prefix prepended. +/// Contrast this with my development system (Digital Unix), which does. static char *cs_resolve_file(size_t i, char *name) { char *fullname; @@ -2017,9 +1958,7 @@ static char *cs_resolve_file(size_t i, char *name) } -/* - * Show all cscope connections. - */ +/// Show all cscope connections. static int cs_show(exarg_T *eap) { if (cs_cnt_connections() == 0) @@ -2047,9 +1986,7 @@ static int cs_show(exarg_T *eap) } /* cs_show */ -/* - * Only called when VIM exits to quit any cscope sessions. - */ +/// Only called when VIM exits to quit any cscope sessions. void cs_end(void) { for (size_t i = 0; i < csinfo_size; i++) -- cgit From 348229b1d32010292013eee415c28926e2b7009b Mon Sep 17 00:00:00 2001 From: KunMing Xie Date: Wed, 2 Aug 2017 16:22:04 +0800 Subject: vim-patch:8.0.0133 (#7107) Problem: "2;'(" causes ml_get errors in an empty buffer. (Dominique Pelle) Solution: Check the cursor line earlier. https://github.com/vim/vim/commit/fe38b494fff56cd9b2fcaeef26a8fd7b6557d69c --- src/nvim/ex_docmd.c | 13 +++++++------ src/nvim/testdir/test_cmdline.vim | 7 +++++++ src/nvim/version.c | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 30156621d6..d1ce589db1 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1665,11 +1665,15 @@ static char_u * do_one_cmd(char_u **cmdlinep, ea.addr_count++; if (*ea.cmd == ';') { - if (!ea.skip) + if (!ea.skip) { curwin->w_cursor.lnum = ea.line2; - } else if (*ea.cmd != ',') + // Don't leave the cursor on an illegal line (caused by ';') + check_cursor_lnum(); + } + } else if (*ea.cmd != ',') { break; - ++ea.cmd; + } + ea.cmd++; } /* One address given: set start and end lines */ @@ -1680,9 +1684,6 @@ static char_u * do_one_cmd(char_u **cmdlinep, ea.addr_count = 0; } - /* Don't leave the cursor on an illegal line (caused by ';') */ - check_cursor_lnum(); - /* * 5. Parse the command. */ diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index c3bfae1b7b..09f4b942ad 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -232,3 +232,10 @@ func Test_paste_in_cmdline() call assert_equal('"aaa a;b-c*d bbb', @:) bwipe! endfunc + +func Test_illegal_address() + new + 2;'( + 2;') + quit +endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index c68bc6351e..7f0b45e896 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -596,7 +596,7 @@ static const int included_patches[] = { 136, 135, // 134, - // 133, + 133, // 132, // 131, // 130 NA -- cgit From 678e87b90a08915d4fc16e3aada133f6482ba7a3 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 4 Aug 2017 21:48:43 +0200 Subject: test/oldtest: avoid delete() on files used by a subprocess This should avoid the hangs observed in the TSAN build on travis CI. TODO: Find the root cause ... --- src/nvim/testdir/test49.vim | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/nvim/testdir/test49.vim b/src/nvim/testdir/test49.vim index 467abcd9b9..a0e170dea4 100644 --- a/src/nvim/testdir/test49.vim +++ b/src/nvim/testdir/test49.vim @@ -481,9 +481,12 @@ function! ExtraVim(...) bwipeout let g:Xpath = g:Xpath + sum + " FIXME(nvim): delete() of a file used by a subprocess hangs TSAN build on travis CI. + if !empty($TRAVIS) " Delete the extra script and the resultfile. call delete(extra_script) call delete(resultfile) + endif " Switch back to the buffer that was active when this function was entered. exec "buffer" current_buffnr -- cgit From 55c0401dfd137a5e173d8551f763cb4c6fed56e1 Mon Sep 17 00:00:00 2001 From: KunMing Xie Date: Sat, 5 Aug 2017 10:17:30 +0800 Subject: vim-patch:8.0.0134 (#7109) Problem: Null pointer access reported by UBsan. Solution: Check curwin->w_buffer is not NULL. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/c4bfedabe057c05f09a455a5851089e177fa9c00 src/nvim/ex_cmds.c have been merged by someone. while version.c remain unmerged. --- src/nvim/version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/version.c b/src/nvim/version.c index 7f0b45e896..f2b56e0108 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -595,7 +595,7 @@ static const int included_patches[] = { // 137, 136, 135, - // 134, + 134, 133, // 132, // 131, -- cgit From c6954437277175c9e2b8eb7e7e753314725aef8b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 3 Aug 2017 00:41:52 +0200 Subject: win_redr_status(): skip if wildmenu is showing This might be too coarse, but it passes all tests ... A more nuanced approach might be: only skip the windows whose statuslines are overwritten by the wildmenu. Closes #2255 Closes #7108 vim-patch:8.0.0710 N/A because of the changes in this commit. --- src/nvim/screen.c | 36 ++++----- src/nvim/version.c | 223 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 241 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index bcc996679b..cd4f4de40f 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -86,6 +86,7 @@ #include #include +#include "nvim/log.h" #include "nvim/vim.h" #include "nvim/ascii.h" #include "nvim/arabic.h" @@ -4874,11 +4875,14 @@ void win_redr_status(win_T *wp) int this_ru_col; static int busy = FALSE; - /* It's possible to get here recursively when 'statusline' (indirectly) - * invokes ":redrawstatus". Simply ignore the call then. */ - if (busy) + // May get here recursively when 'statusline' (indirectly) + // invokes ":redrawstatus". Simply ignore the call then. + if (busy + // Also ignore if wildmenu is showing. + || (wild_menu_showing != 0 && !ui_is_external(kUIWildmenu))) { return; - busy = TRUE; + } + busy = true; wp->w_redr_status = FALSE; if (wp->w_status_height == 0) { @@ -6441,13 +6445,11 @@ void setcursor(void) } } -/* - * insert 'line_count' lines at 'row' in window 'wp' - * if 'invalid' is TRUE the wp->w_lines[].wl_lnum is invalidated. - * if 'mayclear' is TRUE the screen will be cleared if it is faster than - * scrolling. - * Returns FAIL if the lines are not inserted, OK for success. - */ +/// Insert 'line_count' lines at 'row' in window 'wp'. +/// If 'invalid' is TRUE the wp->w_lines[].wl_lnum is invalidated. +/// If 'mayclear' is TRUE the screen will be cleared if it is faster than +/// scrolling. +/// Returns FAIL if the lines are not inserted, OK for success. int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear) { int did_delete; @@ -6510,13 +6512,11 @@ int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear) return OK; } -/* - * delete "line_count" window lines at "row" in window "wp" - * If "invalid" is TRUE curwin->w_lines[] is invalidated. - * If "mayclear" is TRUE the screen will be cleared if it is faster than - * scrolling - * Return OK for success, FAIL if the lines are not deleted. - */ +/// Delete "line_count" window lines at "row" in window "wp". +/// If "invalid" is TRUE curwin->w_lines[] is invalidated. +/// If "mayclear" is TRUE the screen will be cleared if it is faster than +/// scrolling +/// Return OK for success, FAIL if the lines are not deleted. int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear) { int retval; diff --git a/src/nvim/version.c b/src/nvim/version.c index f2b56e0108..c443b63bb0 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -77,6 +77,229 @@ static char *features[] = { // clang-format off static const int included_patches[] = { + // 875, + // 874, + // 873, + // 872, + // 871, + // 870, + // 869, + // 868, + // 867, + // 866, + // 865, + // 864, + // 863, + // 862, + // 861, + // 860, + // 859, + // 858, + // 857, + // 856, + // 855, + // 854, + // 853, + // 852, + // 851, + // 850, + // 849, + // 848, + // 847, + // 846, + // 845, + // 844, + // 843, + // 842, + // 841, + // 840, + // 839, + // 838, + // 837, + // 836, + // 835, + // 834, + // 833, + // 832, + // 831, + // 830, + // 829, + // 828, + // 827, + // 826, + // 825, + // 824, + // 823, + // 822, + // 821, + // 820, + // 819, + // 818, + // 817, + // 816, + // 815, + // 814, + // 813, + // 812, + // 811, + // 810, + // 809, + // 808, + // 807, + // 806, + // 805, + // 804, + // 803, + // 802, + // 801, + // 800, + // 799, + // 798, + // 797, + // 796, + // 795, + // 794, + // 793, + // 792, + // 791, + // 790, + // 789, + // 788, + // 787, + // 786, + // 785, + // 784, + // 783, + // 782, + // 781, + // 780, + // 779, + // 778, + // 777, + // 776, + // 775, + // 774, + // 773, + // 772, + // 771, + // 770, + // 769, + // 768, + // 767, + // 766, + // 765, + // 764, + // 763, + // 762, + // 761, + // 760, + // 759, + // 758, + // 757, + // 756, + // 755, + // 754, + // 753, + // 752, + // 751, + // 750, + // 749, + // 748, + // 747, + // 746, + // 745, + // 744, + // 743, + // 742, + // 741, + // 740, + // 739, + // 738, + // 737, + // 736, + // 735, + // 734, + // 733, + // 732, + // 731, + // 730, + // 729, + // 728, + // 727, + // 726, + // 725, + // 724, + // 723, + // 722, + // 721, + // 720, + // 719, + // 718, + // 717, + // 716, + // 715, + // 714, + // 713, + // 712, + // 711, + 710, + // 709, + // 708, + // 707, + // 706, + // 705, + // 704, + // 703, + // 702, + // 701, + // 700, + // 699, + // 698, + // 697, + // 696, + // 695, + // 694, + // 693, + // 692, + // 691, + // 690, + // 689, + // 688, + // 687, + // 686, + // 685, + // 684, + // 683, + // 682, + // 681, + // 680, + // 679, + // 678, + // 677, + // 676, + // 675, + // 674, + // 673, + // 672, + // 671, + // 670, + // 669, + // 668, + // 667, + // 666, + // 665, + // 664, + // 663, + // 662, + // 661, + // 660, + // 659, + // 658, + // 657, + // 656, + // 655, + // 654, + // 653, 652, // 651, // 650, -- cgit From a31482db4dcaa479b09e2683037fee3d6ee56408 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 5 Aug 2017 03:34:38 +0200 Subject: terminal: block redraw during c_CTRL-D Unlike the normal wildmenu, the CTRL-D wild-list is not restored by statusline redraw. (Semantics: ^D is controlled by 'wildoptions' option, so it's in the "wild..." family.) TODO: externalize the c_CTRL-D wild-list. --- src/nvim/ex_getln.c | 9 ++++++--- src/nvim/globals.h | 7 +++++-- src/nvim/state.c | 1 + src/nvim/terminal.c | 6 +++++- 4 files changed, 17 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 1d81a39dfe..a41e78d44a 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -12,6 +12,7 @@ #include #include "nvim/assert.h" +#include "nvim/log.h" #include "nvim/vim.h" #include "nvim/ascii.h" #include "nvim/arabic.h" @@ -472,11 +473,12 @@ static int command_line_execute(VimState *state, int key) } // free expanded names when finished walking through matches - if (s->xpc.xp_numfiles != -1 - && !(s->c == p_wc && KeyTyped) && s->c != p_wcm + if (!(s->c == p_wc && KeyTyped) && s->c != p_wcm && s->c != Ctrl_N && s->c != Ctrl_P && s->c != Ctrl_A && s->c != Ctrl_L) { - (void)ExpandOne(&s->xpc, NULL, NULL, 0, WILD_FREE); + if (s->xpc.xp_numfiles != -1) { + (void)ExpandOne(&s->xpc, NULL, NULL, 0, WILD_FREE); + } s->did_wild_list = false; if (!p_wmnu || (s->c != K_UP && s->c != K_DOWN)) { s->xpc.xp_context = EXPAND_NOTHING; @@ -1222,6 +1224,7 @@ static int command_line_handle_key(CommandLineState *s) break; // Use ^D as normal char instead } + wild_menu_showing = WM_LIST; redrawcmd(); return 1; // don't do incremental search now diff --git a/src/nvim/globals.h b/src/nvim/globals.h index f08812600f..13ecafcbe3 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -931,8 +931,11 @@ EXTERN char_u langmap_mapchar[256]; /* mapping for language keys */ EXTERN int save_p_ls INIT(= -1); /* Save 'laststatus' setting */ EXTERN int save_p_wmh INIT(= -1); /* Save 'winminheight' setting */ EXTERN int wild_menu_showing INIT(= 0); -# define WM_SHOWN 1 /* wildmenu showing */ -# define WM_SCROLLED 2 /* wildmenu showing with scroll */ +enum { + WM_SHOWN = 1, ///< wildmenu showing + WM_SCROLLED = 2, ///< wildmenu showing with scroll + WM_LIST = 3, ///< cmdline CTRL-D +}; EXTERN char breakat_flags[256]; /* which characters are in 'breakat' */ diff --git a/src/nvim/state.c b/src/nvim/state.c index be6aa21664..eb0b590a9b 100644 --- a/src/nvim/state.c +++ b/src/nvim/state.c @@ -6,6 +6,7 @@ #include "nvim/lib/kvec.h" #include "nvim/ascii.h" +#include "nvim/log.h" #include "nvim/state.h" #include "nvim/vim.h" #include "nvim/main.h" diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 099f49f09b..deec930ebd 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -43,6 +43,7 @@ #include +#include "nvim/log.h" #include "nvim/vim.h" #include "nvim/terminal.h" #include "nvim/message.h" @@ -1010,7 +1011,10 @@ static void refresh_terminal(Terminal *term) // Calls refresh_terminal() on all invalidated_terminals. static void refresh_timer_cb(TimeWatcher *watcher, void *data) { - if (exiting) { // Cannot redraw (requires event loop) during teardown/exit. + if (exiting // Cannot redraw (requires event loop) during teardown/exit. + // WM_LIST (^D) is not redrawn, unlike the normal wildmenu. So we must + // skip redraws to keep it visible. + || wild_menu_showing == WM_LIST) { goto end; } Terminal *term; -- cgit From 30996359efbba90ce03ac3de7e39f20db9ce486b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 5 Aug 2017 21:10:21 +0200 Subject: clint: allow starting brace after `enum` --- src/clint.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/clint.py b/src/clint.py index 69a061d2ab..4a41650ec4 100755 --- a/src/clint.py +++ b/src/clint.py @@ -2613,7 +2613,8 @@ def CheckBraces(filename, clean_lines, linenum, error): func_start_linenum += 1 else: - if clean_lines.lines[func_start_linenum].endswith('{'): + func_start = clean_lines.lines[func_start_linenum] + if not func_start.startswith('enum ') and func_start.endswith('{'): error(filename, func_start_linenum, 'readability/braces', 5, 'Brace starting function body must be placed ' -- cgit From 50c8f19d614d4752ac1d2d19b5bc7c05f6d354f9 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 5 Aug 2017 21:53:03 +0200 Subject: build: silence maybe-uninitialized warning False positive. From C:\msys64\mingw64\bin\gcc.exe (appveyor CI) --- src/nvim/ex_getln.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index a41e78d44a..ecd5c81822 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1455,7 +1455,7 @@ static int command_line_handle_key(CommandLineState *s) if (s->hiscnt != s->i) { // jumped to other entry char_u *p; - int len; + int len = 0; int old_firstc; xfree(ccline.cmdbuff); -- cgit From d801ce70c1fb8dd8b3735ca9e06158aaf48203ba Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 5 Aug 2017 23:29:02 +0200 Subject: win_defs.h: redefine RGB macro after undefining Before this change, if os_defs.h was included after macros.h then win_defs.h would undefine our own RGB macro. vim-patch:8.0.0146 --- src/nvim/os/win_defs.h | 9 +++++++-- src/nvim/version.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h index 7ed70f6092..8fd2e51f8b 100644 --- a/src/nvim/os/win_defs.h +++ b/src/nvim/os/win_defs.h @@ -30,8 +30,13 @@ #define USE_CRNL -// We have our own RGB macro in macros.h. -#undef RGB +// Windows defines a RGB macro that produces 0x00bbggrr color values for use +// with GDI. Our macro is different, and we don't use GDI. +#if defined(RGB) +# undef RGB + // Duplicated from macros.h to avoid include-order sensitivity. +# define RGB(r, g, b) ((r << 16) | (g << 8) | b) +#endif #ifdef _MSC_VER # ifndef inline diff --git a/src/nvim/version.c b/src/nvim/version.c index c443b63bb0..81152bbaa4 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -806,7 +806,7 @@ static const int included_patches[] = { // 149, // 148, // 147, - // 146, + 146, // 145 NA // 144 NA // 143, -- cgit From 3827d5bc713d9ed149bc793f411debb5b89a4eba Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 6 Aug 2017 02:44:15 +0200 Subject: input: skip dialogs if no UI is active Treat dialogs in the same way as "silent mode" (`nvim -es`). References #1984 References #3901 --- src/nvim/main.c | 15 +++++++-------- src/nvim/message.c | 8 +++++--- src/nvim/misc1.c | 2 +- src/nvim/testdir/test49.vim | 3 --- 4 files changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/nvim/main.c b/src/nvim/main.c index 7dcf00c26b..a46c1a58f8 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -98,10 +98,8 @@ typedef struct { bool input_isatty; // stdin is a terminal bool output_isatty; // stdout is a terminal bool err_isatty; // stderr is a terminal - bool headless; // Dont try to start an user interface - // or read/write to stdio(unless - // embedding) - int no_swap_file; /* "-n" argument used */ + bool headless; // Do not start the builtin UI. + int no_swap_file; // "-n" argument used int use_debug_break_level; int window_count; /* number of windows to use */ int window_layout; /* 0, WIN_HOR, WIN_VER or WIN_TABS */ @@ -932,10 +930,11 @@ static void command_line_scan(mparm_T *parmp) break; case 's': - if (exmode_active) /* "-s" silent (batch) mode */ - silent_mode = TRUE; - else /* "-s {scriptin}" read from script file */ - want_argument = TRUE; + if (exmode_active) { // "-es" silent (batch) mode + silent_mode = true; + } else { // "-s {scriptin}" read from script file + want_argument = true; + } break; case 't': /* "-t {tag}" or "-t{tag}" jump to tag */ diff --git a/src/nvim/message.c b/src/nvim/message.c index 36f9ca84ed..28c88f5a14 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -2722,9 +2722,11 @@ do_dialog ( int c; int i; - /* Don't output anything in silent mode ("ex -s") */ - if (silent_mode) - return dfltbutton; /* return default option */ + if (silent_mode // No dialogs in silent mode ("ex -s") + || !ui_active() // Without a UI Nvim waits for input forever. + ) { + return dfltbutton; // return default option + } oldState = State; diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 835b9c7b20..5270687a4d 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -2203,7 +2203,7 @@ change_warning ( set_vim_var_string(VV_WARNINGMSG, _(w_readonly), -1); msg_clr_eos(); (void)msg_end(); - if (msg_silent == 0 && !silent_mode) { + if (msg_silent == 0 && !silent_mode && ui_active()) { ui_flush(); os_delay(1000L, true); /* give the user time to think about it */ } diff --git a/src/nvim/testdir/test49.vim b/src/nvim/testdir/test49.vim index a0e170dea4..467abcd9b9 100644 --- a/src/nvim/testdir/test49.vim +++ b/src/nvim/testdir/test49.vim @@ -481,12 +481,9 @@ function! ExtraVim(...) bwipeout let g:Xpath = g:Xpath + sum - " FIXME(nvim): delete() of a file used by a subprocess hangs TSAN build on travis CI. - if !empty($TRAVIS) " Delete the extra script and the resultfile. call delete(extra_script) call delete(resultfile) - endif " Switch back to the buffer that was active when this function was entered. exec "buffer" current_buffnr -- cgit