git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] [PATCH] git-gui: Add hotkeys to set widget focus

From
Birger Skogeng Pedersen <birger.sp@gmail.com>
Date
Sep 3, 2019, 14:21 UTC
Message-ID
<CAGr--=L=iUxAOGwwbQwVB5OwmNoXorBXgehMfiC5gvfgUQEa9g@mail.gmail.com>
In-Reply-To
<CAKPyHN0LtOG9mFQ6qxc-w-EdpJ3HGJmHAGdrGp2FKkq4uCf55A@mail.gmail.com>
Hi Bert,
On Mon, Sep 2, 2019 at 9:42 PM Bert Wesarg <bert.wesarg@googlemail.com> wrote:
> So we only remember the lno in the widget, that could mean, that we
> select the wrong file after a rescan, which shifted the previous path
> one down. Can we remember the pathname instead, and try to find this
> again in the file list?

Seems to me like a rescan makes git-gui select the first file in the list, regardless of this feature (patch) or not. Ideally, git-gui would not do this. It should select the same file that was selected before (if it can). But honestly it seems like a separate (perhaps broader) issue. My biggest issue is not having the hotkeys, and that's what I'm trying to mend :-)

> can we name it 'focus_and_select_path_in', as the main job ob this
> function is to focus the widget. It makes also the 'bind' command
> below more readily, because than all bind commands start with 'focus'.
Agreed.
Show 10 quoted lines
> > +       global file_lists_last_clicked
> > +
> > +       set _list_length [llength $file_lists($widget)]
> > +       if {$_list_length > 0} {
> > +
> > +               set _index $file_lists_last_clicked($widget)
>
> I have the impression that variables starting with '_' are mainly used
> as read-only global variables, see the list at line 158, and not that
> often as temporal local variables.

Agreed, I'll rename it. It's been almost a year since I wrote this patch so I can't really remember my reasoning for putting the underscore there.

Show 8 quoted lines
> I would like to bring up a proposal: AFAICS, more or less all CTRL
> bindings have a menu entry. But it does not make sense to have a menu
> entry for these bindings. And I think we could add more bindings for
> keyboard-afine users. Thus I would like to propose to use ALT as the
> modifier for these bindings, which would give us a nice binding
> classification.
>
> How about that?

Makes sense. And the ALT+1/2/3/4 seems to be unused for anything else. At least on Windows, maybe on other systems those keystrokes are already in use?

Birger
Previous: Bert WesargNext: Pratyush Yadav
Message 20 of 46 in “git-gui, feature request: add hotkeys to focus different widgets”
  1. Birger Skogeng PedersenFeb 20, 2018
  2. git-gui: Add hotkeys to change focus between ui widgetsBirger Skogeng Pedersen, Feb 23, 2018
  3. Birger Skogeng PedersenFeb 23, 2018
  4. git-gui: Add hotkeys to change focus between ui widgetsBirger Skogeng Pedersen, Feb 28, 2018
  5. Johannes SchindelinMar 5, 2018
  6. Birger Skogeng PedersenMar 6, 2018
  7. Junio C HamanoMar 6, 2018
  8. git-gui: Add hotkeys to set widget focusBirger Skogeng Pedersen, Aug 31, 2019
  9. Birger Skogeng PedersenAug 31, 2019
  10. Pratyush YadavSep 1, 2019
  11. Junio C HamanoSep 1, 2019
  12. Birger Skogeng PedersenSep 1, 2019
  13. Bert WesargSep 1, 2019
  14. [PATCH] git-gui: Add hotkeys to set widget focusBirger Skogeng Pedersen, Sep 1, 2019
  15. Pratyush YadavSep 2, 2019
  16. Birger Skogeng PedersenSep 2, 2019
  17. Pratyush YadavSep 2, 2019
  18. Birger Skogeng PedersenSep 2, 2019
  19. Bert WesargSep 2, 2019
  20. Birger Skogeng PedersenSep 3, 2019
  21. Pratyush YadavSep 3, 2019
  22. git-gui: use path name instead of list index to track last clicked filePratyush Yadav, Sep 3, 2019
  23. git-gui: Add hotkeys to set widget focusBirger Skogeng Pedersen, Sep 3, 2019
  24. Birger Skogeng PedersenSep 3, 2019
  25. Birger Skogeng PedersenSep 3, 2019
  26. Pratyush YadavSep 3, 2019
  27. git-gui: Add hotkeys to set widget focusBirger Skogeng Pedersen, Sep 4, 2019
  28. Johannes SixtSep 4, 2019
  29. Birger Skogeng PedersenSep 4, 2019
  30. Johannes SixtSep 4, 2019
  31. Pratyush YadavSep 4, 2019
  32. Junio C HamanoSep 4, 2019
  33. Pratyush YadavSep 5, 2019
  34. Bert WesargSep 4, 2019
  35. Johannes SixtSep 4, 2019
  36. Pratyush YadavSep 10, 2019
  37. Birger Skogeng PedersenSep 11, 2019
  38. Pratyush YadavSep 11, 2019
  39. Johannes SixtSep 11, 2019
  40. Bert WesargSep 3, 2019
  41. Philip OakleySep 1, 2019
  42. Pratyush YadavSep 2, 2019
  43. Philip OakleySep 2, 2019
  44. Pratyush YadavSep 3, 2019
  45. Bert WesargSep 1, 2019
  46. Birger Skogeng PedersenSep 1, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.