return;
ocursor = cursor;
/* open hole and then fill it */
- memmove(command_ps + cursor + j, command_ps + cursor, len - cursor + 1);
+ memmove(command_ps + cursor + j, command_ps + cursor, command_len - cursor + 1);
strncpy(command_ps + cursor, delbuf, j);
- len += j;
+ command_len += j;
input_end(); /* rewrite new line */
input_backward(cursor - ocursor - j + 1); /* at end of new text */
}
static int path_parse(char ***p, int flags)
{
int npth;
- const char *tmp;
const char *pth;
+ char *tmp;
char **res;
/* if not setenv PATH variable, to search cur dir "." */
if (!pth || !pth[0] || LONE_CHAR(pth, ':'))
return 1;
- tmp = pth;
+ tmp = (char*)pth;
npth = 1; /* path component count */
while (1) {
tmp = strchr(tmp, ':');
}
res = xmalloc(npth * sizeof(char*));
- res[0] = xstrdup(pth);
- tmp = pth;
+ res[0] = tmp = xstrdup(pth);
npth = 1;
while (1) {
tmp = strchr(tmp, ':');
}
len_found = strlen(tmp);
/* have space to placed match? */
- if ((len_found - strlen(matchBuf) + len) < BUFSIZ) {
+ if ((len_found - strlen(matchBuf) + command_len) < BUFSIZ) {
/* before word for match */
command_ps[cursor - recalc_pos] = 0;
/* save tail line */
/* new pos */
recalc_pos = cursor + len_found;
/* new len */
- len = strlen(command_ps);
+ command_len = strlen(command_ps);
/* write out the matched command */
- redraw(cmdedit_y, len - recalc_pos);
+ redraw(cmdedit_y, command_len - recalc_pos);
}
free(tmp);
} else {
/* Go to the next line */
goto_new_line();
showfiles();
- redraw(0, len - sav_cursor);
+ redraw(0, command_len - sav_cursor);
}
}
}
static void
vi_Word_motion(char *command, int eat)
{
- while (cursor < len && !isspace(command[cursor]))
+ while (cursor < command_len && !isspace(command[cursor]))
input_forward();
- if (eat) while (cursor < len && isspace(command[cursor]))
+ if (eat) while (cursor < command_len && isspace(command[cursor]))
input_forward();
}
vi_word_motion(char *command, int eat)
{
if (isalnum(command[cursor]) || command[cursor] == '_') {
- while (cursor < len
+ while (cursor < command_len
&& (isalnum(command[cursor+1]) || command[cursor+1] == '_'))
input_forward();
} else if (ispunct(command[cursor])) {
- while (cursor < len && ispunct(command[cursor+1]))
+ while (cursor < command_len && ispunct(command[cursor+1]))
input_forward();
}
- if (cursor < len)
+ if (cursor < command_len)
input_forward();
- if (eat && cursor < len && isspace(command[cursor]))
- while (cursor < len && isspace(command[cursor]))
+ if (eat && cursor < command_len && isspace(command[cursor]))
+ while (cursor < command_len && isspace(command[cursor]))
input_forward();
}
vi_End_motion(char *command)
{
input_forward();
- while (cursor < len && isspace(command[cursor]))
+ while (cursor < command_len && isspace(command[cursor]))
input_forward();
- while (cursor < len-1 && !isspace(command[cursor+1]))
+ while (cursor < command_len-1 && !isspace(command[cursor+1]))
input_forward();
}
static void
vi_end_motion(char *command)
{
- if (cursor >= len-1)
+ if (cursor >= command_len-1)
return;
input_forward();
- while (cursor < len-1 && isspace(command[cursor]))
+ while (cursor < command_len-1 && isspace(command[cursor]))
input_forward();
- if (cursor >= len-1)
+ if (cursor >= command_len-1)
return;
if (isalnum(command[cursor]) || command[cursor] == '_') {
- while (cursor < len-1
+ while (cursor < command_len-1
&& (isalnum(command[cursor+1]) || command[cursor+1] == '_')
) {
input_forward();
}
} else if (ispunct(command[cursor])) {
- while (cursor < len-1 && ispunct(command[cursor+1]))
+ while (cursor < command_len-1 && ispunct(command[cursor+1]))
input_forward();
}
}