xC: add a basic C-t binding

This commit is contained in:
2026-08-10 07:59:46 +02:00
parent 959fb15828
commit 63d54df66a
+20
View File
@@ -815,6 +815,23 @@ INPUT_FN (kill_line)
return true;
}
INPUT_FN (transpose_chars)
// TODO(p): Better Unicode processing.
if (buffer->point < 1 || buffer->len < 2)
return false;
if (buffer->point == (int) buffer->len)
buffer->point--;
uint32_t cp = buffer->line[buffer->point];
int width = buffer->w[buffer->point];
buffer->line[buffer->point] = buffer->line[buffer->point - 1];
buffer->w [buffer->point] = buffer->w [buffer->point - 1];
buffer->line[buffer->point - 1] = cp;
buffer->w [buffer->point - 1] = width;
buffer->point++;
return true;
}
INPUT_FN (upcase_word)
// TODO(p): Better Unicode processing.
int i = buffer->point;
@@ -938,6 +955,9 @@ g_input_actions[] =
{ "kill-line", "Delete everything up to EOL",
input_kill_line,
(const char *[]) { "C-k", NULL } },
{ "transpose-chars", "Transpose characters before and at the cursor",
input_transpose_chars,
(const char *[]) { "C-t", NULL } },
{ "upcase-word", "Convert word to uppercase",
input_upcase_word,