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

Re: [PATCH] git-gui: Perform rescan on window focus-in

From
Pratyush Yadav <me@yadavpratyush.com>
Date
Jul 28, 2019, 21:44 UTC
Message-ID
<c3cdbaba-ed57-ce6c-6c07-1e4fe8cc533f@yadavpratyush.com>
In-Reply-To
<20190728151726.9188-1-me@yadavpratyush.com>
Playing with it for some time, I see some problems with the patch.

Firstly, "bind ." binds that event for the root window and all subwindows. This means we rescan multiple times on a single FocusIn event, once for every window. This can be fixed easily with a check for the root window (aka "."). I'll send a v2 patch with this change.

Secondly, when the context menu is opened via right click, and then closed, it is recorded as a FocusIn event for our root window, even though the context menu is a child of the root window. This triggers a rescan. Unfortunately, I could not find a way to go around this behaviour.

This means some unnecessary rescans, but the rescan looks like a pretty fast operation even on my slow hard disk, so it should probably not be a problem.

If someone knows a way around the second issue, please let me know.
On 28/07/19 8:47 PM, Pratyush Yadav wrote:
Show 25 quoted lines
> If any changes are made to the tree while git-gui is open, the user has
> to manually rescan to see those changes in the gui. With this change, a
> rescan will be performed whenever the window comes in focus, removing
> the need for manual rescans in most cases. A manual rescan will still be
> needed when something makes changes to the tree while git-gui is still
> in focus.
> 
> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
> ---
>   git-gui/git-gui.sh | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
> index 6de74ce639..8ca2033dc8 100755
> --- a/git-gui/git-gui.sh
> +++ b/git-gui/git-gui.sh
> @@ -3849,6 +3849,7 @@ if {[is_enabled transport]} {
>   }
>   
>   bind .   <Key-F5>     ui_do_rescan
> +bind .   <FocusIn>    do_rescan
>   bind .   <$M1B-Key-r> ui_do_rescan
>   bind .   <$M1B-Key-R> ui_do_rescan
>   bind .   <$M1B-Key-s> do_signoff
> 
-- 
Regards,
Pratyush Yadav
Previous: Pratyush Yadav
Message 23 of 23 in “git-gui: Perform rescan on window focus-in”
  1. git-gui: Perform rescan on window focus-inPratyush Yadav, Jul 28, 2019
  2. brian m. carlsonJul 28, 2019
  3. Pratyush YadavJul 28, 2019
  4. Pratyush YadavJul 28, 2019
  5. brian m. carlsonJul 28, 2019
  6. Mark LevedahlJul 29, 2019
  7. Mark LevedahlJul 29, 2019
  8. Pratyush YadavJul 29, 2019
  9. Johannes SchindelinJul 31, 2019
  10. Pratyush YadavAug 1, 2019
  11. Johannes SchindelinAug 2, 2019
  12. Pratyush YadavAug 2, 2019
  13. Johannes SchindelinAug 3, 2019
  14. Pratyush YadavAug 4, 2019
  15. Johannes SchindelinAug 4, 2019
  16. Pratyush YadavAug 4, 2019
  17. Junio C HamanoAug 2, 2019
  18. Pratyush YadavAug 2, 2019
  19. Johannes SchindelinAug 4, 2019
  20. Mark LevedahlJul 29, 2019
  21. Junio C HamanoJul 29, 2019
  22. Pratyush YadavJul 29, 2019
  23. Pratyush YadavJul 28, 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.