tweaks: rename a variable, to clarify it refers to columns, not to bytes
parent
6f12992cea
commit
a37cd9f0ef
|
@ -787,8 +787,8 @@ void blank_edit(void);
|
||||||
void blank_statusbar(void);
|
void blank_statusbar(void);
|
||||||
void blank_bottombars(void);
|
void blank_bottombars(void);
|
||||||
void check_statusblank(void);
|
void check_statusblank(void);
|
||||||
char *display_string(const char *buf, size_t start_col, size_t len, bool
|
char *display_string(const char *buf, size_t start_col, size_t span,
|
||||||
dollars);
|
bool dollars);
|
||||||
void titlebar(const char *path);
|
void titlebar(const char *path);
|
||||||
extern void set_modified(void);
|
extern void set_modified(void);
|
||||||
void statusbar(const char *msg);
|
void statusbar(const char *msg);
|
||||||
|
|
18
src/winio.c
18
src/winio.c
|
@ -1719,13 +1719,13 @@ void check_statusblank(void)
|
||||||
|
|
||||||
/* Convert buf into a string that can be displayed on screen. The
|
/* Convert buf into a string that can be displayed on screen. The
|
||||||
* caller wants to display buf starting with column start_col, and
|
* caller wants to display buf starting with column start_col, and
|
||||||
* extending for at most len columns. start_col is zero-based. len is
|
* extending for at most span columns. start_col is zero-based. span
|
||||||
* one-based, so len == 0 means you get "" returned. The returned
|
* is one-based, so span == 0 means you get "" returned. The returned
|
||||||
* string is dynamically allocated, and should be freed. If dollars is
|
* string is dynamically allocated, and should be freed. If dollars is
|
||||||
* TRUE, the caller might put "$" at the beginning or end of the line if
|
* TRUE, the caller might put "$" at the beginning or end of the line if
|
||||||
* it's too long. */
|
* it's too long. */
|
||||||
char *display_string(const char *buf, size_t start_col, size_t len, bool
|
char *display_string(const char *buf, size_t start_col, size_t span,
|
||||||
dollars)
|
bool dollars)
|
||||||
{
|
{
|
||||||
size_t start_index;
|
size_t start_index;
|
||||||
/* Index in buf of the first character shown. */
|
/* Index in buf of the first character shown. */
|
||||||
|
@ -1738,10 +1738,10 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||||
|
|
||||||
/* If dollars is TRUE, make room for the "$" at the end of the
|
/* If dollars is TRUE, make room for the "$" at the end of the
|
||||||
* line. */
|
* line. */
|
||||||
if (dollars && len > 0 && strlenpt(buf) > start_col + len)
|
if (dollars && span > 0 && strlenpt(buf) > start_col + span)
|
||||||
len--;
|
span--;
|
||||||
|
|
||||||
if (len == 0)
|
if (span == 0)
|
||||||
return mallocstrcpy(NULL, "");
|
return mallocstrcpy(NULL, "");
|
||||||
|
|
||||||
start_index = actual_x(buf, start_col);
|
start_index = actual_x(buf, start_col);
|
||||||
|
@ -1859,8 +1859,8 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||||
/* Null-terminate converted. */
|
/* Null-terminate converted. */
|
||||||
converted[index] = '\0';
|
converted[index] = '\0';
|
||||||
|
|
||||||
/* Make sure converted takes up no more than len columns. */
|
/* Make sure converted takes up no more than span columns. */
|
||||||
index = actual_x(converted, len);
|
index = actual_x(converted, span);
|
||||||
null_at(&converted, index);
|
null_at(&converted, index);
|
||||||
|
|
||||||
return converted;
|
return converted;
|
||||||
|
|
Loading…
Reference in New Issue