aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-07-16 12:20:11 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-01 15:28:49 -0400
commit3f8ba688952fd238e7d06cc55856dd46f581a781 (patch)
treeea1bc7f0b140cff081e80449b09a35413de318c3
parent971e9370adc1cc96412a61f22713549680918ca3 (diff)
downloadrneovim-3f8ba688952fd238e7d06cc55856dd46f581a781.tar.gz
rneovim-3f8ba688952fd238e7d06cc55856dd46f581a781.tar.bz2
rneovim-3f8ba688952fd238e7d06cc55856dd46f581a781.zip
screen: screen_cleared is TriState
-rw-r--r--src/nvim/globals.h2
-rw-r--r--src/nvim/screen.c32
2 files changed, 19 insertions, 15 deletions
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index d9103f516c..9f84482ac4 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -191,7 +191,7 @@ EXTERN int cmdline_star INIT(= FALSE); /* cmdline is crypted */
EXTERN int exec_from_reg INIT(= FALSE); /* executing register */
-EXTERN int screen_cleared INIT(= FALSE); /* screen has been cleared */
+EXTERN TriState screen_cleared INIT(= kFalse); // screen has been cleared
/*
* When '$' is included in 'cpoptions' option set:
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 9f0d8a5080..be45c1573c 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -833,12 +833,13 @@ static void win_update(win_T *wp)
type = VALID;
}
- /* Trick: we want to avoid clearing the screen twice. screenclear() will
- * set "screen_cleared" to TRUE. The special value MAYBE (which is still
- * non-zero and thus not FALSE) will indicate that screenclear() was not
- * called. */
- if (screen_cleared)
- screen_cleared = MAYBE;
+ // Trick: we want to avoid clearing the screen twice. screenclear() will
+ // set "screen_cleared" to kTrue. The special value kNone (which is still
+ // non-zero and thus not kFalse) will indicate that screenclear() was not
+ // called.
+ if (screen_cleared) {
+ screen_cleared = kNone;
+ }
/*
* If there are no changes on the screen that require a complete redraw,
@@ -999,14 +1000,16 @@ static void win_update(win_T *wp)
if (mid_start == 0) {
mid_end = wp->w_height;
if (ONE_WINDOW) {
- /* Clear the screen when it was not done by win_del_lines() or
- * win_ins_lines() above, "screen_cleared" is FALSE or MAYBE
- * then. */
- if (screen_cleared != TRUE)
+ // Clear the screen when it was not done by win_del_lines() or
+ // win_ins_lines() above, "screen_cleared" is kFalse or kNone
+ // then.
+ if (screen_cleared != kTrue) {
screenclear();
- /* The screen was cleared, redraw the tab pages line. */
- if (redraw_tabline)
+ }
+ // The screen was cleared, redraw the tab pages line.
+ if (redraw_tabline) {
draw_tabline();
+ }
}
}
@@ -1014,8 +1017,9 @@ static void win_update(win_T *wp)
* cleared (only happens for the first window) or when screenclear()
* was called directly above, "must_redraw" will have been set to
* NOT_VALID, need to reset it here to avoid redrawing twice. */
- if (screen_cleared == TRUE)
+ if (screen_cleared == kTrue) {
must_redraw = 0;
+ }
} else {
/* Not VALID or INVERTED: redraw all lines. */
mid_start = 0;
@@ -6068,7 +6072,7 @@ static void screenclear2(void)
ui_call_grid_clear(1); // clear the display
clear_cmdline = false;
mode_displayed = false;
- screen_cleared = true; // can use contents of ScreenLines now
+ screen_cleared = kTrue; // can use contents of ScreenLines now
win_rest_invalid(firstwin);
redraw_cmdline = TRUE;