mirror of https://github.com/mirror/busybox.git
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.1_00_stable_10817
parent
361ee514c6
commit
6faae7deb4
11
cmdedit.c
11
cmdedit.c
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define TEST
|
//#define TEST
|
||||||
|
|
||||||
|
|
||||||
#ifndef TEST
|
#ifndef TEST
|
||||||
|
@ -555,6 +555,9 @@ static void clean_up_and_die(int sig)
|
||||||
static void cmdedit_setwidth(int w, int redraw_flg)
|
static void cmdedit_setwidth(int w, int redraw_flg)
|
||||||
{
|
{
|
||||||
cmdedit_termw = cmdedit_prmt_len + 2;
|
cmdedit_termw = cmdedit_prmt_len + 2;
|
||||||
|
if (w <= cmdedit_termw) {
|
||||||
|
cmdedit_termw = cmdedit_termw % w;
|
||||||
|
}
|
||||||
if (w > cmdedit_termw) {
|
if (w > cmdedit_termw) {
|
||||||
|
|
||||||
cmdedit_termw = w;
|
cmdedit_termw = w;
|
||||||
|
@ -567,9 +570,6 @@ static void cmdedit_setwidth(int w, int redraw_flg)
|
||||||
redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), len - cursor);
|
redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), len - cursor);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
error_msg("\n*** Error: minimum screen width is %d",
|
|
||||||
cmdedit_termw);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1234,9 +1234,10 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
|
||||||
setTermSettings(inputFd, (void *) &new_settings);
|
setTermSettings(inputFd, (void *) &new_settings);
|
||||||
handlers_sets |= SET_RESET_TERM;
|
handlers_sets |= SET_RESET_TERM;
|
||||||
|
|
||||||
cmdedit_init();
|
|
||||||
/* Print out the command prompt */
|
/* Print out the command prompt */
|
||||||
parse_prompt(prompt);
|
parse_prompt(prompt);
|
||||||
|
/* Now initialize things */
|
||||||
|
cmdedit_init();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
|
|
3
lash.c
3
lash.c
|
@ -854,10 +854,9 @@ static int get_command(FILE * source, char *command)
|
||||||
** atexit() handlers and other unwanted stuff to our
|
** atexit() handlers and other unwanted stuff to our
|
||||||
** child processes (rob@sysgo.de)
|
** child processes (rob@sysgo.de)
|
||||||
*/
|
*/
|
||||||
cmdedit_init();
|
|
||||||
cmdedit_read_input(prompt_str, command);
|
cmdedit_read_input(prompt_str, command);
|
||||||
free(prompt_str);
|
|
||||||
cmdedit_terminate();
|
cmdedit_terminate();
|
||||||
|
free(prompt_str);
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
fputs(prompt_str, stdout);
|
fputs(prompt_str, stdout);
|
||||||
|
|
3
sh.c
3
sh.c
|
@ -854,10 +854,9 @@ static int get_command(FILE * source, char *command)
|
||||||
** atexit() handlers and other unwanted stuff to our
|
** atexit() handlers and other unwanted stuff to our
|
||||||
** child processes (rob@sysgo.de)
|
** child processes (rob@sysgo.de)
|
||||||
*/
|
*/
|
||||||
cmdedit_init();
|
|
||||||
cmdedit_read_input(prompt_str, command);
|
cmdedit_read_input(prompt_str, command);
|
||||||
free(prompt_str);
|
|
||||||
cmdedit_terminate();
|
cmdedit_terminate();
|
||||||
|
free(prompt_str);
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
fputs(prompt_str, stdout);
|
fputs(prompt_str, stdout);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define TEST
|
//#define TEST
|
||||||
|
|
||||||
|
|
||||||
#ifndef TEST
|
#ifndef TEST
|
||||||
|
@ -555,6 +555,9 @@ static void clean_up_and_die(int sig)
|
||||||
static void cmdedit_setwidth(int w, int redraw_flg)
|
static void cmdedit_setwidth(int w, int redraw_flg)
|
||||||
{
|
{
|
||||||
cmdedit_termw = cmdedit_prmt_len + 2;
|
cmdedit_termw = cmdedit_prmt_len + 2;
|
||||||
|
if (w <= cmdedit_termw) {
|
||||||
|
cmdedit_termw = cmdedit_termw % w;
|
||||||
|
}
|
||||||
if (w > cmdedit_termw) {
|
if (w > cmdedit_termw) {
|
||||||
|
|
||||||
cmdedit_termw = w;
|
cmdedit_termw = w;
|
||||||
|
@ -567,9 +570,6 @@ static void cmdedit_setwidth(int w, int redraw_flg)
|
||||||
redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), len - cursor);
|
redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), len - cursor);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
error_msg("\n*** Error: minimum screen width is %d",
|
|
||||||
cmdedit_termw);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1234,9 +1234,10 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
|
||||||
setTermSettings(inputFd, (void *) &new_settings);
|
setTermSettings(inputFd, (void *) &new_settings);
|
||||||
handlers_sets |= SET_RESET_TERM;
|
handlers_sets |= SET_RESET_TERM;
|
||||||
|
|
||||||
cmdedit_init();
|
|
||||||
/* Print out the command prompt */
|
/* Print out the command prompt */
|
||||||
parse_prompt(prompt);
|
parse_prompt(prompt);
|
||||||
|
/* Now initialize things */
|
||||||
|
cmdedit_init();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
|
|
|
@ -854,10 +854,9 @@ static int get_command(FILE * source, char *command)
|
||||||
** atexit() handlers and other unwanted stuff to our
|
** atexit() handlers and other unwanted stuff to our
|
||||||
** child processes (rob@sysgo.de)
|
** child processes (rob@sysgo.de)
|
||||||
*/
|
*/
|
||||||
cmdedit_init();
|
|
||||||
cmdedit_read_input(prompt_str, command);
|
cmdedit_read_input(prompt_str, command);
|
||||||
free(prompt_str);
|
|
||||||
cmdedit_terminate();
|
cmdedit_terminate();
|
||||||
|
free(prompt_str);
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
fputs(prompt_str, stdout);
|
fputs(prompt_str, stdout);
|
||||||
|
|
Loading…
Reference in New Issue