diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-12-27 22:49:44 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-12-27 22:49:44 +0100 |
commit | c1015121ec626cab6cb384f544bc0be1a1760c0e (patch) | |
tree | 6cc9a5d1899a4486a24c491e07d17a7dd01f9503 /src/nvim/misc1.c | |
parent | 4f030ec24e0e148bbb83aedaef7dd629e5fef130 (diff) | |
parent | e1876c7ad1b5e30c0a9919e2c4587d11550c8507 (diff) | |
download | rneovim-c1015121ec626cab6cb384f544bc0be1a1760c0e.tar.gz rneovim-c1015121ec626cab6cb384f544bc0be1a1760c0e.tar.bz2 rneovim-c1015121ec626cab6cb384f544bc0be1a1760c0e.zip |
Merge 'upstream/master' into pr-win-erw7
Diffstat (limited to 'src/nvim/misc1.c')
-rw-r--r-- | src/nvim/misc1.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 4032210213..ffe2d11f08 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -52,6 +52,7 @@ #include "nvim/window.h" #include "nvim/os/os.h" #include "nvim/os/shell.h" +#include "nvim/os/signal.h" #include "nvim/os/input.h" #include "nvim/os/time.h" #include "nvim/event/stream.h" @@ -1121,8 +1122,9 @@ int get_last_leader_offset(char_u *line, char_u **flags) if (ascii_iswhite(string[0])) { if (i == 0 || !ascii_iswhite(line[i - 1])) continue; - while (ascii_iswhite(string[0])) - ++string; + while (ascii_iswhite(*string)) { + string++; + } } for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j) /* do nothing */; @@ -1138,6 +1140,19 @@ int get_last_leader_offset(char_u *line, char_u **flags) continue; } + if (vim_strchr(part_buf, COM_MIDDLE) != NULL) { + // For a middlepart comment, only consider it to match if + // everything before the current position in the line is + // whitespace. Otherwise we would think we are inside a + // comment if the middle part appears somewhere in the middle + // of the line. E.g. for C the "*" appears often. + for (j = 0; ascii_iswhite(line[j]) && j <= i; j++) { + } + if (j < i) { + continue; + } + } + /* * We have found a match, stop searching. */ @@ -1936,10 +1951,10 @@ changed_lines( { changed_lines_buf(curbuf, lnum, lnume, xtra); - if (xtra == 0 && curwin->w_p_diff) { - /* When the number of lines doesn't change then mark_adjust() isn't - * called and other diff buffers still need to be marked for - * displaying. */ + if (xtra == 0 && curwin->w_p_diff && !diff_internal()) { + // When the number of lines doesn't change then mark_adjust() isn't + // called and other diff buffers still need to be marked for + // displaying. linenr_T wlnum; FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { @@ -2008,6 +2023,10 @@ static void changed_common(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra /* mark the buffer as modified */ changed(); + if (curwin->w_p_diff && diff_internal()) { + curtab->tp_diff_update = true; + } + /* set the '. mark */ if (!cmdmod.keepjumps) { RESET_FMARK(&curbuf->b_last_change, ((pos_T) {lnum, col, 0}), 0); @@ -2653,6 +2672,8 @@ void preserve_exit(void) } really_exiting = true; + // Ignore SIGHUP while we are already exiting. #9274 + signal_reject_deadly(); mch_errmsg(IObuff); mch_errmsg("\n"); ui_flush(); |