diff options
author | Tom Tromey <tom@tromey.com> | 2019-09-10 17:25:35 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-09-18 15:03:29 -0600 |
commit | 11061048d1fed4465b0e62eb3c14dabf0beab59b (patch) | |
tree | fda69cbe391d420c44ee650f6b2267d77efd71e4 /gdb/tui | |
parent | 7a27b85f6d9b5eea9bd1493f903158fbea4b2231 (diff) | |
download | gdb-11061048d1fed4465b0e62eb3c14dabf0beab59b.zip gdb-11061048d1fed4465b0e62eb3c14dabf0beab59b.tar.gz gdb-11061048d1fed4465b0e62eb3c14dabf0beab59b.tar.bz2 |
Give a name to the TUI SingleKey keymap
Readline 8.0 has a feature that lets an application name a keymap.
This in turn makes it simpler for users to bind keys in keymaps in
their .inputrc.
This patch gives a name to the TUI SingleKey keymap, so that
additional bindings can be made there. For example:
$if gdb
set keymap SingleKey
"X": "echo hello\\n\n"
$endif
The call to rl_initialize, in tui_initialize_readline, had to be
removed so that .inputrc was not read too early. Note that Readline
explicitly documents that this call is not needed.
gdb/ChangeLog
2019-09-18 Tom Tromey <tom@tromey.com>
* NEWS: Add entry.
* tui/tui.c (tui_initialize_readline): Set name of keymap. Do not
call rl_initialize.
(tui_enable): Do not call rl_initialize.
gdb/doc/ChangeLog
2019-09-18 Tom Tromey <tom@tromey.com>
* gdb.texinfo (Editing): Document readline application name.
(TUI Single Key Mode): Document TUI SingleKey keymap name.
Diffstat (limited to 'gdb/tui')
-rw-r--r-- | gdb/tui/tui.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index db34e0c..5d6b9f3 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -329,13 +329,17 @@ tui_initialize_readline (void) int i; Keymap tui_ctlx_keymap; - rl_initialize (); - rl_add_defun ("tui-switch-mode", tui_rl_switch_mode, -1); rl_add_defun ("gdb-command", tui_rl_command_key, -1); rl_add_defun ("next-keymap", tui_rl_next_keymap, -1); tui_keymap = rl_make_bare_keymap (); + + /* The named keymap feature was added in Readline 8.0. */ +#if RL_READLINE_VERSION >= 0x800 + rl_set_keymap_name ("SingleKey", tui_keymap); +#endif + tui_ctlx_keymap = rl_make_bare_keymap (); tui_readline_standard_keymap = rl_get_keymap (); @@ -467,7 +471,6 @@ tui_enable (void) nodelay(w, FALSE); nl(); keypad (w, TRUE); - rl_initialize (); tui_set_term_height_to (LINES); tui_set_term_width_to (COLS); def_prog_mode (); |