git-gui: handle really long error messages in updateindex.

As reported to msysGit (bug #340) it is possible to get some very
long error messages when updating the index. The use of a label to
display this prevents scrolling the output. This patch replaces the
label with a scrollable text widget configured to look like a label.

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Pat Thoyts 2009-12-20 02:02:03 +00:00 committed by Shawn O. Pearce
parent b677c66e29
commit ea888f84bd

View File

@ -14,29 +14,31 @@ proc _close_updateindex {fd after} {
toplevel $w toplevel $w
wm title $w [strcat "[appname] ([reponame]): " [mc "Index Error"]] wm title $w [strcat "[appname] ([reponame]): " [mc "Index Error"]]
wm geometry $w "+[winfo rootx .]+[winfo rooty .]" wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
pack [label $w.msg \ set s [mc "Updating the Git index failed. A rescan will be automatically started to resynchronize git-gui."]
-justify left \ text $w.msg -yscrollcommand [list $w.vs set] \
-anchor w \ -width [string length $s] -relief flat \
-text [strcat \ -borderwidth 0 -highlightthickness 0 \
[mc "Updating the Git index failed. A rescan will be automatically started to resynchronize git-gui."] \ -background [$w cget -background]
"\n\n$err"] \ $w.msg tag configure bold -font font_uibold -justify center
] -anchor w scrollbar $w.vs -command [list $w.msg yview]
$w.msg insert end $s bold \n\n$err {}
$w.msg configure -state disabled
frame $w.buttons button $w.continue \
button $w.buttons.continue \
-text [mc "Continue"] \ -text [mc "Continue"] \
-command [list destroy $w] -command [list destroy $w]
pack $w.buttons.continue -side right -padx 5 button $w.unlock \
button $w.buttons.unlock \
-text [mc "Unlock Index"] \ -text [mc "Unlock Index"] \
-command "destroy $w; _delete_indexlock" -command "destroy $w; _delete_indexlock"
pack $w.buttons.unlock -side right grid $w.msg - $w.vs -sticky news
pack $w.buttons -side bottom -fill x -pady 10 -padx 10 grid $w.unlock $w.continue - -sticky se -padx 2 -pady 2
grid columnconfigure $w 0 -weight 1
grid rowconfigure $w 0 -weight 1
wm protocol $w WM_DELETE_WINDOW update wm protocol $w WM_DELETE_WINDOW update
bind $w.buttons.continue <Visibility> " bind $w.continue <Visibility> "
grab $w grab $w
focus $w.buttons.continue focus %W
" "
tkwait window $w tkwait window $w