diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-09-22 13:38:58 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-09-22 13:38:58 -0400 |
commit | 1c84a0e09093d728408024a6baa9967df596be54 (patch) | |
tree | 3038828072136affc9de36257ac49ba069ede25b /src/nvim/diff.c | |
parent | a4b9e0df67ae95777f8f7d833e7d4c6b8fc3840c (diff) | |
parent | 22bd722c011b04a5fff3182c370c877d82e0fbe0 (diff) | |
download | rneovim-1c84a0e09093d728408024a6baa9967df596be54.tar.gz rneovim-1c84a0e09093d728408024a6baa9967df596be54.tar.bz2 rneovim-1c84a0e09093d728408024a6baa9967df596be54.zip |
Merge pull request #1108 from war1025/dev/for_all_tabs
FOR_ALL_TAB_WINDOWS cleanup. Add FOR_ALL_TABS and FOR_ALL_WINDOWS_IN_TAB.
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. |