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>
This commit is contained in:
		
							
								
								
									
										20
									
								
								git-gui.sh
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								git-gui.sh
									
									
									
									
									
								
							@ -2418,17 +2418,19 @@ lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
 | 
				
			|||||||
$ctxm add separator
 | 
					$ctxm add separator
 | 
				
			||||||
$ctxm add command -label {Options...} \
 | 
					$ctxm add command -label {Options...} \
 | 
				
			||||||
	-command do_options
 | 
						-command do_options
 | 
				
			||||||
bind_button3 $ui_diff "
 | 
					proc popup_diff_menu {ctxm x y X Y} {
 | 
				
			||||||
	set cursorX %x
 | 
						set ::cursorX $x
 | 
				
			||||||
	set cursorY %y
 | 
						set ::cursorY $y
 | 
				
			||||||
	if {\$ui_index eq \$current_diff_side} {
 | 
						if {$::ui_index eq $::current_diff_side} {
 | 
				
			||||||
		$ctxm entryconf $ui_diff_applyhunk -label {Unstage Hunk From Commit}
 | 
							$ctxm entryconf $::ui_diff_applyhunk \
 | 
				
			||||||
 | 
								-label {Unstage Hunk From Commit}
 | 
				
			||||||
	} else {
 | 
						} 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
 | 
						tk_popup $ctxm $X $Y
 | 
				
			||||||
"
 | 
					}
 | 
				
			||||||
unset ui_diff_applyhunk
 | 
					bind_button3 $ui_diff [list popup_diff_menu $ctxm %x %y %X %Y]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# -- Status Bar
 | 
					# -- Status Bar
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user