Skip to content

Commit ea888f8

Browse files
patthoytsspearce
authored andcommitted
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 <[email protected]> Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent b677c66 commit ea888f8

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

lib/index.tcl

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,31 @@ proc _close_updateindex {fd after} {
1414
toplevel $w
1515
wm title $w [strcat "[appname] ([reponame]): " [mc "Index Error"]]
1616
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 \
2728
-text [mc "Continue"] \
2829
-command [list destroy $w]
29-
pack $w.buttons.continue -side right -padx 5
30-
button $w.buttons.unlock \
30+
button $w.unlock \
3131
-text [mc "Unlock Index"] \
3232
-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
3537

3638
wm protocol $w WM_DELETE_WINDOW update
37-
bind $w.buttons.continue <Visibility> "
39+
bind $w.continue <Visibility> "
3840
grab $w
39-
focus $w.buttons.continue
41+
focus %W
4042
"
4143
tkwait window $w
4244

0 commit comments

Comments
 (0)