diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/buffer.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index d6ab0ef671..56469c8507 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -2803,6 +2803,16 @@ void free_titles(void) # endif +/** + * Enumeration specifying the valid numeric bases that can + * be used when printing numbers in the status line. + **/ +typedef enum { + kNumBaseDecimal = 10, + kNumBaseOctal = 8, + kNumBaseHexadecimal = 16 +} NumberBase; + /* * Build a string from the status line items in "fmt". @@ -2818,8 +2828,7 @@ void free_titles(void) * If maxwidth is not zero, the string will be filled at any middle marker * or truncated if too long, fillchar is used for all whitespace. */ -int -build_stl_str_hl( +int build_stl_str_hl( win_T *wp, char_u *out, /* buffer to write into != NameBuff */ size_t outlen, /* length of out[] */ @@ -2850,12 +2859,6 @@ build_stl_str_hl( } type; } item[STL_MAX_ITEM]; - typedef enum { - DECIMAL = 10, - OCTAL = 8, - HEXIDECIMAL = 16 - } number_base; - #define TMPLEN 70 char_u tmp[TMPLEN]; char_u *usefmt = fmt; @@ -3202,7 +3205,7 @@ build_stl_str_hl( char_u opt = *fmt_p++; /* OK - now for the real work */ - number_base base = DECIMAL; + NumberBase base = kNumBaseDecimal; bool itemisflag = false; bool fillable = true; long num = -1; @@ -3359,7 +3362,7 @@ build_stl_str_hl( break; case STL_OFFSET_X: - base = HEXIDECIMAL; + base = kNumBaseHexadecimal; case STL_OFFSET: { long l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL); @@ -3369,7 +3372,7 @@ build_stl_str_hl( break; } case STL_BYTEVAL_X: - base = HEXIDECIMAL; + base = kNumBaseHexadecimal; case STL_BYTEVAL: num = byteval; if (num == NL) @@ -3573,7 +3576,9 @@ build_stl_str_hl( // Note: The `*` means we take the width as one of the arguments *t++ = '*'; - *t++ = (char_u) (base == HEXIDECIMAL ? 'X' : (base == OCTAL ? 'o' : 'd')); + *t++ = (char_u) (base == kNumBaseHexadecimal ? 'X' + : (base == kNumBaseOctal ? 'o' + : 'd')); *t = 0; // } |