busybox/libbb
Avi Halachmi 0fd5dbba8f lineedit: improve multiline PS1 - redraw using last PS1 line. Closes 10381
This patch only affects prompts with newlines.

We redraw the prompt [+ input] occasionally, e.g. during tab completion,
history browsing or search, etc, and we expect it to align with prior
redraws, such that the visible effect is that only the input changes.

With multi-line PS1, redraw always printed the prompt some lines below
the old one, which resulted in terminal scroll during every redraw.

Now we only redraw the last PS1 line, so vertical alignment is easier to
manage (we already calculated it using only the last line, but re-drew
all lines - that was the culprit), which fixes those extra scrolls.

Notes:
- We now use the full prompt for the initial draw, after clear-screen (^L),
  and after tab-completion choices are displayed. Everything else now
  redraws using the last/sole prompt line.

- During terminal resize we now only redraw the last[/sole] prompt line,
  which is arguably better because it's hard to do right (and we never did).

- Good side effect for reverse-i-search: its prompt now replaces only the
  last line of the original prompt - like other shells do.

function                                             old     new   delta
put_prompt_custom                                      -      66     +66
draw_custom                                            -      66     +66
parse_and_put_prompt                                 766     806     +40
read_line_input                                     3867    3884     +17
input_tab                                           1069    1076      +7
cmdedit_setwidth                                      61      63      +2
redraw                                                59      47     -12
put_prompt                                            46       -     -46
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 4/1 up/down: 198/-58)           Total: 140 bytes

Signed-off-by: Avi Halachmi <avihpit@yahoo.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-12 18:26:13 +02:00
..
appletlib.c whitespace and comment format fixes, no code changes 2017-10-05 15:19:25 +02:00
ask_confirmation.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
auto_string.c
bb_askpass.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
bb_bswap_64.c
bb_cat.c fix errors found with make_single_applets.sh 2017-04-12 15:48:19 +02:00
bb_do_delay.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
bb_getgroups.c libbb: new function bb_getgroups() - allocating wrapper around getgroups() 2017-07-04 18:56:45 +02:00
bb_pwd.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
bb_qsort.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
bb_strtod.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
bb_strtonum.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
bbunit.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
capability.c run-init: new applet 2017-08-21 19:30:01 +02:00
change_identity.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
chomp.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
common_bufsiz.c config: deindent all help texts 2017-07-21 09:50:55 +02:00
compare_string_array.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
concat_path_file.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
concat_subpath_file.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
Config.src config: trim/improve item names and help texts. 2017-07-27 02:59:13 +02:00
copy_file.c libarchive: do not extract unsafe symlinks unless $EXTRACT_UNSAFE_SYMLINKS=1 2017-08-10 11:52:42 +02:00
copyfd.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
correct_password.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
crc32.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
default_error_retval.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
device_open.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
die_if_bad_username.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
dump.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
endofname.c
executable.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
fclose_nonstdin.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
fflush_stdout_and_exit.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
fgets_str.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
find_mount_point.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
find_pid_by_name.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
find_root_device.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
full_write.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
get_console.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
get_cpu_count.c
get_last_path_component.c
get_line_from_file.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
get_shell_name.c
get_volsize.c
getopt32.c hush: GETOPT_RESET() _after_ getopts too. 2017-08-29 14:32:17 +02:00
getopt_allopts.c getopt32: factor out code to treat all args as options 2017-08-04 16:33:23 +02:00
getpty.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
hash_md5_sha.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
hash_md5prime.c tls: add 2nd cipher_id, TLS_RSA_WITH_AES_128_CBC_SHA, so far it doesn't work 2017-01-24 16:00:54 +01:00
herror_msg.c
human_readable.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
in_ether.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
inet_cksum.c
inet_common.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
inode_hash.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
isdirectory.c do not include <sys/stat.h> just before "libbb.h", it's there already 2017-10-05 14:41:36 +02:00
isqrt.c libbb: move isqrt from factor, use it in diff too 2017-04-11 07:34:56 +02:00
Kbuild.src getopt32: factor out code to treat all args as options 2017-08-04 16:33:23 +02:00
kernel_version.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
last_char_is.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
lineedit_ptr_hack.c
lineedit.c lineedit: improve multiline PS1 - redraw using last PS1 line. Closes 10381 2017-10-12 18:26:13 +02:00
llist.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
logenv.c
login.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
loop.c mount: create loop devices with LO_FLAGS_AUTOCLEAR flag 2017-03-16 16:55:47 +01:00
make_directory.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
makedev.c
match_fstype.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
messages.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
missing_syscalls.c
mode_string.c do not include <sys/stat.h> just before "libbb.h", it's there already 2017-10-05 14:41:36 +02:00
mtab.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
nuke_str.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
obscure.c
parse_config.c getopt32: remove opt_complementary 2017-08-08 21:55:02 +02:00
parse_mode.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
percent_decode.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
perror_msg.c
perror_nomsg_and_die.c
perror_nomsg.c
pidfile.c
platform.c
print_flags.c whitespace and comment format fixes, no code changes 2017-10-05 15:33:28 +02:00
print_numbered_lines.c cat: fix "cat -An" ignoring -n; make numbering go througn all files 2017-07-14 10:47:18 +02:00
printable_string.c
printable.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
process_escape_sequence.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
procps.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
progress.c do not use `a' quoting style in comments 2017-08-02 14:26:33 +02:00
ptr_to_globals.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
pw_encrypt_des.c do not use `a' quoting style in comments 2017-08-02 14:26:33 +02:00
pw_encrypt_md5.c
pw_encrypt_sha.c tls: add 2nd cipher_id, TLS_RSA_WITH_AES_128_CBC_SHA, so far it doesn't work 2017-01-24 16:00:54 +01:00
pw_encrypt.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
read_key.c
read_printf.c
read.c
README
recursive_action.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
remove_file.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
replace.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
rtc.c
run_shell.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
safe_gethostname.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
safe_poll.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
safe_strncpy.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
safe_write.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
securetty.c libbb: fix "error: redefinition of 'is_tty_secure'" 2017-04-13 17:55:05 +02:00
selinux_common.c
setup_environment.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
signals.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
simplify_path.c
single_argv.c
skip_whitespace.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
speed_table.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
str_tolower.c
strrstr.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
sysconf.c
time.c
trim.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
u_signal_names.c regularize format of source file headers, no code changes 2017-09-18 16:28:43 +02:00
ubi.c ubi tools: ubiupdatevol supports "-" input and actually respects -s SIZE 2017-08-07 16:00:25 +02:00
udp_io.c
unicode.c
update_passwd.c fix breakage found by mass one-applet builds 2016-12-23 02:42:26 +01:00
utmp.c
uuencode.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
verror_msg.c
vfork_daemon_rexec.c getopt32: remove opt_complementary 2017-08-08 21:55:02 +02:00
warn_ignoring_args.c
wfopen_input.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
wfopen.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
write.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
xatonum_template.c
xatonum.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
xconnect.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
xfunc_die.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
xfuncs_printf.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
xfuncs.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
xgetcwd.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
xgethostbyname.c
xreadlink.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
xrealloc_vector.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00
xregcomp.c whitespace and comment format fixes, no code changes 2017-10-05 14:40:24 +02:00

Please see the LICENSE file for copyright information (GPLv2)

libbb is BusyBox's utility library.  All of this stuff used to be stuffed into
a single file named utility.c.  When I split utility.c to create libbb, some of
the very oldest stuff ended up without their original copyright and licensing
information (which is now lost in the mists of time).  If you see something
that you wrote that is mis-attributed, do let me know so we can fix that up.

	Erik Andersen
	<andersen@codepoet.org>