[Bug 10376] New: (patch inside) lineedit: improve long prompt first redraw, clear screen, ctrl-c cursor

bugzilla at busybox.net bugzilla at busybox.net
Fri Oct 6 17:15:02 UTC 2017


https://bugs.busybox.net/show_bug.cgi?id=10376

            Bug ID: 10376
           Summary: (patch inside) lineedit: improve long prompt first
                    redraw, clear screen, ctrl-c cursor
           Product: Busybox
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: avihpit at yahoo.com
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

Created attachment 7256
  --> https://bugs.busybox.net/attachment.cgi?id=7256&action=edit
lineedit: improve long prompt first redraw, clear screen, ctrl-c cursor

These are actually three 1-line patches for independent subjects. Feel free to
ask me to split it to several patches or file a new bugs for each.

>From the commit message:
------------------------
- Fix vertical alignment of first redraw(..) with long prompt, caused by
  possibly incorrect initial cursor calculation which assumed width is 80.
  Now we try to read the terminal width a bit earlier.

- Clear-screen (^L) now actually clears the screen after the cursor is
  reset, because \n in multiline PS1 are non destructive when printed.

- Ctrl-c now moves the cursor to the end of input:
  - Doesn't clutter it with "^C", e.g. it's possible to do selections.
  - Doens't obscure it with the next prompt if it spans multiple lines and
    the cursor is at the top (e.g. ctrl-c while in history search).
-----------------------

Other than comments you may have, I have one question of my own:

I'm not entirely confident about the change which reads the terminal width a
bit earlier (literally 5 lines of code up).

It's easy to get identical fix without reading it earlier (e.g. by
re-calculating cmdedit_x and cmdedit_y right after reading it the first time
and before we enter the main loop), but the cleaner fix, if there are no
negative side effects, is to read it earlier IMO.

I did look at other applets and they do read the width very early, and lineedit
too called it even before it becomes interactive and before terminal signals
are handled, but it was still after the prompt is already printed and the
cursor was calculated with width of 80.

So is it OK to read it where my patch puts it?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list