[BusyBox] Re: cmdedit width setting

Larry Doolittle ldoolitt at recycle.lbl.gov
Thu Feb 1 18:25:40 UTC 2001


Vladimir -

> New verion not have this problem very out-date!
> ftp://ftp.simtreas.ru/pub/my/bb/new/

I tried this, it has other problems.
These comments refer to
-rw-r--r--   1 1000     root         8431 Feb  1 11:18 cmdedit.c.gz
$ md5sum cmdedit.c 
40fbfcf3401b5e467c22c91362869d73  cmdedit.c

I'm glad you now handle "^U", although it is not (yet?)
bash-compatible.  Bash deletes from the beginning of the
line to the cursor, your code deletes the whole line no
matter where the cursor is.

In input_backward() you generate output like "\033[-79C" to
move to the end of the line.  I guess that's a bug, I changed
it like this:

--- /home/ldoolitt/misc/cmdedit.c	Thu Feb  1 08:40:58 2001
+++ cmdedit.c	Thu Feb  1 10:07:02 2001
@@ -245,7 +245,7 @@
 
 			/* to end in current terminal line */
 			if(cmdedit_x<(cmdedit_termw-1)) {
-				printf("\033[%dC", cmdedit_x-(cmdedit_termw-1));
+				printf("\033[%dC", (cmdedit_termw-1)-cmdedit_x);
 				cmdedit_x=cmdedit_termw-1;
 				}
 			}

and now it edits wrapped lines nicely.  It's a little larger, maybe
500 bytes.  It is more character-efficient (which is nice when running
over a 9600 bps serial link!).

After Vladimir confirms the above patch, and at least one more person
reports success, I recommend updating the CVS tree.

        - Larry





More information about the busybox mailing list