diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 1994-11-19 10:22:12 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 1994-11-19 10:22:12 +0000 |
| commit | 2c154e81244a304e7ec66ee2b2181e5e0325d8ff (patch) | |
| tree | 74d7d68276023c3899862a3a1c29bc73d8433328 | |
| parent | 5fa4b99ccf606aa76c8f2eb8978a4da4d0488d1f (diff) | |
Notes
| -rw-r--r-- | gnu/lib/libdialog/lineedit.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/gnu/lib/libdialog/lineedit.c b/gnu/lib/libdialog/lineedit.c index bb2c52a9da15..37f7ccefde48 100644 --- a/gnu/lib/libdialog/lineedit.c +++ b/gnu/lib/libdialog/lineedit.c @@ -193,12 +193,11 @@ int line_edit(WINDOW* dialog, int box_y, int box_x, int flen, int box_width, cht for (i = strlen(instr) - 1; i >= scroll + input_x && instr[i] == ' '; i--) instr[i] = '\0'; i++; - if ( i < MAX_LEN - && (flen < 0 || i < flen) - ) { + if (i < MAX_LEN && (flen < 0 || scroll+input_x < flen)) { + if (flen < 0 || i < flen) memmove(instr+scroll+input_x+1, instr+scroll+input_x, i-scroll+input_x); instr[scroll+input_x] = key; - if (input_x == box_width-1) { + if (input_x == box_width-1 && (flen < 0 || i < flen)) { scroll++; wmove(dialog, box_y, box_x); fix_len = flen >= 0 ? MIN(flen-scroll,box_width) : box_width; |
