forked from test34/can_wizard
Multiline: just remember last num of rows, not max.
orig commit 8087db3
This commit is contained in:
parent
3b97afa1d8
commit
f05da6c6ca
2 changed files with 5 additions and 6 deletions
|
@ -509,12 +509,11 @@ static void refreshMultiLine(struct linenoiseState *l, int flags) {
|
|||
int rpos = (plen+l->oldpos+l->cols)/l->cols; /* cursor relative row. */
|
||||
int rpos2; /* rpos after refresh. */
|
||||
int col; /* colum position, zero-based. */
|
||||
int old_rows = l->maxrows;
|
||||
int old_rows = l->oldrows;
|
||||
int j;
|
||||
struct abuf ab;
|
||||
|
||||
/* Update maxrows if needed. */
|
||||
if (rows > (int)l->maxrows) l->maxrows = rows;
|
||||
l->oldrows = rows;
|
||||
|
||||
/* First step: clear all the lines used before. To do so start by
|
||||
* going to the last row. */
|
||||
|
@ -562,7 +561,7 @@ static void refreshMultiLine(struct linenoiseState *l, int flags) {
|
|||
snprintf(seq,64,"\r");
|
||||
abAppend(&ab,seq,strlen(seq));
|
||||
rows++;
|
||||
if (rows > (int)l->maxrows) l->maxrows = rows;
|
||||
if (rows > (int)l->oldrows) l->oldrows = rows;
|
||||
}
|
||||
|
||||
/* Move cursor to right position. */
|
||||
|
@ -781,7 +780,7 @@ int linenoiseEditStart(struct linenoiseState *l, char *buf, size_t buflen, const
|
|||
l->oldpos = l->pos = 0;
|
||||
l->len = 0;
|
||||
l->cols = getColumns();
|
||||
l->maxrows = 0;
|
||||
l->oldrows = 0;
|
||||
l->history_index = 0;
|
||||
|
||||
/* Buffer starts empty. */
|
||||
|
|
|
@ -63,7 +63,7 @@ struct linenoiseState {
|
|||
size_t oldpos; /* Previous refresh cursor position. */
|
||||
size_t len; /* Current edited line length. */
|
||||
size_t cols; /* Number of columns in terminal. */
|
||||
size_t maxrows; /* Maximum num of rows used so far (multiline mode) */
|
||||
size_t oldrows; /* Rows used by last refrehsed line (multiline mode) */
|
||||
int history_index; /* The history index we are currently editing. */
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue