diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-08-08 17:36:54 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2021-09-26 12:19:54 +0200 |
commit | 392c658d4d0f9457f143748adf98ecd4cdc8dc85 (patch) | |
tree | 187943b860e19c66dbdd898661d67274c55e983f /src/nvim/diff.c | |
parent | b3b02eb52943fdc8ba74af3b485e9d11655bc9c9 (diff) | |
download | rneovim-392c658d4d0f9457f143748adf98ecd4cdc8dc85.tar.gz rneovim-392c658d4d0f9457f143748adf98ecd4cdc8dc85.tar.bz2 rneovim-392c658d4d0f9457f143748adf98ecd4cdc8dc85.zip |
feat(decorations): support virtual lines (for now: only one block at a time)
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r-- | src/nvim/diff.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 93c0d636fa..5c43b2498e 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -1985,26 +1985,6 @@ static int diff_cmp(char_u *s1, char_u *s2) return 0; } -/// Return the number of filler lines above "lnum". -/// -/// @param wp -/// @param lnum -/// -/// @return Number of filler lines above lnum -int diff_check_fill(win_T *wp, linenr_T lnum) -{ - // be quick when there are no filler lines - if (!(diff_flags & DIFF_FILLER)) { - return 0; - } - int n = diff_check(wp, lnum); - - if (n <= 0) { - return 0; - } - return n; -} - /// Set the topline of "towin" to match the position in "fromwin", so that they /// show the same diff'ed lines. /// @@ -2030,6 +2010,7 @@ void diff_set_topline(win_T *fromwin, win_T *towin) } towin->w_topfill = 0; + // search for a change that includes "lnum" in the list of diffblocks. for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next) { if (lnum <= dp->df_lnum[fromidx] + dp->df_count[fromidx]) { @@ -2255,6 +2236,13 @@ bool diffopt_closeoff(void) return (diff_flags & DIFF_CLOSE_OFF) != 0; } +// Return true if 'diffopt' contains "filler". +bool diffopt_filler(void) + FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT +{ + return (diff_flags & DIFF_FILLER) != 0; +} + /// Find the difference within a changed line. /// /// @param wp window whose current buffer to check |