Bug 26638 - TUI focus behavior change
Summary: TUI focus behavior change
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: tui (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 10.1
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-20 00:56 UTC by Simon Marchi
Modified: 2020-09-24 19:05 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Marchi 2020-09-20 00:56:59 UTC
Commit a30cb6dabb20 ("Derive tui_locator_window from tui_win_info") introduced a behavior change regarding focus change in the TUI, I think it was not expected.

Behavior before:

1. Start GDB with the tui enabled
2. Type "ctrl-x o" once to change the focus
3. Type any command
4. Hit up arrow: it brings back the previously typed command

Behavior after:

1. Start GDB with the tui enabled
2. Type "ctrl-x o" once to change the focus
3. Type any command
4. Hit up arrow: nothing happens

One suspicious sign is that before this patch, it takes two "ctrl-x o" to cycles through the focusable views (code and prompt).  After the patch, it takes three.  So it looks like there's a third hidden view that gets the focus.

I noticed this because I usually do "ctrl-x o" to change the focus to the prompt, to be able to use the arrows to access the history of commands.
Comment 1 Joel Brobecker 2020-09-20 14:32:05 UTC
FTR, I double-checked that commit a30cb6dabb20 is in the gdb-10-branch.
Changing the target milestone to 10.1
Comment 3 Sourceware Commits 2020-09-24 19:02:48 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b551a89f51504735e9979ac885a5784e21cfecef

commit b551a89f51504735e9979ac885a5784e21cfecef
Author: Tom Tromey <tromey@adacore.com>
Date:   Wed Sep 23 12:57:19 2020 -0600

    Don't let TUI focus on locator
    
    PR tui/26638 notes that the C-x o binding can put the focus on the
    locator window.  However, this is not useful and did not happen
    historically.  This patch changes the TUI to skip this window when
    switching focus.
    
    gdb/ChangeLog
    2020-09-24  Tom Tromey  <tromey@adacore.com>
    
            PR tui/26638:
            * tui/tui-stack.h (struct tui_locator_window) <can_focus>: New
            method.
            * tui/tui-data.h (struct tui_win_info) <can_focus>: New method.
            * tui/tui-data.c (tui_next_win): Exclude non-focusable windows.
            (tui_prev_win): Rewrite.
    
    gdb/testsuite/ChangeLog
    2020-09-24  Tom Tromey  <tromey@adacore.com>
    
            PR tui/26638:
            * gdb.tui/list.exp: Check output of "focus next".
Comment 4 Sourceware Commits 2020-09-24 19:04:30 UTC
The gdb-10-branch branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8ccf2a20fbfe4b4a4199709b999ce3b601a9065a

commit 8ccf2a20fbfe4b4a4199709b999ce3b601a9065a
Author: Tom Tromey <tromey@adacore.com>
Date:   Wed Sep 23 12:57:19 2020 -0600

    Don't let TUI focus on locator
    
    PR tui/26638 notes that the C-x o binding can put the focus on the
    locator window.  However, this is not useful and did not happen
    historically.  This patch changes the TUI to skip this window when
    switching focus.
    
    2020-09-24  Tom Tromey  <tromey@adacore.com>
    
            PR tui/26638:
            * tui/tui-stack.h (struct tui_locator_window) <can_focus>: New
            method.
            * tui/tui-data.h (struct tui_win_info) <can_focus>: New method.
            * tui/tui-data.c (tui_next_win): Exclude non-focusable windows.
            (tui_prev_win): Rewrite.
    
    gdb/testsuite/ChangeLog
    2020-09-24  Tom Tromey  <tromey@adacore.com>
    
            PR tui/26638:
            * gdb.tui/list.exp: Check output of "focus next".
Comment 5 Tom Tromey 2020-09-24 19:04:58 UTC
Fixed.
Comment 6 Tom Tromey 2020-09-24 19:05:30 UTC
Don't know why it switched to "notabug".