0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.0826: too many #ifdefs

Problem:    Too many #ifdefs.
Solution:   Graduate FEAT_VIRTUALEDIT.  Adds about 10Kbyte to the code.
This commit is contained in:
Bram Moolenaar
2019-01-26 17:28:26 +01:00
parent 3e460fd8b7
commit 29ddebef40
35 changed files with 65 additions and 493 deletions

View File

@@ -21,27 +21,18 @@
/*
* Position comparisons
*/
#ifdef FEAT_VIRTUALEDIT
# define LT_POS(a, b) (((a).lnum != (b).lnum) \
#define LT_POS(a, b) (((a).lnum != (b).lnum) \
? (a).lnum < (b).lnum \
: (a).col != (b).col \
? (a).col < (b).col \
: (a).coladd < (b).coladd)
# define LT_POSP(a, b) (((a)->lnum != (b)->lnum) \
#define LT_POSP(a, b) (((a)->lnum != (b)->lnum) \
? (a)->lnum < (b)->lnum \
: (a)->col != (b)->col \
? (a)->col < (b)->col \
: (a)->coladd < (b)->coladd)
# define EQUAL_POS(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col) && ((a).coladd == (b).coladd))
# define CLEAR_POS(a) {(a)->lnum = 0; (a)->col = 0; (a)->coladd = 0;}
#else
# define LT_POS(a, b) (((a).lnum != (b).lnum) \
? ((a).lnum < (b).lnum) : ((a).col < (b).col))
# define LT_POSP(a, b) (((a)->lnum != (b)->lnum) \
? ((a)->lnum < (b)->lnum) : ((a)->col < (b)->col))
# define EQUAL_POS(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col))
# define CLEAR_POS(a) {(a)->lnum = 0; (a)->col = 0;}
#endif
#define EQUAL_POS(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col) && ((a).coladd == (b).coladd))
#define CLEAR_POS(a) {(a)->lnum = 0; (a)->col = 0; (a)->coladd = 0;}
#define LTOREQ_POS(a, b) (LT_POS(a, b) || EQUAL_POS(a, b))