Updates from review

This commit is contained in:
Wayne Rowcliffe
2015-10-07 21:33:41 -05:00
parent 70f6b0f338
commit 6cfb81eaa7

View File

@@ -2803,6 +2803,16 @@ void free_titles(void)
# endif # 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". * 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 * 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. * or truncated if too long, fillchar is used for all whitespace.
*/ */
int int build_stl_str_hl(
build_stl_str_hl(
win_T *wp, win_T *wp,
char_u *out, /* buffer to write into != NameBuff */ char_u *out, /* buffer to write into != NameBuff */
size_t outlen, /* length of out[] */ size_t outlen, /* length of out[] */
@@ -2850,12 +2859,6 @@ build_stl_str_hl(
} type; } type;
} item[STL_MAX_ITEM]; } item[STL_MAX_ITEM];
typedef enum {
DECIMAL = 10,
OCTAL = 8,
HEXIDECIMAL = 16
} number_base;
#define TMPLEN 70 #define TMPLEN 70
char_u tmp[TMPLEN]; char_u tmp[TMPLEN];
char_u *usefmt = fmt; char_u *usefmt = fmt;
@@ -3202,7 +3205,7 @@ build_stl_str_hl(
char_u opt = *fmt_p++; char_u opt = *fmt_p++;
/* OK - now for the real work */ /* OK - now for the real work */
number_base base = DECIMAL; NumberBase base = kNumBaseDecimal;
bool itemisflag = false; bool itemisflag = false;
bool fillable = true; bool fillable = true;
long num = -1; long num = -1;
@@ -3359,7 +3362,7 @@ build_stl_str_hl(
break; break;
case STL_OFFSET_X: case STL_OFFSET_X:
base = HEXIDECIMAL; base = kNumBaseHexadecimal;
case STL_OFFSET: case STL_OFFSET:
{ {
long l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL); long l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL);
@@ -3369,7 +3372,7 @@ build_stl_str_hl(
break; break;
} }
case STL_BYTEVAL_X: case STL_BYTEVAL_X:
base = HEXIDECIMAL; base = kNumBaseHexadecimal;
case STL_BYTEVAL: case STL_BYTEVAL:
num = byteval; num = byteval;
if (num == NL) if (num == NL)
@@ -3573,7 +3576,9 @@ build_stl_str_hl(
// Note: The `*` means we take the width as one of the arguments // Note: The `*` means we take the width as one of the arguments
*t++ = '*'; *t++ = '*';
*t++ = (char_u) (base == HEXIDECIMAL ? 'X' : (base == OCTAL ? 'o' : 'd')); *t++ = (char_u) (base == kNumBaseHexadecimal ? 'X'
: (base == kNumBaseOctal ? 'o'
: 'd'));
*t = 0; *t = 0;
// } // }