diff options
author | ache <ache@FreeBSD.org> | 1994-11-19 10:22:12 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1994-11-19 10:22:12 +0000 |
commit | 8d964f41a76dc3c9539cdbf4df267dfd09d4581a (patch) | |
tree | 74d7d68276023c3899862a3a1c29bc73d8433328 /gnu | |
parent | 1b44a4bb6d4a79423cae7760c42617d81675417b (diff) | |
download | FreeBSD-src-8d964f41a76dc3c9539cdbf4df267dfd09d4581a.zip FreeBSD-src-8d964f41a76dc3c9539cdbf4df267dfd09d4581a.tar.gz |
Automatically turn off insert mode when end of field reached
in line_edit().
Diffstat (limited to 'gnu')
-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 bb2c52a..37f7cce 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; |