Anonymous avatar Anonymous committed 83751fc

git-gui: Refactor diff popup into a procedure to ease i18n work

The folks working on the i18n version of git-gui have had some
trouble trying to convert these English strings into [mc] calls
due to the double evaluation. Moving this block into a standard
procedure eliminates the double evaluation, making their work
easier.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>;

Comments (0)

Files changed (1)

 $ctxm add separator
 $ctxm add command -label {Options...} \
 	-command do_options
-bind_button3 $ui_diff "
-	set cursorX %x
-	set cursorY %y
-	if {\$ui_index eq \$current_diff_side} {
-		$ctxm entryconf $ui_diff_applyhunk -label {Unstage Hunk From Commit}
+proc popup_diff_menu {ctxm x y X Y} {
+	set ::cursorX $x
+	set ::cursorY $y
+	if {$::ui_index eq $::current_diff_side} {
+		$ctxm entryconf $::ui_diff_applyhunk \
+			-label {Unstage Hunk From Commit}
 	} else {
-		$ctxm entryconf $ui_diff_applyhunk -label {Stage Hunk For Commit}
+		$ctxm entryconf $::ui_diff_applyhunk \
+			-label {Stage Hunk For Commit}
 	}
-	tk_popup $ctxm %X %Y
-"
-unset ui_diff_applyhunk
+	tk_popup $ctxm $X $Y
+}
+bind_button3 $ui_diff [list popup_diff_menu $ctxm %x %y %X %Y]
 
 # -- Status Bar
 #
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.