aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ui.c
diff options
context:
space:
mode:
authorScott Prager <splinterofchaos@gmail.com>2014-07-07 08:30:43 -0400
committerScott Prager <splinterofchaos@gmail.com>2014-11-11 11:34:58 -0500
commitf5aee19ac054f1a3f5359fe36a5290dfd715e000 (patch)
treedfe238d11ca4fb9dd26746730746ba76ea314d7f /src/nvim/ui.c
parente450c541ddfe1266d3d56b594f83ab197e747584 (diff)
downloadrneovim-f5aee19ac054f1a3f5359fe36a5290dfd715e000.tar.gz
rneovim-f5aee19ac054f1a3f5359fe36a5290dfd715e000.tar.bz2
rneovim-f5aee19ac054f1a3f5359fe36a5290dfd715e000.zip
Use bool for flags in oparg_T.
Several opart_T members like use_reg_one, end_adjusted, empty, is_VIsual, and block_mode, only ever store TRUE or FALSE, so make this constraint explicit by changing them to bools, and TRUE to true and FALSE to false in the context of their uses. The member, inclusive, has several other uses such as in arithmetic equations and one inequality, but every single assignment (obtained with 'grep -r "inclusive \\="') sets it to either TRUE or FALSE. This also implies that the inequality, "oap->end.coladd < oap->inclusive", can only be true when coladd==0 and inclusive==true, so test for that instead. For consistency, change the first argument of findpar (which ends up being inclusive) to bool. Include stdbool.h for consistency with issue #918. This commit shrinks the size of oparg_T from 128 bytes to 112 (-13%) on my machine.
Diffstat (limited to 'src/nvim/ui.c')
-rw-r--r--src/nvim/ui.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index 2c5f7158f6..d6269897d7 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -307,7 +307,7 @@ int check_row(int row)
int
jump_to_mouse (
int flags,
- int *inclusive, /* used for inclusive operator, can be NULL */
+ bool *inclusive, /* used for inclusive operator, can be NULL */
int which_button /* MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE */
)
{
@@ -575,10 +575,10 @@ retnomove:
curwin->w_set_curswant = FALSE; /* May still have been TRUE */
if (coladvance(col) == FAIL) { /* Mouse click beyond end of line */
if (inclusive != NULL)
- *inclusive = TRUE;
+ *inclusive = true;
mouse_past_eol = true;
} else if (inclusive != NULL)
- *inclusive = FALSE;
+ *inclusive = false;
count = IN_BUFFER;
if (curwin != old_curwin || curwin->w_cursor.lnum != old_cursor.lnum