diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/.clang-format | 12 | ||||
-rw-r--r-- | src/nvim/api/buffer.c | 4 | ||||
-rw-r--r-- | src/nvim/api/tabpage.c | 8 | ||||
-rw-r--r-- | src/nvim/api/vim.c | 40 | ||||
-rw-r--r-- | src/nvim/api/window.c | 4 | ||||
-rw-r--r-- | src/nvim/charset.c | 16 | ||||
-rw-r--r-- | src/nvim/edit.c | 41 | ||||
-rw-r--r-- | src/nvim/eval.c | 19 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 4 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 59 | ||||
-rw-r--r-- | src/nvim/fileio.c | 93 | ||||
-rw-r--r-- | src/nvim/if_cscope.c | 25 | ||||
-rw-r--r-- | src/nvim/indent_c.c | 2 | ||||
-rw-r--r-- | src/nvim/mark.c | 22 | ||||
-rw-r--r-- | src/nvim/memline.c | 11 | ||||
-rw-r--r-- | src/nvim/message.c | 3 | ||||
-rw-r--r-- | src/nvim/misc1.c | 2 | ||||
-rw-r--r-- | src/nvim/ops.c | 43 | ||||
-rw-r--r-- | src/nvim/path.c | 26 | ||||
-rw-r--r-- | src/nvim/po/ru.cp1251.po | 65 | ||||
-rw-r--r-- | src/nvim/po/ru.po | 63 | ||||
-rw-r--r-- | src/nvim/popupmnu.c | 10 | ||||
-rw-r--r-- | src/nvim/screen.c | 6 | ||||
-rw-r--r-- | src/nvim/search.c | 23 | ||||
-rw-r--r-- | src/nvim/spell.c | 22 | ||||
-rw-r--r-- | src/nvim/term.c | 4 | ||||
-rw-r--r-- | src/nvim/testdir/Makefile | 3 | ||||
-rw-r--r-- | src/nvim/version.c | 10 |
29 files changed, 330 insertions, 312 deletions
diff --git a/src/.clang-format b/src/.clang-format new file mode 100644 index 0000000000..35e545ac4b --- /dev/null +++ b/src/.clang-format @@ -0,0 +1,12 @@ +BasedOnStyle: llvm +Language: Cpp +ColumnLimit: 80 +IndentWidth: 2 +TabWidth: 2 +UseTab: Never +IndentCaseLabels: true +BreakBeforeBraces: Linux +AlignEscapedNewlinesLeft: false +AllowShortFunctionsOnASingleLine: false +SpacesBeforeTrailingComments: 2 +PenaltyReturnTypeOnItsOwnLine: 200 diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 0292e82038..b4a52f97fb 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -308,7 +308,7 @@ end: try_end(err); } -/// Gets a buffer variable +/// Gets a buffer-scoped (b:) variable. /// /// @param buffer The buffer handle /// @param name The variable name @@ -325,7 +325,7 @@ Object buffer_get_var(Buffer buffer, String name, Error *err) return dict_get_value(buf->b_vars, name, err); } -/// Sets a buffer variable. Passing 'nil' as value deletes the variable. +/// Sets a buffer-scoped (b:) variable. 'nil' value deletes the variable. /// /// @param buffer The buffer handle /// @param name The variable name diff --git a/src/nvim/api/tabpage.c b/src/nvim/api/tabpage.c index cb06825731..1c958118e1 100644 --- a/src/nvim/api/tabpage.c +++ b/src/nvim/api/tabpage.c @@ -9,11 +9,11 @@ #include "nvim/memory.h" #include "nvim/window.h" -/// Gets the number of windows in a tabpage +/// Gets the windows in a tabpage /// /// @param tabpage The tabpage /// @param[out] err Details of an error that may have occurred -/// @return The number of windows in `tabpage` +/// @return The windows in `tabpage` ArrayOf(Window) tabpage_get_windows(Tabpage tabpage, Error *err) { Array rv = ARRAY_DICT_INIT; @@ -37,7 +37,7 @@ ArrayOf(Window) tabpage_get_windows(Tabpage tabpage, Error *err) return rv; } -/// Gets a tabpage variable +/// Gets a tab-scoped (t:) variable /// /// @param tabpage The tab page handle /// @param name The variable name @@ -54,7 +54,7 @@ Object tabpage_get_var(Tabpage tabpage, String name, Error *err) return dict_get_value(tab->tp_vars, name, err); } -/// Sets a tabpage variable. Passing 'nil' as value deletes the variable. +/// Sets a tab-scoped (t:) variable. 'nil' value deletes the variable. /// /// @param tabpage handle /// @param name The variable name diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index eab79d970e..45cc3c530b 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -46,7 +46,7 @@ void vim_command(String str, Error *err) try_end(err); } -/// Pass input keys to Neovim +/// Passes input keys to Neovim /// /// @param keys to be typed /// @param mode specifies the mapping options @@ -90,19 +90,19 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi) typebuf_was_filled = true; } -/// Pass input keys to Neovim. Unlike `vim_feedkeys`, this will use a +/// Passes input keys to Neovim. Unlike `vim_feedkeys`, this will use a /// lower-level input buffer and the call is not deferred. /// This is the most reliable way to emulate real user input. /// /// @param keys to be typed -/// @return The number bytes actually written, which can be lower than +/// @return The number of bytes actually written, which can be lower than /// requested if the buffer becomes full. Integer vim_input(String keys) { return (Integer)input_enqueue(keys); } -/// Replace any terminal codes with the internal representation +/// Replaces any terminal codes with the internal representation /// /// @see replace_termcodes /// @see cpoptions @@ -133,7 +133,7 @@ String vim_command_output(String str, Error *err) return cstr_to_string((char *)get_vim_var_str(VV_COMMAND_OUTPUT)); } -/// Evaluates the expression str using the vim internal expression +/// Evaluates the expression str using the Vim internal expression /// evaluator (see |expression|). /// Dictionaries and lists are recursively expanded. /// @@ -178,7 +178,7 @@ Integer vim_strwidth(String str, Error *err) return (Integer) mb_string2cells((char_u *) str.data); } -/// Returns a list of paths contained in 'runtimepath' +/// Gets a list of paths contained in 'runtimepath' /// /// @return The list of paths ArrayOf(String) vim_list_runtime_paths(void) @@ -201,7 +201,7 @@ ArrayOf(String) vim_list_runtime_paths(void) // Allocate memory for the copies rv.items = xmalloc(sizeof(Object) * rv.size); - // reset the position + // Reset the position rtp = p_rtp; // Start copying for (size_t i = 0; i < rv.size && *rtp != NUL; i++) { @@ -218,7 +218,7 @@ ArrayOf(String) vim_list_runtime_paths(void) return rv; } -/// Changes vim working directory +/// Changes Vim working directory /// /// @param dir The new working directory /// @param[out] err Details of an error that may have occurred @@ -246,7 +246,7 @@ void vim_change_directory(String dir, Error *err) try_end(err); } -/// Return the current line +/// Gets the current line /// /// @param[out] err Details of an error that may have occurred /// @return The current line string @@ -265,7 +265,7 @@ void vim_set_current_line(String line, Error *err) buffer_set_line(curbuf->handle, curwin->w_cursor.lnum - 1, line, err); } -/// Delete the current line +/// Deletes the current line /// /// @param[out] err Details of an error that may have occurred void vim_del_current_line(Error *err) @@ -306,7 +306,7 @@ Object vim_get_vvar(String name, Error *err) return dict_get_value(&vimvardict, name, err); } -/// Get an option value string +/// Gets an option value string /// /// @param name The option name /// @param[out] err Details of an error that may have occurred @@ -327,7 +327,7 @@ void vim_set_option(String name, Object value, Error *err) set_option_to(NULL, SREQ_GLOBAL, name, value, err); } -/// Write a message to vim output buffer +/// Writes a message to vim output buffer /// /// @param str The message void vim_out_write(String str) @@ -336,7 +336,7 @@ void vim_out_write(String str) write_msg(str, false); } -/// Write a message to vim error buffer +/// Writes a message to vim error buffer /// /// @param str The message void vim_err_write(String str) @@ -346,7 +346,7 @@ void vim_err_write(String str) } /// Higher level error reporting function that ensures all str contents -/// are written by sending a trailing linefeed to `vim_wrr_write` +/// are written by sending a trailing linefeed to `vim_err_write` /// /// @param str The message void vim_report_error(String str) @@ -381,7 +381,7 @@ ArrayOf(Buffer) vim_get_buffers(void) return rv; } -/// Return the current buffer +/// Gets the current buffer /// /// @reqturn The buffer handle Buffer vim_get_current_buffer(void) @@ -433,7 +433,7 @@ ArrayOf(Window) vim_get_windows(void) return rv; } -/// Return the current window +/// Gets the current window /// /// @return The window handle Window vim_get_current_window(void) @@ -488,7 +488,7 @@ ArrayOf(Tabpage) vim_get_tabpages(void) return rv; } -/// Return the current tab page +/// Gets the current tab page /// /// @return The tab page handle Tabpage vim_get_current_tabpage(void) @@ -521,7 +521,7 @@ void vim_set_current_tabpage(Tabpage tabpage, Error *err) /// Subscribes to event broadcasts /// -/// @param channel_id The channel id(passed automatically by the dispatcher) +/// @param channel_id The channel id (passed automatically by the dispatcher) /// @param event The event type string void vim_subscribe(uint64_t channel_id, String event) { @@ -534,7 +534,7 @@ void vim_subscribe(uint64_t channel_id, String event) /// Unsubscribes to event broadcasts /// -/// @param channel_id The channel id(passed automatically by the dispatcher) +/// @param channel_id The channel id (passed automatically by the dispatcher) /// @param event The event type string void vim_unsubscribe(uint64_t channel_id, String event) { @@ -568,7 +568,7 @@ Array vim_get_api_info(uint64_t channel_id) /// later. /// /// @param message The message to write -/// @param to_err True if it should be treated as an error message(use +/// @param to_err true if it should be treated as an error message (use /// `emsg` instead of `msg` to print each line) static void write_msg(String message, bool to_err) { diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index 597c857ad5..f41dafff17 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -182,7 +182,7 @@ void window_set_width(Window window, Integer width, Error *err) try_end(err); } -/// Gets a window variable +/// Gets a window-scoped (w:) variable /// /// @param window The window handle /// @param name The variable name @@ -199,7 +199,7 @@ Object window_get_var(Window window, String name, Error *err) return dict_get_value(win->w_vars, name, err); } -/// Sets a window variable. Passing 'nil' as value deletes the variable. +/// Sets a window-scoped (w:) variable. 'nil' value deletes the variable. /// /// @param window The window handle /// @param name The variable name diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 86d6acc60b..6fb5ebf3e4 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -390,19 +390,13 @@ char_u *transstr(char_u *s) FUNC_ATTR_NONNULL_RET return res; } -/// Convert the string "str[orglen]" to do ignore-case comparing. Uses the -/// current locale. +/// Convert the string "str[orglen]" to do ignore-case comparing. +/// Use the current locale. /// -/// When "buf" is NULL returns an allocated string (NULL for out-of-memory). -/// Otherwise puts the result in "buf[buflen]". -/// -/// @param str -/// @param orglen -/// @param buf -/// @param buflen -/// -/// @return converted string. +/// When "buf" is NULL, return an allocated string. +/// Otherwise, put the result in buf, limited by buflen, and return buf. char_u* str_foldcase(char_u *str, int orglen, char_u *buf, int buflen) + FUNC_ATTR_NONNULL_RET { garray_T ga; int i; diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 03dceaf092..fa4e4b2835 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -1633,11 +1633,6 @@ change_indent ( * put it back again the way we wanted it. */ if (State & VREPLACE_FLAG) { - /* If orig_line didn't allocate, just return. At least we did the job, - * even if you can't backspace. */ - if (orig_line == NULL) - return; - /* Save new line */ new_line = vim_strsave(get_cursor_line_ptr()); @@ -2437,14 +2432,12 @@ void ins_compl_show_pum(void) } } - if (compl_match_array != NULL) { - /* Compute the screen column of the start of the completed text. - * Use the cursor to get all wrapping and other settings right. */ - col = curwin->w_cursor.col; - curwin->w_cursor.col = compl_col; - pum_display(compl_match_array, compl_match_arraysize, cur); - curwin->w_cursor.col = col; - } + /* Compute the screen column of the start of the completed text. + * Use the cursor to get all wrapping and other settings right. */ + col = curwin->w_cursor.col; + curwin->w_cursor.col = compl_col; + pum_display(compl_match_array, compl_match_arraysize, cur); + curwin->w_cursor.col = col; } #define DICT_FIRST (1) /* use just first element in "dict" */ @@ -4135,7 +4128,7 @@ static int ins_compl_use_match(int c) /* * Do Insert mode completion. * Called when character "c" was typed, which has a meaning for completion. - * Returns OK if completion was done, FAIL if something failed (out of mem). + * Returns OK if completion was done, FAIL if something failed. */ static int ins_complete(int c) { @@ -4236,13 +4229,9 @@ static int ins_complete(int c) compl_length = curs_col - startcol; } if (p_ic) - compl_pattern = str_foldcase(line + compl_col, - compl_length, NULL, 0); + compl_pattern = str_foldcase(line + compl_col, compl_length, NULL, 0); else - compl_pattern = vim_strnsave(line + compl_col, - compl_length); - if (compl_pattern == NULL) - return FAIL; + compl_pattern = vim_strnsave(line + compl_col, compl_length); } else if (compl_cont_status & CONT_ADDING) { char_u *prefix = (char_u *)"\\<"; @@ -4309,12 +4298,9 @@ static int ins_complete(int c) if (compl_length < 0) /* cursor in indent: empty pattern */ compl_length = 0; if (p_ic) - compl_pattern = str_foldcase(line + compl_col, compl_length, - NULL, 0); + compl_pattern = str_foldcase(line + compl_col, compl_length, NULL, 0); else compl_pattern = vim_strnsave(line + compl_col, compl_length); - if (compl_pattern == NULL) - return FAIL; } else if (ctrl_x_mode == CTRL_X_FILES) { /* Go back to just before the first filename character. */ if (startcol > 0) { @@ -4331,10 +4317,7 @@ static int ins_complete(int c) compl_col += startcol; compl_length = (int)curs_col - startcol; - compl_pattern = addstar(line + compl_col, compl_length, - EXPAND_FILES); - if (compl_pattern == NULL) - return FAIL; + compl_pattern = addstar(line + compl_col, compl_length, EXPAND_FILES); } else if (ctrl_x_mode == CTRL_X_CMDLINE) { compl_pattern = vim_strnsave(line, curs_col); set_cmd_context(&compl_xp, compl_pattern, @@ -5752,6 +5735,8 @@ stop_insert ( if (curwin->w_cursor.lnum != tpos.lnum) curwin->w_cursor = tpos; else { + /* reset tpos, could have been invalidated in the loop above */ + tpos = curwin->w_cursor; tpos.col++; if (cc != NUL && gchar_pos(&tpos) == NUL) { ++curwin->w_cursor.col; // put cursor back on the NUL diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 87a5ed80e7..a4bd4d89ef 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -11628,18 +11628,12 @@ static void f_or(typval_T *argvars, typval_T *rettv) */ static void f_pathshorten(typval_T *argvars, typval_T *rettv) { - char_u *p; - rettv->v_type = VAR_STRING; - p = get_tv_string_chk(&argvars[0]); - if (p == NULL) - rettv->vval.v_string = NULL; - else { - p = vim_strsave(p); - rettv->vval.v_string = p; - if (p != NULL) - shorten_dir(p); + rettv->vval.v_string = get_tv_string_chk(&argvars[0]); + if (!rettv->vval.v_string) { + return; } + rettv->vval.v_string = shorten_dir(vim_strsave(rettv->vval.v_string)); } /* @@ -18168,8 +18162,7 @@ void func_dump_profile(FILE *fd) --todo; fp = HI2UF(hi); if (fp->uf_profiling) { - if (sorttab != NULL) - sorttab[st_len++] = fp; + sorttab[st_len++] = fp; if (fp->uf_name[0] == K_SPECIAL) fprintf(fd, "FUNCTION <SNR>%s()\n", fp->uf_name + 3); @@ -18196,7 +18189,7 @@ void func_dump_profile(FILE *fd) } } - if (sorttab != NULL && st_len > 0) { + if (st_len > 0) { qsort((void *)sorttab, (size_t)st_len, sizeof(ufunc_T *), prof_total_cmp); prof_sort_list(fd, sorttab, st_len, "TOTAL", FALSE); diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index b1a7044565..3143363af6 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -4742,7 +4742,6 @@ void ex_help(exarg_T *eap) tag = vim_strsave(matches[i]); FreeWild(num_matches, matches); - /* * Re-use an existing help window or open a new one. * Always open a new one for ":tab help". @@ -4805,8 +4804,7 @@ void ex_help(exarg_T *eap) * It is needed for do_tag top open folds under the cursor. */ KeyTyped = old_KeyTyped; - if (tag != NULL) - do_tag(tag, DT_HELP, 1, FALSE, TRUE); + do_tag(tag, DT_HELP, 1, FALSE, TRUE); /* Delete the empty buffer if we're not using it. Careful: autocommands * may have jumped to another window, check that the buffer is not in a diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 065c27013e..f6527db69b 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -8589,8 +8589,6 @@ static char_u *get_view_file(int c) return NULL; } sname = home_replace_save(NULL, curbuf->b_ffname); - if (sname == NULL) - return NULL; /* * We want a file name without separators, because we're not going to make diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index b942f69f61..a4e8fccc23 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -3033,10 +3033,8 @@ void tilde_replace(char_u *orig_pat, int num_files, char_u **files) if (orig_pat[0] == '~' && vim_ispathsep(orig_pat[1])) { for (i = 0; i < num_files; ++i) { p = home_replace_save(NULL, files[i]); - if (p != NULL) { - free(files[i]); - files[i] = p; - } + free(files[i]); + files[i] = p; } } } @@ -3265,6 +3263,7 @@ addstar ( int len, int context /* EXPAND_FILES etc. */ ) + FUNC_ATTR_NONNULL_RET { char_u *retval; int i, j; @@ -3343,35 +3342,33 @@ addstar ( } } else { retval = xmalloc(len + 4); - if (retval != NULL) { - STRLCPY(retval, fname, len + 1); + STRLCPY(retval, fname, len + 1); - /* - * Don't add a star to *, ~, ~user, $var or `cmd`. - * * would become **, which walks the whole tree. - * ~ would be at the start of the file name, but not the tail. - * $ could be anywhere in the tail. - * ` could be anywhere in the file name. - * When the name ends in '$' don't add a star, remove the '$'. - */ - tail = path_tail(retval); - ends_in_star = (len > 0 && retval[len - 1] == '*'); + /* + * Don't add a star to *, ~, ~user, $var or `cmd`. + * * would become **, which walks the whole tree. + * ~ would be at the start of the file name, but not the tail. + * $ could be anywhere in the tail. + * ` could be anywhere in the file name. + * When the name ends in '$' don't add a star, remove the '$'. + */ + tail = path_tail(retval); + ends_in_star = (len > 0 && retval[len - 1] == '*'); #ifndef BACKSLASH_IN_FILENAME - for (i = len - 2; i >= 0; --i) { - if (retval[i] != '\\') - break; - ends_in_star = !ends_in_star; - } -#endif - if ((*retval != '~' || tail != retval) - && !ends_in_star - && vim_strchr(tail, '$') == NULL - && vim_strchr(retval, '`') == NULL) - retval[len++] = '*'; - else if (len > 0 && retval[len - 1] == '$') - --len; - retval[len] = NUL; + for (i = len - 2; i >= 0; --i) { + if (retval[i] != '\\') + break; + ends_in_star = !ends_in_star; } +#endif + if ((*retval != '~' || tail != retval) + && !ends_in_star + && vim_strchr(tail, '$') == NULL + && vim_strchr(retval, '`') == NULL) + retval[len++] = '*'; + else if (len > 0 && retval[len - 1] == '$') + --len; + retval[len] = NUL; } return retval; } @@ -3506,8 +3503,6 @@ expand_cmdline ( /* add star to file name, or convert to regexp if not exp. files. */ xp->xp_pattern_len = (int)(str + col - xp->xp_pattern); file_str = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context); - if (file_str == NULL) - return EXPAND_UNSUCCESSFUL; if (p_wic) options += WILD_ICASE; diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 370584b095..863e44ed9c 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -28,6 +28,7 @@ #include "nvim/ex_docmd.h" #include "nvim/ex_eval.h" #include "nvim/fold.h" +#include "nvim/func_attr.h" #include "nvim/getchar.h" #include "nvim/hashtab.h" #include "nvim/iconv.h" @@ -2106,6 +2107,7 @@ void set_forced_fenc(exarg_T *eap) * When *pp is not set to NULL, the result is in allocated memory. */ static char_u *next_fenc(char_u **pp) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET { char_u *p; char_u *r; @@ -2125,10 +2127,6 @@ static char_u *next_fenc(char_u **pp) free(r); r = p; } - if (r == NULL) { /* out of memory */ - r = (char_u *)""; - *pp = NULL; - } return r; } @@ -4923,54 +4921,51 @@ buf_check_timestamp ( if (mesg != NULL) { path = home_replace_save(buf, buf->b_fname); - if (path != NULL) { - if (!helpmesg) - mesg2 = ""; - tbuf = xmalloc(STRLEN(path) + STRLEN(mesg) + STRLEN(mesg2) + 2); - sprintf((char *)tbuf, mesg, path); - /* Set warningmsg here, before the unimportant and output-specific - * mesg2 has been appended. */ - set_vim_var_string(VV_WARNINGMSG, tbuf, -1); - if (can_reload) { - if (*mesg2 != NUL) { - STRCAT(tbuf, "\n"); - STRCAT(tbuf, mesg2); - } - if (do_dialog(VIM_WARNING, (char_u *)_("Warning"), tbuf, - (char_u *)_("&OK\n&Load File"), 1, NULL, TRUE) == 2) - reload = TRUE; - } else if (State > NORMAL_BUSY || (State & CMDLINE) || - already_warned) { - if (*mesg2 != NUL) { - STRCAT(tbuf, "; "); - STRCAT(tbuf, mesg2); - } - EMSG(tbuf); - retval = 2; - } else { - if (!autocmd_busy) { - msg_start(); - msg_puts_attr(tbuf, hl_attr(HLF_E) + MSG_HIST); - if (*mesg2 != NUL) - msg_puts_attr((char_u *)mesg2, - hl_attr(HLF_W) + MSG_HIST); - msg_clr_eos(); - (void)msg_end(); - if (emsg_silent == 0) { - out_flush(); - /* give the user some time to think about it */ - os_delay(1000L, true); - - /* don't redraw and erase the message */ - redraw_cmdline = FALSE; - } - } - already_warned = TRUE; + if (!helpmesg) + mesg2 = ""; + tbuf = xmalloc(STRLEN(path) + STRLEN(mesg) + STRLEN(mesg2) + 2); + sprintf((char *)tbuf, mesg, path); + /* Set warningmsg here, before the unimportant and output-specific + * mesg2 has been appended. */ + set_vim_var_string(VV_WARNINGMSG, tbuf, -1); + if (can_reload) { + if (*mesg2 != NUL) { + STRCAT(tbuf, "\n"); + STRCAT(tbuf, mesg2); + } + if (do_dialog(VIM_WARNING, (char_u *)_("Warning"), tbuf, + (char_u *)_("&OK\n&Load File"), 1, NULL, TRUE) == 2) + reload = TRUE; + } else if (State > NORMAL_BUSY || (State & CMDLINE) || already_warned) { + if (*mesg2 != NUL) { + STRCAT(tbuf, "; "); + STRCAT(tbuf, mesg2); } + EMSG(tbuf); + retval = 2; + } else { + if (!autocmd_busy) { + msg_start(); + msg_puts_attr(tbuf, hl_attr(HLF_E) + MSG_HIST); + if (*mesg2 != NUL) + msg_puts_attr((char_u *)mesg2, + hl_attr(HLF_W) + MSG_HIST); + msg_clr_eos(); + (void)msg_end(); + if (emsg_silent == 0) { + out_flush(); + /* give the user some time to think about it */ + os_delay(1000L, true); - free(path); - free(tbuf); + /* don't redraw and erase the message */ + redraw_cmdline = FALSE; + } + } + already_warned = TRUE; } + + free(path); + free(tbuf); } if (reload) { diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index bb41db6168..843cbcf6f9 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -1649,7 +1649,6 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches) char *cntxformat = " <<%s>>"; char *context; char *cstag_msg = _("Cscope tag: %s"); - char *csfmt_str = "%4d %6s "; assert (num_matches > 0); @@ -1691,17 +1690,15 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches) lno[strlen(lno)-2] = '\0'; /* ignore ;" at the end */ + const char *csfmt_str = "%4d %6s "; /* hopefully 'num' (num of matches) will be less than 10^16 */ newsize = strlen(csfmt_str) + 16 + strlen(lno); if (bufsize < newsize) { buf = xrealloc(buf, newsize); bufsize = newsize; } - if (buf != NULL) { - /* csfmt_str = "%4d %6s "; */ - (void)sprintf(buf, csfmt_str, num, lno); - MSG_PUTS_ATTR(buf, hl_attr(HLF_CM)); - } + (void)sprintf(buf, csfmt_str, num, lno); + MSG_PUTS_ATTR(buf, hl_attr(HLF_CM)); MSG_PUTS_LONG_ATTR(cs_pathcomponents(fname), hl_attr(HLF_CM)); /* compute the required space for the context */ @@ -1715,16 +1712,14 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches) buf = xrealloc(buf, newsize); bufsize = newsize; } - if (buf != NULL) { - (void)sprintf(buf, cntxformat, context); - - /* print the context only if it fits on the same line */ - if (msg_col + (int)strlen(buf) >= (int)Columns) - msg_putchar('\n'); - msg_advance(12); - MSG_PUTS_LONG(buf); + (void)sprintf(buf, cntxformat, context); + + /* print the context only if it fits on the same line */ + if (msg_col + (int)strlen(buf) >= (int)Columns) msg_putchar('\n'); - } + msg_advance(12); + MSG_PUTS_LONG(buf); + msg_putchar('\n'); if (extra != NULL) { msg_advance(13); MSG_PUTS_LONG(extra); diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c index 9c636ebbcc..8310f635c9 100644 --- a/src/nvim/indent_c.c +++ b/src/nvim/indent_c.c @@ -1593,8 +1593,6 @@ int get_c_indent(void) * This is required, because only the most recent line obtained with * ml_get is valid! */ linecopy = vim_strsave(ml_get(cur_curpos.lnum)); - if (linecopy == NULL) - return 0; /* * In insert mode and the cursor is on a ')' truncate the line at the diff --git a/src/nvim/mark.c b/src/nvim/mark.c index cfc702f189..5853b535cd 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -506,8 +506,6 @@ void fmarks_check_names(buf_T *buf) return; name = home_replace_save(buf, buf->b_ffname); - if (name == NULL) - return; for (i = 0; i < NMARKS + EXTRA_MARKS; ++i) fmarks_check_one(&namedfm[i], name, buf); @@ -1327,19 +1325,17 @@ int removable(char_u *name) size_t n; name = home_replace_save(NULL, name); - if (name != NULL) { - for (p = p_viminfo; *p; ) { - copy_option_part(&p, part, 51, ", "); - if (part[0] == 'r') { - n = STRLEN(part + 1); - if (MB_STRNICMP(part + 1, name, n) == 0) { - retval = TRUE; - break; - } + for (p = p_viminfo; *p; ) { + copy_option_part(&p, part, 51, ", "); + if (part[0] == 'r') { + n = STRLEN(part + 1); + if (MB_STRNICMP(part + 1, name, n) == 0) { + retval = TRUE; + break; } } - free(name); } + free(name); return retval; } @@ -1451,8 +1447,6 @@ void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags */ str = skipwhite(line + 1); str = viminfo_readstring(virp, (int)(str - virp->vir_line), FALSE); - if (str == NULL) - continue; p = str + STRLEN(str); while (p != str && (*p == NUL || vim_isspace(*p))) p--; diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 1fa6d6acc6..29b372e057 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -1240,10 +1240,8 @@ theend: mf_put(mfp, hp, false, false); mf_close(mfp, false); /* will also free(mfp->mf_fname) */ } - if (buf != NULL) { - free(buf->b_ml.ml_stack); - free(buf); - } + free(buf->b_ml.ml_stack); + free(buf); if (serious_error && called_from_main) ml_close(curbuf, TRUE); else { @@ -3279,10 +3277,7 @@ findswapname ( /* * we try different names until we find one that does not exist yet */ - if (dir_name == NULL) /* out of memory */ - fname = NULL; - else - fname = makeswapname(buf_fname, buf->b_ffname, buf, dir_name); + fname = makeswapname(buf_fname, buf->b_ffname, buf, dir_name); for (;; ) { if (fname == NULL) /* must be out of memory */ diff --git a/src/nvim/message.c b/src/nvim/message.c index 9cd3814826..87b0253d70 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1083,8 +1083,7 @@ static void msg_home_replace_attr(char_u *fname, int attr) char_u *name; name = home_replace_save(NULL, fname); - if (name != NULL) - msg_outtrans_attr(name, attr); + msg_outtrans_attr(name, attr); free(name); } diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index aa4d2b38db..383e2bf6a5 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -3466,8 +3466,6 @@ get_cmd_output ( i = (int)fread((char *)buffer, (size_t)1, (size_t)len, fd); fclose(fd); os_remove((char *)tempname); - if (buffer == NULL) - goto done; if (i != len) { EMSG2(_(e_notread), tempname); free(buffer); diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 90cb482ec5..cdd2ddcc12 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -61,7 +61,8 @@ #define DELETION_REGISTER 36 #define CLIP_REGISTER 37 -# define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS) +#define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS) +#define CB_LATEST (-1) /* * Each yank register is an array of pointers to lines. */ @@ -1382,10 +1383,9 @@ int op_delete(oparg_T *oap) * register. For the black hole register '_' don't yank anything. */ if (oap->regname != '_') { - bool unnamedclip = oap->regname == 0 && (cb_flags & CB_UNNAMEDMASK); - if (oap->regname != 0 || unnamedclip) { + if (oap->regname != 0) { /* check for read-only register */ - if (!( valid_yank_reg(oap->regname, TRUE) || unnamedclip )) { + if (!( valid_yank_reg(oap->regname, TRUE) )) { beep_flush(); return OK; } @@ -1421,6 +1421,9 @@ int op_delete(oparg_T *oap) oap->regname = 0; } + if(oap->regname == 0 && did_yank) { + set_clipboard(CB_LATEST); + } /* * If there's too much stuff to fit in the yank register, then get a * confirmation before doing the delete. This is crude, but simple. @@ -5275,40 +5278,44 @@ static void free_register(struct yankreg *reg) } // return target register -static int adjust_clipboard_name(int *name) { +static struct yankreg* adjust_clipboard_name(int *name) { if (*name == '*' || *name == '+') { if(!eval_has_provider("clipboard")) { EMSG("clipboard: provider is not available"); - return -1; + return NULL; } - return CLIP_REGISTER; - } else if (*name == NUL && (cb_flags & (CB_UNNAMED | CB_UNNAMEDPLUS))) { + return &y_regs[CLIP_REGISTER]; + } else if ((*name == NUL || *name == CB_LATEST) && (cb_flags & CB_UNNAMEDMASK)) { if(!eval_has_provider("clipboard")) { if (!clipboard_didwarn_unnamed) { msg((char_u*)"clipboard: provider not available, ignoring clipboard=unnamed[plus]"); clipboard_didwarn_unnamed = true; } - return -1; + return NULL; + } + struct yankreg* target; + if (*name == CB_LATEST) { + target = y_current; + } else { + target = &y_regs[0]; } if (cb_flags & CB_UNNAMEDPLUS) { *name = '+'; } else { *name = '*'; } - return 0; //unnamed + return target; // unnamed register } // don't do anything for other register names - return -1; + return NULL; } static void get_clipboard(int name) { - int ireg = adjust_clipboard_name(&name); - if (ireg < 0) { + struct yankreg* reg = adjust_clipboard_name(&name); + if (reg == NULL) { return; } - - struct yankreg *reg = &y_regs[ireg]; free_register(reg); list_T *args = list_alloc(); @@ -5396,13 +5403,11 @@ err: static void set_clipboard(int name) { - int ireg = adjust_clipboard_name(&name); - if (ireg < 0) { + struct yankreg* reg = adjust_clipboard_name(&name); + if (reg == NULL) { return; } - struct yankreg *reg = &y_regs[ireg]; - list_T *lines = list_alloc(); for (int i = 0; i < reg->y_size; i++) { diff --git a/src/nvim/path.c b/src/nvim/path.c index 219dac12de..e5f78440c2 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -239,33 +239,31 @@ int vim_ispathlistsep(int c) * Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname" * It's done in-place. */ -void shorten_dir(char_u *str) +char_u *shorten_dir(char_u *str) { - char_u *tail, *s, *d; - int skip = FALSE; - - tail = path_tail(str); - d = str; - for (s = str;; ++s) { + char_u *tail = path_tail(str); + char_u *d = str; + bool skip = false; + for (char_u *s = str;; ++s) { if (s >= tail) { /* copy the whole tail */ *d++ = *s; if (*s == NUL) break; } else if (vim_ispathsep(*s)) { /* copy '/' and next char */ *d++ = *s; - skip = FALSE; + skip = false; } else if (!skip) { *d++ = *s; /* copy next char */ if (*s != '~' && *s != '.') /* and leading "~" and "." */ - skip = TRUE; + skip = true; if (has_mbyte) { int l = mb_ptr2len(s); - while (--l > 0) *d++ = *++s; } } } + return str; } /* @@ -883,11 +881,9 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern) } free(curdir); - if (in_curdir != NULL) { - for (int i = 0; i < gap->ga_len; i++) - free(in_curdir[i]); - free(in_curdir); - } + for (int i = 0; i < gap->ga_len; i++) + free(in_curdir[i]); + free(in_curdir); ga_clear_strings(&path_ga); vim_regfree(regmatch.regprog); diff --git a/src/nvim/po/ru.cp1251.po b/src/nvim/po/ru.cp1251.po index df1bf7873a..4dd4cec235 100644 --- a/src/nvim/po/ru.cp1251.po +++ b/src/nvim/po/ru.cp1251.po @@ -7,10 +7,10 @@ # msgid "" msgstr "" -"Project-Id-Version: vim_7.4_ru\n" +"Project-Id-Version: vim_ru\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-05-26 14:21+0200\n" -"PO-Revision-Date: 2013-08-31 21:11+0400\n" +"PO-Revision-Date: 2014-10-10 12:00+0400\n" "Last-Translator: Sergey Alyoshin <alyoshin.s@gmail.com>\n" "Language-Team: \n" "Language: Russian\n" @@ -820,18 +820,17 @@ msgid "sort() argument" msgstr " sort()" #: ../eval.c:13721 -#, fuzzy msgid "uniq() argument" -msgstr " add()" +msgstr " uniq()" #: ../eval.c:13776 msgid "E702: Sort compare function failed" msgstr "E702: " #: ../eval.c:13806 -#, fuzzy msgid "E882: Uniq compare function failed" -msgstr "E702: " +msgstr "" +"E882: " #: ../eval.c:14085 msgid "(Invalid)" @@ -957,18 +956,14 @@ msgid "E129: Function name required" msgstr "E129: " #: ../eval.c:17824 -#, fuzzy, c-format +#, c-format msgid "E128: Function name must start with a capital or \"s:\": %s" -msgstr "" -"E128: " -": %s" +msgstr "E128: \"s:\": %s" #: ../eval.c:17833 -#, fuzzy, c-format +#, c-format msgid "E884: Function name cannot contain a colon: %s" -msgstr "" -"E128: " -": %s" +msgstr "E884: : %s" #: ../eval.c:18336 #, c-format @@ -1116,6 +1111,10 @@ msgstr "E138: viminfo %s!" msgid "Writing viminfo file \"%s\"" msgstr " viminfo \"%s\"" +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: viminfo %s!" + #. Write the info: #: ../ex_cmds.c:1720 #, c-format @@ -1358,6 +1357,10 @@ msgstr "E158: : %s" msgid "E157: Invalid sign ID: %<PRId64>" msgstr "E157: ID : %<PRId64>" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: %s" + #: ../ex_cmds.c:6066 msgid " (not supported)" msgstr " ( )" @@ -2003,6 +2006,9 @@ msgstr "E344: \"%s\" " msgid "E345: Can't find file \"%s\" in path" msgstr "E345: \"%s\" " +msgid "List or number required" +msgstr " " + #: ../file_search.c:1512 #, c-format msgid "E346: No more directory \"%s\" found in cdpath" @@ -4533,6 +4539,13 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: " +"" + #: ../ops.c:5089 #, c-format msgid "%<PRId64> Cols; " @@ -4796,6 +4809,19 @@ msgstr "" "\n" " " +msgid "Could not set security context " +msgstr " " + +msgid " for " +msgstr " " + +#. no enough size OR unexpected error +msgid "Could not get security context " +msgstr " " + +msgid ". Removing it!\n" +msgstr ". !\n" + #: ../os_unix.c:1558 ../os_unix.c:1647 #, c-format msgid "dlerror = \"%s\"" @@ -5008,6 +5034,10 @@ msgstr "E554: %s{...}" msgid "External submatches:\n" msgstr " :\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (. ) %s" + #: ../regexp.c:7022 msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " @@ -8243,3 +8273,10 @@ msgstr "E446: " #~ msgstr "" #~ " : sys.path \n" #~ " vim.VIM_SPECIAL_PATH sys.path" + +#~ msgid "" +#~ "E887: Sorry, this command is disabled, the Python's site module could not be " +#~ "loaded." +#~ msgstr "" +#~ "E887: , " +#~ "Python site." diff --git a/src/nvim/po/ru.po b/src/nvim/po/ru.po index 0028cbfccd..5bdbc33801 100644 --- a/src/nvim/po/ru.po +++ b/src/nvim/po/ru.po @@ -7,10 +7,10 @@ # msgid "" msgstr "" -"Project-Id-Version: vim_7.4_ru\n" +"Project-Id-Version: vim_ru\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-05-26 14:21+0200\n" -"PO-Revision-Date: 2013-08-31 21:11+0400\n" +"PO-Revision-Date: 2014-10-10 12:00+0400\n" "Last-Translator: Sergey Alyoshin <alyoshin.s@gmail.com>\n" "Language-Team: \n" "Language: Russian\n" @@ -820,18 +820,17 @@ msgid "sort() argument" msgstr "параметра sort()" #: ../eval.c:13721 -#, fuzzy msgid "uniq() argument" -msgstr "параметра add()" +msgstr "параметра uniq()" #: ../eval.c:13776 msgid "E702: Sort compare function failed" msgstr "E702: Неудачное завершение функции сравнения при сортировке" #: ../eval.c:13806 -#, fuzzy msgid "E882: Uniq compare function failed" -msgstr "E702: Неудачное завершение функции сравнения при сортировке" +msgstr "" +"E882: Неудачное завершение функции сравнения при проверке единственности" #: ../eval.c:14085 msgid "(Invalid)" @@ -957,18 +956,15 @@ msgid "E129: Function name required" msgstr "E129: Требуется имя функции" #: ../eval.c:17824 -#, fuzzy, c-format +#, c-format msgid "E128: Function name must start with a capital or \"s:\": %s" -msgstr "" -"E128: Имя функции должно начинаться с заглавной буквы или содержать " +msgstr "E128: Имя функции должно начинаться с заглавной буквы или \"s:\": %s" "двоеточие: %s" #: ../eval.c:17833 -#, fuzzy, c-format +#, c-format msgid "E884: Function name cannot contain a colon: %s" -msgstr "" -"E128: Имя функции должно начинаться с заглавной буквы или содержать " -"двоеточие: %s" +msgstr "E884: Имя функции не может содержать двоеточие: %s" #: ../eval.c:18336 #, c-format @@ -1116,6 +1112,10 @@ msgstr "E138: Невозможно записать файл viminfo %s!" msgid "Writing viminfo file \"%s\"" msgstr "Запись файла viminfo \"%s\"" +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Невозможно переименовать файл viminfo в %s!" + #. Write the info: #: ../ex_cmds.c:1720 #, c-format @@ -1358,6 +1358,10 @@ msgstr "E158: Неправильное имя буфера: %s" msgid "E157: Invalid sign ID: %<PRId64>" msgstr "E157: Неправильный ID значка: %<PRId64>" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Невозможно изменить значок %s" + #: ../ex_cmds.c:6066 msgid " (not supported)" msgstr " (не поддерживается)" @@ -4533,6 +4537,12 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Неизвестный тип регистра %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: шаблон поиска и регистр выражения не могут содержать двух или более " + #: ../ops.c:5089 #, c-format msgid "%<PRId64> Cols; " @@ -4801,11 +4811,27 @@ msgstr "" msgid "dlerror = \"%s\"" msgstr "dlerror = \"%s\"" +msgid "Could not set security context " +msgstr "Невозможно установить контекст безопасности " + +msgid " for " +msgstr " для " + +msgid ". Removing it!\n" +msgstr ". Будет удалён!\n" + +#. no enough size OR unexpected error +msgid "Could not get security context " +msgstr "Невозможно получить контекст безопасности " + #: ../path.c:1449 #, c-format msgid "E447: Can't find file \"%s\" in path" msgstr "E447: Файл \"%s\" не найден по известным путям" +msgid "List or number required" +msgstr "Требуется список или число" + #: ../quickfix.c:359 #, c-format msgid "E372: Too many %%%c in format string" @@ -4999,6 +5025,10 @@ msgstr "E678: Недопустимый символ после %s%%[dxouU]" msgid "E71: Invalid character after %s%%" msgstr "E71: Недопустимый символ после %s%%" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (рег. выражение НКА) невозможно повторить %s" + #: ../regexp.c:3017 #, c-format msgid "E554: Syntax error in %s{...}" @@ -8243,3 +8273,10 @@ msgstr "E446: Нет имени файла в позиции курсора" #~ msgstr "" #~ "Ошибка при установке пути: sys.path не является списком\n" #~ "Следует добавить vim.VIM_SPECIAL_PATH в sys.path" + +#~ msgid "" +#~ "E887: Sorry, this command is disabled, the Python's site module could not be " +#~ "loaded." +#~ msgstr "" +#~ "E887: К сожалению эта команда не работает, поскольку не загружен модуль " +#~ "Python site." diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index af2ab73dc8..1ea12d6862 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -370,17 +370,13 @@ void pum_redraw(void) size++; } } - screen_puts_len(rt, (int)STRLEN(rt), row, col - size + 1, - attr); + screen_puts_len(rt, (int)STRLEN(rt), row, col - size + 1, attr); free(rt_start); free(st); - col -= width; } else { - if (st != NULL) { - screen_puts_len(st, (int)STRLEN(st), row, col, attr); - free(st); - } + screen_puts_len(st, (int)STRLEN(st), row, col, attr); + free(st); col += width; } diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 6e4c17f49e..6d25c4359b 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -3444,6 +3444,10 @@ win_line ( 1); // TODO: is passing p for start of the line OK? n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol, NULL) - 1; + if (c == TAB && n_extra + col > wp->w_width) { + n_extra = (int)wp->w_buffer->b_p_ts + - vcol % (int)wp->w_buffer->b_p_ts - 1; + } c_extra = ' '; if (vim_iswhite(c)) { if (c == TAB) @@ -7791,7 +7795,7 @@ static void draw_tabline(void) if (room > 0) { /* Get buffer name in NameBuff[] */ get_trans_bufname(cwp->w_buffer); - shorten_dir(NameBuff); + (void)shorten_dir(NameBuff); len = vim_strsize(NameBuff); p = NameBuff; if (has_mbyte) diff --git a/src/nvim/search.c b/src/nvim/search.c index e2781f17d5..055d2db445 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -4025,8 +4025,6 @@ find_pattern_in_path ( def_regmatch.rm_ic = FALSE; /* don't ignore case in define pat. */ } files = xcalloc(max_path_depth, sizeof(SearchedFile)); - if (files == NULL) - goto fpip_end; old_files = max_path_depth; depth = depth_displayed = -1; @@ -4627,18 +4625,15 @@ int read_viminfo_search_pattern(vir_T *virp, int force) hlsearch_on = TRUE; if (idx >= 0) { if (force || spats[idx].pat == NULL) { - val = viminfo_readstring(virp, (int)(lp - virp->vir_line + 1), - TRUE); - if (val != NULL) { - set_last_search_pat(val, idx, magic, setlast); - free(val); - spats[idx].no_scs = no_scs; - spats[idx].off.line = off_line; - spats[idx].off.end = off_end; - spats[idx].off.off = off; - if (setlast) { - SET_NO_HLSEARCH(!hlsearch_on); - } + val = viminfo_readstring(virp, (int)(lp - virp->vir_line + 1), TRUE); + set_last_search_pat(val, idx, magic, setlast); + free(val); + spats[idx].no_scs = no_scs; + spats[idx].off.line = off_line; + spats[idx].off.end = off_end; + spats[idx].off.off = off; + if (setlast) { + SET_NO_HLSEARCH(!hlsearch_on); } } } diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 3753d9c85b..1d13a6abad 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -4545,11 +4545,9 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) // Turn flag "c" into COMPOUNDRULE compatible string "c+", // "Na" into "Na+", "1234" into "1234+". p = getroom(spin, STRLEN(items[1]) + 2, false); - if (p != NULL) { - STRCPY(p, items[1]); - STRCAT(p, "+"); - compflags = p; - } + STRCPY(p, items[1]); + STRCAT(p, "+"); + compflags = p; } else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2)) { // We don't use the count, but do check that it's a number and // not COMPOUNDRULE mistyped. @@ -4565,14 +4563,12 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) if (compflags != NULL) l += (int)STRLEN(compflags) + 1; p = getroom(spin, l, false); - if (p != NULL) { - if (compflags != NULL) { - STRCPY(p, compflags); - STRCAT(p, "/"); - } - STRCAT(p, items[1]); - compflags = p; + if (compflags != NULL) { + STRCPY(p, compflags); + STRCAT(p, "/"); } + STRCAT(p, items[1]); + compflags = p; } } else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2) && compmax == 0) { @@ -5199,8 +5195,6 @@ static void process_compflags(spellinfo_T *spin, afffile_T *aff, char_u *compfla if (spin->si_compflags != NULL) len += (int)STRLEN(spin->si_compflags) + 1; p = getroom(spin, len, false); - if (p == NULL) - return; if (spin->si_compflags != NULL) { STRCPY(p, spin->si_compflags); STRCAT(p, "/"); diff --git a/src/nvim/term.c b/src/nvim/term.c index 78fd3c6a67..14c087cb60 100644 --- a/src/nvim/term.c +++ b/src/nvim/term.c @@ -3245,11 +3245,11 @@ int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen) if (key_name[0] == KS_SGR_MOUSE) mouse_code += 32; - mouse_col = getdigits_int(&p); + mouse_col = getdigits_int(&p) - 1; if (*p++ != ';') return -1; - mouse_row = getdigits_int(&p); + mouse_row = getdigits_int(&p) - 1; if (key_name[0] == KS_SGR_MOUSE && *p == 'm') mouse_code |= MOUSE_RELEASE; else if (*p != 'M') diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index fce0971d89..afa4ce67f4 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -106,7 +106,8 @@ clean: $(RM_ON_START) \ valgrind.* \ .*.swp \ - .*.swo + .*.swo \ + del test1.out: .gdbinit test1.in -rm -rf $*.failed $(RM_ON_RUN) $(RM_ON_START) wrongtermsize diff --git a/src/nvim/version.c b/src/nvim/version.c index 6ca226b45f..6056a9d2a7 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -176,7 +176,10 @@ static char *(features[]) = { NULL }; +// clang-format off static int included_patches[] = { + //591 NA + //590, //589 NA //588, //587, @@ -244,15 +247,15 @@ static int included_patches[] = { //525, //524, //523 NA - //522, + //522 NA 521, 520, //519, 518, - //517, + 517, 516, //515, - //514, + 514, 513, //512 NA //511 NA @@ -768,6 +771,7 @@ static int included_patches[] = { 1, 0 }; +// clang-format on /// Place to put a short description when adding a feature with a patch. /// Keep it short, e.g.,: "relative numbers", "persistent undo". |