|
|
@@ -282,7 +282,7 @@ static int getCursorPosition(int ifd, int ofd) { |
|
|
|
|
|
|
|
/* Try to get the number of columns in the current terminal, or assume 80 |
|
|
|
* if it fails. */ |
|
|
|
static int getColumns(int ifd, int ofd) { |
|
|
|
int linenoiseGetColumns(int ifd, int ofd) { |
|
|
|
struct winsize ws; |
|
|
|
|
|
|
|
if (ioctl(1, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0) { |
|
|
@@ -778,7 +778,7 @@ static int linenoiseEdit(int stdin_fd, int stdout_fd, char *buf, size_t buflen, |
|
|
|
l.plen = strlen(prompt); |
|
|
|
l.oldpos = l.pos = 0; |
|
|
|
l.len = 0; |
|
|
|
l.cols = getColumns(stdin_fd, stdout_fd); |
|
|
|
l.cols = linenoiseGetColumns(stdin_fd, stdout_fd); |
|
|
|
l.maxrows = 0; |
|
|
|
l.history_index = 0; |
|
|
|
|