mirror of
https://github.com/rspamd/rspamd.git
synced 2024-09-09 14:15:58 +02:00
[Minor] Export function to get terminal width from linenoise
This commit is contained in:
parent
da89d96176
commit
9e9785cf2d
@ -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;
|
||||
|
||||
|
@ -66,6 +66,9 @@ void linenoiseClearScreen(void);
|
||||
void linenoiseSetMultiLine(int ml);
|
||||
void linenoisePrintKeyCodes(void);
|
||||
|
||||
/* Rspamd specific */
|
||||
int linenoiseGetColumns(int ifd, int ofd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user