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>
Shawn O. Pearce committed
Jul 23, 2007 at 00:36 UTC
83751fc109e951a5cbde9ee39970f6b1d2da07c7
1 file changed
+11
-9
git-gui.sh
+11
-9
@@ -2418,17 +2418,19 @@ lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
2418
$ctxm add separator
2419
$ctxm add command -label {Options...} \
2420
-command do_options
2421
-bind_button3 $ui_diff "
2422
- set cursorX %x
2423
- set cursorY %y
2424
- if {\$ui_index eq \$current_diff_side} {
2425
- $ctxm entryconf $ui_diff_applyhunk -label {Unstage Hunk From Commit}
2421
+proc popup_diff_menu {ctxm x y X Y} {
2422
+ set ::cursorX $x
2423
+ set ::cursorY $y
2424
+ if {$::ui_index eq $::current_diff_side} {
2425
+ $ctxm entryconf $::ui_diff_applyhunk \
2426
+ -label {Unstage Hunk From Commit}
2427
} else {
2427
- $ctxm entryconf $ui_diff_applyhunk -label {Stage Hunk For Commit}
2428
+ $ctxm entryconf $::ui_diff_applyhunk \
2429
+ -label {Stage Hunk For Commit}
2430
}
2429
- tk_popup $ctxm %X %Y
2430
-"
2431
-unset ui_diff_applyhunk
2431
+ tk_popup $ctxm $X $Y
2432
+}
2433
+bind_button3 $ui_diff [list popup_diff_menu $ctxm %x %y %X %Y]
2434
2435
# -- Status Bar
2436
#