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>
Pat Thoyts committed
Dec 20, 2009 at 02:02 UTC
ea888f84bd6ebb7e944311d95251d28a3b547024
1 file changed
+18
-16
lib/index.tcl
+18
-16
@@ -14,29 +14,31 @@ proc _close_updateindex {fd after} {
14
toplevel $w
15
wm title $w [strcat "[appname] ([reponame]): " [mc "Index Error"]]
16
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
17
- pack [label $w.msg \
18
- -justify left \
19
- -anchor w \
20
- -text [strcat \
21
- [mc "Updating the Git index failed. A rescan will be automatically started to resynchronize git-gui."] \
22
- "\n\n$err"] \
23
- ] -anchor w
24
-
25
- frame $w.buttons
26
- button $w.buttons.continue \
17
+ set s [mc "Updating the Git index failed. A rescan will be automatically started to resynchronize git-gui."]
18
+ text $w.msg -yscrollcommand [list $w.vs set] \
19
+ -width [string length $s] -relief flat \
20
+ -borderwidth 0 -highlightthickness 0 \
21
+ -background [$w cget -background]
22
+ $w.msg tag configure bold -font font_uibold -justify center
23
+ scrollbar $w.vs -command [list $w.msg yview]
24
+ $w.msg insert end $s bold \n\n$err {}
25
+ $w.msg configure -state disabled
26
+
27
+ button $w.continue \
28
-text [mc "Continue"] \
29
-command [list destroy $w]
29
- pack $w.buttons.continue -side right -padx 5
30
- button $w.buttons.unlock \
30
+ button $w.unlock \
31
-text [mc "Unlock Index"] \
32
-command "destroy $w; _delete_indexlock"
33
- pack $w.buttons.unlock -side right
34
- pack $w.buttons -side bottom -fill x -pady 10 -padx 10
33
+ grid $w.msg - $w.vs -sticky news
34
+ grid $w.unlock $w.continue - -sticky se -padx 2 -pady 2
35
+ grid columnconfigure $w 0 -weight 1
36
+ grid rowconfigure $w 0 -weight 1
37
38
wm protocol $w WM_DELETE_WINDOW update
37
- bind $w.buttons.continue <Visibility> "
39
+ bind $w.continue <Visibility> "
40
grab $w
39
- focus $w.buttons.continue
41
+ focus %W
42
"
43
tkwait window $w
44