[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 70/76] util/readline: Add C-u shortcut
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 70/76] util/readline: Add C-u shortcut |
Date: |
Tue, 18 Jun 2024 18:00:32 +0200 |
From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Add support for the unix-line-discard readline action, which erases from
the cursor position up to the beginning of the line. The default
binding, C-u, was chosen.
This is useful to quickly erase command input while working on the
monitor interface.
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID:
<6772067e1c0d4b1c5310e5446e9e3e1c6b3b5bc0.1718265822.git.manos.pitsidianakis@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
util/readline.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/util/readline.c b/util/readline.c
index 0b627d62ad..0f19674f52 100644
--- a/util/readline.c
+++ b/util/readline.c
@@ -271,6 +271,14 @@ static void readline_hist_add(ReadLineState *rs, const
char *cmdline)
rs->hist_entry = -1;
}
+static void readline_kill_line(ReadLineState *rs)
+{
+ while (rs->cmd_buf_index > 0) {
+ readline_backward_char(rs);
+ readline_delete_char(rs);
+ }
+}
+
/* completion support */
void readline_add_completion(ReadLineState *rs, const char *str)
@@ -426,6 +434,10 @@ void readline_handle_byte(ReadLineState *rs, int ch)
/* ^P Prev line in history */
readline_up_char(rs);
break;
+ case 21:
+ /* ^U Kill backward from point to the beginning of the line. */
+ readline_kill_line(rs);
+ break;
case 23:
/* ^W */
readline_backword(rs);
--
2.41.0
- [PULL 60/76] hw/usb: Remove unused 'host.h' header, (continued)
- [PULL 60/76] hw/usb: Remove unused 'host.h' header, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 63/76] hw/intc/loongson_ipi: Provide per core MMIO address spaces, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 62/76] hw/intc: Remove loongarch_ipi.c, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 61/76] hw/usb/dev-mtp: Correctly report free space, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 64/76] hw/intc/loongson_ipi: Replace ipi_getcpu with cpu_by_arch_id, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 66/76] hw/s390x: Introduce s390_skeys_get|set() helpers, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 65/76] hw/mips/loongson3_virt: Wire up loongson_ipi device, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 67/76] target/s390x: Use s390_skeys_get|set() helper, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 68/76] util/readline: Fix lints for readline_handle_byte, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 69/76] util/readline: Add C-n, C-p shortcuts, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 70/76] util/readline: Add C-u shortcut,
Philippe Mathieu-Daudé <=
- [PULL 71/76] MAINTAINERS: drop virtio-gpu maintainership, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 72/76] MAINTAINERS: drop spice+ui maintainership, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 73/76] ui/cocoa: Use qemu_add_mouse_change_notifier, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 74/76] stdvga: fix screen blanking, Philippe Mathieu-Daudé, 2024/06/18
- [PULL 75/76] ui+display: rename is_placeholder() -> surface_is_placeholder(), Philippe Mathieu-Daudé, 2024/06/18
- [PULL 76/76] ui+display: rename is_buffer_shared() -> surface_is_allocated(), Philippe Mathieu-Daudé, 2024/06/18
- Re: [PULL 00/76] Misc patches for 2024-06-18, Richard Henderson, 2024/06/18