diff options
| author | Daniel Hahler <git@thequod.de> | 2019-06-09 19:01:51 +0200 | 
|---|---|---|
| committer | Daniel Hahler <git@thequod.de> | 2019-08-07 14:21:23 +0200 | 
| commit | f717deea0680b19ec4c4bf715caf2554aba611b6 (patch) | |
| tree | 284f089d4609c87b016c652140778de8581f3c5f /src | |
| parent | b353d8599b7e105809d529f0707837b155a51abd (diff) | |
| download | rneovim-f717deea0680b19ec4c4bf715caf2554aba611b6.tar.gz rneovim-f717deea0680b19ec4c4bf715caf2554aba611b6.tar.bz2 rneovim-f717deea0680b19ec4c4bf715caf2554aba611b6.zip | |
move changed_lines
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/change.c | 60 | ||||
| -rw-r--r-- | src/nvim/misc1.c | 53 | 
2 files changed, 34 insertions, 79 deletions
| diff --git a/src/nvim/change.c b/src/nvim/change.c index 57619e7e09..79dffb7015 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -414,37 +414,45 @@ void changed_lines_buf(buf_T *buf, linenr_T lnum, linenr_T lnume, long xtra)   * Takes care of calling changed() and updating b_mod_*.   * Careful: may trigger autocommands that reload the buffer.   */ -    void +void  changed_lines( -    linenr_T	lnum,	    // first line with change -    colnr_T	col,	    // column in first line with change -    linenr_T	lnume,	    // line below last changed line -    long	xtra)	    // number of extra lines (negative when deleting) +    linenr_T lnum,        // first line with change +    colnr_T col,          // column in first line with change +    linenr_T lnume,       // line below last changed line +    long xtra,            // number of extra lines (negative when deleting) +    bool do_buf_event  // some callers like undo/redo call changed_lines() +                       // and then increment changedtick *again*. This flag +                       // allows these callers to send the nvim_buf_lines_event +                       // events after they're done modifying changedtick. +)  { -    changed_lines_buf(curbuf, lnum, lnume, xtra); +  changed_lines_buf(curbuf, lnum, lnume, xtra); -#ifdef FEAT_DIFF -    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. -	win_T	    *wp; -	linenr_T    wlnum; - -	FOR_ALL_WINDOWS(wp) -	    if (wp->w_p_diff && wp != curwin) -	    { -		redraw_win_later(wp, VALID); -		wlnum = diff_lnum_win(lnum, wp); -		if (wlnum > 0) -		    changed_lines_buf(wp->w_buffer, wlnum, -						    lnume - lnum + wlnum, 0L); -	    } +  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) { +      if (wp->w_p_diff && wp != curwin) { +        redraw_win_later(wp, VALID); +        wlnum = diff_lnum_win(lnum, wp); +        if (wlnum > 0) { +          changed_lines_buf(wp->w_buffer, wlnum, +              lnume - lnum + wlnum, 0L); +        } +      }      } -#endif +  } -    changed_common(lnum, col, lnume, xtra); +  changed_common(lnum, col, lnume, xtra); + +  if (do_buf_event) { +    int64_t num_added = (int64_t)(lnume + xtra - lnum); +    int64_t num_removed = lnume - lnum; +    buf_updates_send_changes(curbuf, lnum, num_added, num_removed, true); +  }  }  /* diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 21cce61853..d844f14e20 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -1786,59 +1786,6 @@ int gchar_pos(pos_T *pos)  }  /* - * Changed lines for the current buffer. - * Must be called AFTER the change and after mark_adjust(). - * - mark the buffer changed by calling changed() - * - mark the windows on this buffer to be redisplayed - * - invalidate cached values - * "lnum" is the first line that needs displaying, "lnume" the first line - * below the changed lines (BEFORE the change). - * When only inserting lines, "lnum" and "lnume" are equal. - * Takes care of calling changed() and updating b_mod_*. - * Careful: may trigger autocommands that reload the buffer. - */ -void -changed_lines( -    linenr_T lnum,        // first line with change -    colnr_T col,          // column in first line with change -    linenr_T lnume,       // line below last changed line -    long xtra,            // number of extra lines (negative when deleting) -    bool do_buf_event  // some callers like undo/redo call changed_lines() -                       // and then increment changedtick *again*. This flag -                       // allows these callers to send the nvim_buf_lines_event -                       // events after they're done modifying changedtick. -) -{ -  changed_lines_buf(curbuf, lnum, lnume, xtra); - -  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) { -      if (wp->w_p_diff && wp != curwin) { -        redraw_win_later(wp, VALID); -        wlnum = diff_lnum_win(lnum, wp); -        if (wlnum > 0) { -          changed_lines_buf(wp->w_buffer, wlnum, -              lnume - lnum + wlnum, 0L); -        } -      } -    } -  } - -  changed_common(lnum, col, lnume, xtra); - -  if (do_buf_event) { -    int64_t num_added = (int64_t)(lnume + xtra - lnum); -    int64_t num_removed = lnume - lnum; -    buf_updates_send_changes(curbuf, lnum, num_added, num_removed, true); -  } -} - -/*   * unchanged() is called when the changed flag must be reset for buffer 'buf'   */  void  | 
