Fix ctrl+y

This commit is contained in:
savalet
2025-05-23 17:15:01 +02:00
parent a445328f0d
commit a32fa30729
3 changed files with 5 additions and 8 deletions

View File

@@ -19,7 +19,7 @@ const expr_op_precedence_t *op_precedence(char *op)
for (size_t i = 0; i < OPERATOR_PRECEDENCE_COUNT; i++)
if (!strcmp(op, OPERATOR_PRECEDENCE[i].name))
return OPERATOR_PRECEDENCE + i;
return NULL;
return nullptr;
}
static

View File

@@ -36,8 +36,8 @@ bool handle_key_ctrl_y(readline_helper_t *rh, exec_ctx_t *, buff_t *buff)
paste_len = strlen(rh->ec->paste_buff);
if (!ensure_buff_av_capacity(buff, paste_len))
return true;
strcpy(buff->str + paste_len, rh->ec->paste_buff);
buff->sz += paste_len - 2;
strcpy(buff->str + rh->cursor, rh->ec->paste_buff);
buff->sz += paste_len;
rh->cursor += paste_len;
return false;
}
@@ -50,9 +50,8 @@ void display_reverse_search_prompt(
dprintf(STDOUT_FILENO, "(reverse-i-search)`%s': ", search);
if (found != -1) {
dprintf(STDOUT_FILENO, "%s", hist[found].command);
if (hist[found].arg != NULL) {
if (hist[found].arg != NULL)
dprintf(STDOUT_FILENO, " %s", hist[found].arg);
}
}
}

View File

@@ -125,7 +125,7 @@ ssize_t handle_keys(
readline_helper_t *rh,
buff_t *buff,
char const *read_buff,
size_t len)
size_t)
{
if (!rh->ec->isatty)
return 0;
@@ -137,7 +137,5 @@ ssize_t handle_keys(
return strlen(KEY_HANDLERS[i].name);
return -1;
}
for (size_t i = 0; i < len; i++)
U_DEBUG("<- [%d]\n", read_buff[i]);
return 0;
}