git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / Atom feed
From: Birger Skogeng Pedersen <birger.sp@gmail.com>
To: git@vger.kernel.org
Cc: Birger Skogeng Pedersen <birger.sp@gmail.com>
Subject: [PATCH 1/2] git-gui: implement proc select_path_in_widget
Date: Mon,  7 Oct 2019 19:11:44 +0200
Message-ID: <20191007171145.1259-1-birger.sp@gmail.com> (raw)
In-Reply-To: <CAGr--=KXpt7GzqPpm1BCrsc1jhfaXeCT-XrWKNvq2pLtgAbSwQ@mail.gmail.com>

Signed-off-by: Birger Skogeng Pedersen <birger.sp@gmail.com>
---
 git-gui.sh | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index fd476b6..b7f4d1e 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -2669,25 +2669,31 @@ proc show_less_context {} {
 }
 
 proc focus_widget {widget} {
-	global file_lists last_clicked selected_paths
-	global file_lists_last_clicked
+	global file_lists
 
 	if {[llength $file_lists($widget)] > 0} {
-		set path $file_lists_last_clicked($widget)
-		set index [lsearch -sorted -exact $file_lists($widget) $path]
-		if {$index < 0} {
-			set index 0
-			set path [lindex $file_lists($widget) $index]
-		}
-
+		select_path_in_widget $widget
 		focus $widget
-		set last_clicked [list $widget [expr $index + 1]]
-		array unset selected_paths
-		set selected_paths($path) 1
-		show_diff $path $widget
 	}
 }
 
+proc select_path_in_widget {widget} {
+	global file_lists last_clicked selected_paths
+	global file_lists_last_clicked
+
+	set path $file_lists_last_clicked($widget)
+	set index [lsearch -sorted -exact $file_lists($widget) $path]
+	if {$index < 0} {
+		set index 0
+		set path [lindex $file_lists($widget) $index]
+	}
+
+	set last_clicked [list $widget [expr $index + 1]]
+	array unset selected_paths
+	set selected_paths($path) 1
+	show_diff $path $widget
+}
+
 proc toggle_commit_type {} {
 	global commit_type_is_amend
 	set commit_type_is_amend [expr !$commit_type_is_amend]
-- 
2.23.0.windows.1


  reply	other threads:[~2019-10-07 17:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-14 12:24 git-gui: automatically move focus to staged file before typing commit message? Birger Skogeng Pedersen
2019-09-14 21:15 ` Pratyush Yadav
2019-09-14 21:26   ` Johannes Sixt
2019-09-14 21:27   ` Pratyush Yadav
2019-09-15  7:55     ` Birger Skogeng Pedersen
2019-09-16 18:01       ` Pratyush Yadav
2019-09-26 18:33         ` Birger Skogeng Pedersen
2019-09-26 19:30           ` Pratyush Yadav
2019-09-26 21:17             ` Birger Skogeng Pedersen
2019-10-07 16:52               ` Birger Skogeng Pedersen
2019-10-07 17:11                 ` Birger Skogeng Pedersen [this message]
2019-10-07 17:11                   ` [PATCH 2/2] git-gui: select staged on ui_comm focus Birger Skogeng Pedersen
2019-10-16 19:25                     ` Pratyush Yadav
2019-10-13 20:21                   ` [PATCH 1/2] git-gui: implement proc select_path_in_widget Pratyush Yadav
2019-10-15 10:51                     ` Birger Skogeng Pedersen
2019-10-16 19:28                       ` Pratyush Yadav
2019-10-17  5:08                         ` Birger Skogeng Pedersen
2019-10-17  5:33                           ` Johannes Sixt
2019-10-17  6:54                             ` Birger Skogeng Pedersen
2019-10-17 18:28                           ` Pratyush Yadav
2019-10-08 17:59                 ` git-gui: automatically move focus to staged file before typing commit message? Pratyush Yadav
2019-10-08 19:46                   ` Birger Skogeng Pedersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191007171145.1259-1-birger.sp@gmail.com \
    --to=birger.sp@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git