X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=shell%2Fcmdedit.c;h=c4cb9d9c45291adebd51b06c4bfd9a7a9a1dc144;hb=e4baaa2d2795c14775b26213d143e9f9f65e4d54;hp=c67283f4adae50c35c0e0232f3832e6bbc042d8f;hpb=3f11b1bf634536cb01d9913d1a3d10da5bf24541;p=oweals%2Fbusybox.git diff --git a/shell/cmdedit.c b/shell/cmdedit.c index c67283f4a..c4cb9d9c4 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c @@ -310,7 +310,7 @@ static void parse_prompt(const char *prmt_ptr) static void parse_prompt(const char *prmt_ptr) { int prmt_len = 0; - int sub_len = 0; + size_t cur_prmt_len = 0; char flg_not_length = '['; char *prmt_mem_ptr = xcalloc(1, 1); char *pwd_buf = xgetcwd(0); @@ -415,15 +415,15 @@ static void parse_prompt(const char *prmt_ptr) } if(pbuf == buf) *pbuf = c; - prmt_len += strlen(pbuf); + cur_prmt_len = strlen(pbuf); + prmt_len += cur_prmt_len; + if (flg_not_length != ']') + cmdedit_prmt_len += cur_prmt_len; prmt_mem_ptr = strcat(xrealloc(prmt_mem_ptr, prmt_len+1), pbuf); - if (flg_not_length == ']') - sub_len++; } if(pwd_buf!=(char *)bb_msg_unknown) free(pwd_buf); cmdedit_prompt = prmt_mem_ptr; - cmdedit_prmt_len = prmt_len - sub_len; put_prompt(); } #endif @@ -1263,7 +1263,7 @@ void setvimode ( int viflag ) vi_mode = viflag; } -void +static void vi_Word_motion(char *command, int eat) { while (cursor < len && !isspace(command[cursor])) @@ -1272,7 +1272,7 @@ vi_Word_motion(char *command, int eat) input_forward(); } -void +static void vi_word_motion(char *command, int eat) { if (isalnum(command[cursor]) || command[cursor] == '_') { @@ -1294,7 +1294,7 @@ vi_word_motion(char *command, int eat) input_forward(); } -void +static void vi_End_motion(char *command) { input_forward(); @@ -1304,7 +1304,7 @@ vi_End_motion(char *command) input_forward(); } -void +static void vi_end_motion(char *command) { if (cursor >= len-1) @@ -1326,7 +1326,7 @@ vi_end_motion(char *command) } } -void +static void vi_Back_motion(char *command) { while (cursor > 0 && isspace(command[cursor-1])) @@ -1335,7 +1335,7 @@ vi_Back_motion(char *command) input_backward(1); } -void +static void vi_back_motion(char *command) { if (cursor <= 0)