diff options
author | Wayne Rowcliffe <war1025@gmail.com> | 2014-08-22 22:40:49 -0500 |
---|---|---|
committer | Wayne Rowcliffe <war1025@gmail.com> | 2014-09-22 09:26:40 -0500 |
commit | b4ec6c1a4bacd6eaef958e242310ffaee94805dd (patch) | |
tree | 114630b22cd9abbfbda3349fd91e37f3f116a277 /src/nvim/diff.c | |
parent | a4b9e0df67ae95777f8f7d833e7d4c6b8fc3840c (diff) | |
download | rneovim-b4ec6c1a4bacd6eaef958e242310ffaee94805dd.tar.gz rneovim-b4ec6c1a4bacd6eaef958e242310ffaee94805dd.tar.bz2 rneovim-b4ec6c1a4bacd6eaef958e242310ffaee94805dd.zip |
FOR_ALL_TABS helper
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r-- | src/nvim/diff.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 8f540fbe09..7927473439 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -62,8 +62,7 @@ static int diff_a_works = MAYBE; /// @param buf void diff_buf_delete(buf_T *buf) { - tabpage_T *tp; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) { + FOR_ALL_TABS(tp) { int i = diff_buf_idx_tp(buf, tp); if (i != DB_COUNT) { @@ -175,8 +174,7 @@ static int diff_buf_idx_tp(buf_T *buf, tabpage_T *tp) /// @param buf void diff_invalidate(buf_T *buf) { - tabpage_T *tp; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) { + FOR_ALL_TABS(tp) { int i = diff_buf_idx_tp(buf, tp); if (i != DB_COUNT) { tp->tp_diff_invalid = TRUE; @@ -197,8 +195,7 @@ void diff_mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after) { // Handle all tab pages that use the current buffer in a diff. - tabpage_T *tp; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) { + FOR_ALL_TABS(tp) { int idx = diff_buf_idx_tp(curbuf, tp); if (idx != DB_COUNT) { diff_mark_adjust_tp(tp, idx, line1, line2, amount, amount_after); @@ -1819,8 +1816,7 @@ int diffopt_changed(void) // If "icase" or "iwhite" was added or removed, need to update the diff. if (diff_flags != diff_flags_new) { - tabpage_T *tp; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) { + FOR_ALL_TABS(tp) { tp->tp_diff_invalid = TRUE; } } @@ -2376,15 +2372,14 @@ static void diff_fold_update(diff_T *dp, int skip_idx) /// @param buf The buffer to check. /// /// @return TRUE if buffer "buf" is in diff-mode. -int diff_mode_buf(buf_T *buf) +bool diff_mode_buf(buf_T *buf) { - tabpage_T *tp; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) { + FOR_ALL_TABS(tp) { if (diff_buf_idx_tp(buf, tp) != DB_COUNT) { - return TRUE; + return true; } } - return FALSE; + return false; } /// Move "count" times in direction "dir" to the next diff block. |