aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/diff.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-12-14 13:42:10 -0500
committerJustin M. Keyes <justinkz@gmail.com>2014-12-14 13:42:10 -0500
commitec6afbf4e621bfcfde903d15744dc0c61f80097d (patch)
tree94fd08577b5eed003b6f7eb3a7bcafcac7f20a66 /src/nvim/diff.c
parent64a32d55c59188f1e922ca438fdb2d65caa06665 (diff)
parent0bc40e660c0a74776ace86ad5e393755523c3803 (diff)
downloadrneovim-ec6afbf4e621bfcfde903d15744dc0c61f80097d.tar.gz
rneovim-ec6afbf4e621bfcfde903d15744dc0c61f80097d.tar.bz2
rneovim-ec6afbf4e621bfcfde903d15744dc0c61f80097d.zip
Merge pull request #1661 from philix/early_exit
Reduce indentation level by early returning or continuing loop
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r--src/nvim/diff.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index b557753bff..3151daf826 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -579,24 +579,25 @@ static int diff_check_sanity(tabpage_T *tp, diff_T *dp)
static void diff_redraw(int dofold)
{
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
- if (wp->w_p_diff) {
- redraw_win_later(wp, SOME_VALID);
- if (dofold && foldmethodIsDiff(wp)) {
- foldUpdateAll(wp);
- }
+ if (!wp->w_p_diff) {
+ continue;
+ }
+ redraw_win_later(wp, SOME_VALID);
+ if (dofold && foldmethodIsDiff(wp)) {
+ foldUpdateAll(wp);
+ }
- /* A change may have made filler lines invalid, need to take care
- * of that for other windows. */
- int n = diff_check(wp, wp->w_topline);
+ /* A change may have made filler lines invalid, need to take care
+ * of that for other windows. */
+ int n = diff_check(wp, wp->w_topline);
- if (((wp != curwin) && (wp->w_topfill > 0)) || (n > 0)) {
- if (wp->w_topfill > n) {
- wp->w_topfill = (n < 0 ? 0 : n);
- } else if ((n > 0) && (n > wp->w_topfill)) {
- wp->w_topfill = n;
- }
- check_topfill(wp, FALSE);
+ if (((wp != curwin) && (wp->w_topfill > 0)) || (n > 0)) {
+ if (wp->w_topfill > n) {
+ wp->w_topfill = (n < 0 ? 0 : n);
+ } else if ((n > 0) && (n > wp->w_topfill)) {
+ wp->w_topfill = n;
}
+ check_topfill(wp, FALSE);
}
}
}