public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tui/15163] New: Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a
@ 2013-02-20 16:51 rhys.ulerich at gmail dot com
  2013-02-25 13:02 ` [Bug tui/15163] " palves at redhat dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: rhys.ulerich at gmail dot com @ 2013-02-20 16:51 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15163

             Bug #: 15163
           Summary: Vi settings within ~/.inputrc prevent entering/exiting
                    TUI via C-x a
           Product: gdb
           Version: 7.5
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tui
        AssignedTo: unassigned@sourceware.org
        ReportedBy: rhys.ulerich@gmail.com
    Classification: Unclassified


Having vi-like settings in ~/.inputrc
breaks entering/exiting TUI mode using C-x a or any other key combination
documented at http://sourceware.org/gdb/download/onlinedocs/gdb/TUI-Keys.html.

To reproduce:

1. Remove any ~/.inputrc file.
2. Run 'gdb'
3. Hit C-x a and observe TUI mode starting.
4. Quit gdb
5. Create a ~/.inputrc file containing two lines:
   > set editing-mode vi
   > set keymap vi
6. Run 'gdb'
7. Hit C-x a and observe ^X^A being echoed to the screen but TUI mode not
starting.

I am unaware of any gdb command that will enter/exit TUI mode independently of
the key combination.  Is there one?

Observed generally throughout 7.x and reproduced just now on 7.5.1.

- Rhys

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tui/15163] Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a
  2013-02-20 16:51 [Bug tui/15163] New: Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a rhys.ulerich at gmail dot com
@ 2013-02-25 13:02 ` palves at redhat dot com
  2013-02-25 16:18 ` rhys.ulerich at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: palves at redhat dot com @ 2013-02-25 13:02 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15163

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |palves at redhat dot com

--- Comment #1 from Pedro Alves <palves at redhat dot com> 2013-02-25 13:02:25 UTC ---
> I am unaware of any gdb command that will enter/exit TUI mode independently of
the key combination.  Is there one?

Commands like "tui foo", and "layout next" enter the TUI.

I'm not aware of any GDB command to exit the TUI, and looking at the code, I
can't find any that would do it as side effect.

However, TUI enter/exit is bound to the readline "tui-switch-mode"
command/function:

>  rl_add_defun ("tui-switch-mode", tui_rl_switch_mode, -1);

One should be able to use that to bind any key combo to TUI enter/exit in the
inputrc file, per the "Key Bindings" node in the readline manual.  However, I'm
not familiar readline's vi mode (emacs user here), and whether key bindings
apply in that mode.

Let me know if that helps.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tui/15163] Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a
  2013-02-20 16:51 [Bug tui/15163] New: Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a rhys.ulerich at gmail dot com
  2013-02-25 13:02 ` [Bug tui/15163] " palves at redhat dot com
@ 2013-02-25 16:18 ` rhys.ulerich at gmail dot com
  2013-02-25 18:56 ` palves at redhat dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rhys.ulerich at gmail dot com @ 2013-02-25 16:18 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15163

--- Comment #2 from Rhys Ulerich <rhys.ulerich at gmail dot com> 2013-02-25 16:18:54 UTC ---
> However, TUI enter/exit is bound to the readline "tui-switch-mode"
> command/function...
> One should be able to use that to bind any key combo to TUI enter/exit in the
> inputrc file, per the "Key Bindings" node in the readline manual.  However, I'm
> not familiar readline's vi mode (emacs user here), and whether key bindings
> apply in that mode.

I'm not familiar either.  Thanks for the suggestion.  I've tried
adding a few things like

Control-x: tui-switch-mode

to my ~/.inputrc without any luck.  However, it seems that

1. Run 'gdb'
2. Hit Escape to enter vi command mode
3. Hit Control-E to enter Emacs mode ('emacs-editing-mode')
4. Hit Control-x a to enter the TUI

works.  Though now I'm in Emacs mode and hitting Control-x a again
does not exit the TUI.  And I can't seem to get  "M-C-J" to trigger
vi-editing-mode again (though this is likely me being an idiot).

- Rhys

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tui/15163] Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a
  2013-02-20 16:51 [Bug tui/15163] New: Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a rhys.ulerich at gmail dot com
  2013-02-25 13:02 ` [Bug tui/15163] " palves at redhat dot com
  2013-02-25 16:18 ` rhys.ulerich at gmail dot com
@ 2013-02-25 18:56 ` palves at redhat dot com
  2015-06-05  2:11 ` memo.salas at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: palves at redhat dot com @ 2013-02-25 18:56 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15163

--- Comment #3 from Pedro Alves <palves at redhat dot com> 2013-02-25 18:56:00 UTC ---
I'm afraid at this point I don't really know if there's a bug, or if there is,
if it is GDB specific.  As mentioned, I'm blissfully ignorant on vi things.
However, I'd think that if bash can handle the same style of key bindings in vi
mode, then gdb should too.  What does bash do?

> (though this is likely me being an idiot).

:-)  Most probably not.

A gdb command to toggle the TUI off seems like something nice to have, as
escape hatch out of broken-beyond-repair terminal settings though.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tui/15163] Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a
  2013-02-20 16:51 [Bug tui/15163] New: Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a rhys.ulerich at gmail dot com
                   ` (2 preceding siblings ...)
  2013-02-25 18:56 ` palves at redhat dot com
@ 2015-06-05  2:11 ` memo.salas at gmail dot com
  2015-06-08  6:53 ` memo.salas at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: memo.salas at gmail dot com @ 2015-06-05  2:11 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15163

Memo Salas <memo.salas at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |memo.salas at gmail dot com

--- Comment #4 from Memo Salas <memo.salas at gmail dot com> ---
This is the workaround I found:

in my ~/.inputrc , I added a line that looks like this:
C-P: tui-switch-mode

i.e. ctrl-p will do the switch.

Then, in gdb's source, in the file gdb/tui/tui.c , I found the call that
normally looks like this:

rl_add_defun ("tui-switch-mode", tui_rl_switch_mode, -1);

and changed the 3rd parameter (i.e. the key) to be a 16. Why 16? it's what the
macro CTRL(X) will do for the letter I want to assign (i.e. ctrl-p in my case).

After that, I can exit in vi-keys out of tui mode by pressing ctrl-p.


So what is the real fix?
It seems to me that a solution will have to do with changing the function
"tui_initialize_readline", which is the one that is being called at startup in
a way that it hardcodes a key of with value -1 to the "tui-switch-mode", so
that the user can provide their own key for it. My question is why is there a
-1 being assigned to that function right now in the first place. Does anybody
know ?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tui/15163] Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a
  2013-02-20 16:51 [Bug tui/15163] New: Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a rhys.ulerich at gmail dot com
                   ` (3 preceding siblings ...)
  2015-06-05  2:11 ` memo.salas at gmail dot com
@ 2015-06-08  6:53 ` memo.salas at gmail dot com
  2015-07-26 21:45 ` vz-sourceware at zeitlins dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: memo.salas at gmail dot com @ 2015-06-08  6:53 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15163

--- Comment #5 from Memo Salas <memo.salas at gmail dot com> ---
I changed my workaround by to not hard-code a key combination for exiting the
tui mode, and instead pick up a key combination from the ~/.inputrc file, , by
modifying the function tui_initialize_readline to call rl_re_read_init_file (in
readline/bind.c) before returning.

My ~/.inputrc now has a keyboard mapping to associate to "tui-switch-mode".
Regardless, for a better out-of-the-box experience perhaps a better default for
vi key bindings is needed, at least for "tui-switch-mode", then things would
work without requiring users to modify ~/.inputrc or similar.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tui/15163] Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a
  2013-02-20 16:51 [Bug tui/15163] New: Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a rhys.ulerich at gmail dot com
                   ` (4 preceding siblings ...)
  2015-06-08  6:53 ` memo.salas at gmail dot com
@ 2015-07-26 21:45 ` vz-sourceware at zeitlins dot org
  2020-04-12 23:02 ` thib at stammed dot net
  2021-04-02 19:56 ` tromey at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: vz-sourceware at zeitlins dot org @ 2015-07-26 21:45 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15163

Vadim Zeitlin <vz-sourceware at zeitlins dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vz-sourceware at zeitlins dot org

--- Comment #6 from Vadim Zeitlin <vz-sourceware at zeitlins dot org> ---
Notice that even when using `gdb -tui` to start gdb in TUI mode, it's
impossible to switch to the single key mode as `^X,s` doesn't work with vi
bindings neither. Using `<Esc>,^E` does help but as the bindings reset to vi
mode when you exit the single key mode, you need to redo it every time which
makes the single key mode just not worth it -- even having a command like "tui
single-key" would be faster than doing this, but unfortunately gdb doesn't seem
to provide anything like this.

Is there any workaround that would allow to use keys starting with `^X` in vi
mode?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tui/15163] Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a
  2013-02-20 16:51 [Bug tui/15163] New: Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a rhys.ulerich at gmail dot com
                   ` (5 preceding siblings ...)
  2015-07-26 21:45 ` vz-sourceware at zeitlins dot org
@ 2020-04-12 23:02 ` thib at stammed dot net
  2021-04-02 19:56 ` tromey at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: thib at stammed dot net @ 2020-04-12 23:02 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15163

thib at stammed dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thib at stammed dot net

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug tui/15163] Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a
  2013-02-20 16:51 [Bug tui/15163] New: Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a rhys.ulerich at gmail dot com
                   ` (6 preceding siblings ...)
  2020-04-12 23:02 ` thib at stammed dot net
@ 2021-04-02 19:56 ` tromey at sourceware dot org
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2021-04-02 19:56 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=15163

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #10 from Tom Tromey <tromey at sourceware dot org> ---
Still seems to require some workaround, reopening for investigation.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-04-02 19:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-20 16:51 [Bug tui/15163] New: Vi settings within ~/.inputrc prevent entering/exiting TUI via C-x a rhys.ulerich at gmail dot com
2013-02-25 13:02 ` [Bug tui/15163] " palves at redhat dot com
2013-02-25 16:18 ` rhys.ulerich at gmail dot com
2013-02-25 18:56 ` palves at redhat dot com
2015-06-05  2:11 ` memo.salas at gmail dot com
2015-06-08  6:53 ` memo.salas at gmail dot com
2015-07-26 21:45 ` vz-sourceware at zeitlins dot org
2020-04-12 23:02 ` thib at stammed dot net
2021-04-02 19:56 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).