aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/misc1.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/misc1.c')
-rw-r--r--src/nvim/misc1.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index d4a406cdba..ffe2d11f08 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -1099,7 +1099,6 @@ int get_last_leader_offset(char_u *line, char_u **flags)
found_one = FALSE;
for (list = curbuf->b_p_com; *list; ) {
char_u *flags_save = list;
- bool is_only_whitespace = false;
/*
* Get one option part into part_buf[]. Advance list to next one.
@@ -1126,9 +1125,6 @@ int get_last_leader_offset(char_u *line, char_u **flags)
while (ascii_iswhite(*string)) {
string++;
}
- if (*string == NUL) {
- is_only_whitespace = true;
- }
}
for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j)
/* do nothing */;
@@ -1144,10 +1140,12 @@ int get_last_leader_offset(char_u *line, char_u **flags)
continue;
}
- // For a middlepart comment that is only white space, only consider
- // it to match if everything before the current position in the
- // line is also whitespace.
- if (is_only_whitespace && vim_strchr(part_buf, COM_MIDDLE) != NULL) {
+ 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) {
@@ -1953,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) {
@@ -2025,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);