diff options
author | Wayne Rowcliffe <war1025@gmail.com> | 2015-10-07 21:33:41 -0500 |
---|---|---|
committer | Wayne Rowcliffe <war1025@gmail.com> | 2015-11-11 21:19:52 -0600 |
commit | 6cfb81eaa7ad2ea033d34c71f64d2baa499e0466 (patch) | |
tree | 6078e487d23cece19de97d5bec6f01662f6d021e /src/nvim/buffer.c | |
parent | 70f6b0f33825f3ceac43bb00581caa57a5050009 (diff) | |
download | rneovim-6cfb81eaa7ad2ea033d34c71f64d2baa499e0466.tar.gz rneovim-6cfb81eaa7ad2ea033d34c71f64d2baa499e0466.tar.bz2 rneovim-6cfb81eaa7ad2ea033d34c71f64d2baa499e0466.zip |
Updates from review
Diffstat (limited to 'src/nvim/buffer.c')
-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; // } |