summaryrefslogtreecommitdiff
path: root/shell/cmdedit.c
diff options
context:
space:
mode:
authorEric Andersen2001-02-16 20:09:17 +0000
committerEric Andersen2001-02-16 20:09:17 +0000
commit6faae7deb4b88dccffb7dbbf267315cb7bbc0af9 (patch)
tree550531e0e4027c69a6cca27fde31574c75e26104 /shell/cmdedit.c
parent361ee514c636b371a50554ab73a3bfd54a49804d (diff)
downloadbusybox-6faae7deb4b88dccffb7dbbf267315cb7bbc0af9.zip
busybox-6faae7deb4b88dccffb7dbbf267315cb7bbc0af9.tar.gz
Commit Vladimir's latest cmdedit. I modified it slightly to ensure
parse_prompt() would be called before cmdedit_init(), since cmdedit_init() calls cmdedit_setwidth() which uses cmdedit_prmt_len, which is set by parse_prompt(). Also, added a mod, so very narrow terminals should now wrap properly... This is working very nicely for me -- Vladimir has done some very good work.
Diffstat (limited to 'shell/cmdedit.c')
-rw-r--r--shell/cmdedit.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 6a53c12..6fd80fd 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -30,7 +30,7 @@
*/
-#define TEST
+//#define TEST
#ifndef TEST
@@ -555,6 +555,9 @@ static void clean_up_and_die(int sig)
static void cmdedit_setwidth(int w, int redraw_flg)
{
cmdedit_termw = cmdedit_prmt_len + 2;
+ if (w <= cmdedit_termw) {
+ cmdedit_termw = cmdedit_termw % w;
+ }
if (w > cmdedit_termw) {
cmdedit_termw = w;
@@ -567,10 +570,7 @@ static void cmdedit_setwidth(int w, int redraw_flg)
redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), len - cursor);
fflush(stdout);
}
- } else {
- error_msg("\n*** Error: minimum screen width is %d",
- cmdedit_termw);
- }
+ }
}
extern void cmdedit_init(void)
@@ -1234,9 +1234,10 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
setTermSettings(inputFd, (void *) &new_settings);
handlers_sets |= SET_RESET_TERM;
- cmdedit_init();
/* Print out the command prompt */
parse_prompt(prompt);
+ /* Now initialize things */
+ cmdedit_init();
while (1) {