Add window_columns() function to determine number of columns used for splitting window output

Replaces two open-coded versions of the same pattern.
This commit is contained in:
Kevin Easton
2018-05-10 17:02:16 +10:00
parent eb14b44413
commit 14a501bd04
4 changed files with 16 additions and 9 deletions

View File

@@ -6308,12 +6308,9 @@ BUILT_IN_FUNCTION(function_numlines, input)
char *s = NULL;
if (input && *input)
{
int cols;
int cols = window_columns(current_window);
s = LOCAL_COPY(input);
if (current_window->screen)
cols = current_window->screen->co;
else
cols = current_window->columns;
for (lines = split_up_line(s, cols + 1); *lines; lines++)
count++;
}