git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pat Thoyts <patthoyts@users.sourceforge.net>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: <git@vger.kernel.org>
Cc: <msysgit@googlegroups.com>
Subject: [PATCH] git-gui: handle really long error messages in updateindex.
Date: Sun, 20 Dec 2009 02:02:03 +0000	[thread overview]
Message-ID: <87bphqui9t.fsf@users.sourceforge.net> (raw)

 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>
---
 lib/index.tcl |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

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

             reply	other threads:[~2009-12-23  9:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-20  2:02 Pat Thoyts [this message]
2010-01-23 22:23 ` [PATCH] git-gui: handle really long error messages in updateindex Shawn O. Pearce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bphqui9t.fsf@users.sourceforge.net \
    --to=patthoyts@users.sourceforge.net \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).