From c15f40c3e7bfeae1b616c53a574308c2df707b3d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 15 May 2009 03:27:53 +0200 Subject: lineedit: use read_key to recognize ESC sequence. This fixes several vi mode bugs and prepares for further fixes. function old new delta read_line_input 3287 5511 +2224 remember_in_history - 499 +499 lineedit_read_key - 70 +70 read_key 321 332 +11 input_tab 2823 - -2823 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 2/0 up/down: 2804/-2823) Total: -19 bytes Signed-off-by: Denys Vlasenko --- include/libbb.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/libbb.h b/include/libbb.h index 3a94a0070..128aa9207 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1198,23 +1198,23 @@ unsigned long long bb_makedev(unsigned int major, unsigned int minor) FAST_FUNC; #if ENABLE_FEATURE_EDITING /* It's NOT just ENABLEd or disabled. It's a number: */ -#ifdef CONFIG_FEATURE_EDITING_HISTORY -# define MAX_HISTORY (CONFIG_FEATURE_EDITING_HISTORY + 0) -#else -# define MAX_HISTORY 0 -#endif +# ifdef CONFIG_FEATURE_EDITING_HISTORY +# define MAX_HISTORY (CONFIG_FEATURE_EDITING_HISTORY + 0) +# else +# define MAX_HISTORY 0 +# endif typedef struct line_input_t { int flags; const char *path_lookup; -#if MAX_HISTORY +# if MAX_HISTORY int cnt_history; int cur_history; -#if ENABLE_FEATURE_EDITING_SAVEHISTORY +# if ENABLE_FEATURE_EDITING_SAVEHISTORY unsigned cnt_history_in_file; const char *hist_file; -#endif +# endif char *history[MAX_HISTORY + 1]; -#endif +# endif } line_input_t; enum { DO_HISTORY = 1 * (MAX_HISTORY > 0), @@ -1241,12 +1241,12 @@ int read_line_input(const char* prompt, char* command, int maxsize) FAST_FUNC; #ifndef COMM_LEN -#ifdef TASK_COMM_LEN +# ifdef TASK_COMM_LEN enum { COMM_LEN = TASK_COMM_LEN }; -#else +# else /* synchronize with sizeof(task_struct.comm) in /usr/include/linux/sched.h */ enum { COMM_LEN = 16 }; -#endif +# endif #endif typedef struct procps_status_t { DIR *dir; -- cgit v1.2.3