git-gui: Reenable staging unmerged files by clicking the icon.
[gitweb.git] / lib / console.tcl
index cde9a092686ec0acb847c05e0166f07df954f579..c112464ec367a2db707a3f28ff6c588aefe7985f 100644 (file)
@@ -46,7 +46,9 @@ method _init {} {
                -justify left \
                -font font_uibold
        text $w_t \
-               -background white -borderwidth 1 \
+               -background white \
+               -foreground black \
+               -borderwidth 1 \
                -relief sunken \
                -width 80 -height 10 \
                -wrap none \
@@ -120,7 +122,7 @@ method _read {fd after} {
                        } else {
                                $w_t delete $console_cr end
                                $w_t insert end "\n"
-                               $w_t insert end [string range $buf $c $cr]
+                               $w_t insert end [string range $buf $c [expr {$cr - 1}]]
                                set c $cr
                                incr c
                        }
@@ -179,34 +181,33 @@ method insert {txt} {
 method done {ok} {
        if {$ok} {
                if {[winfo exists $w.m.s]} {
-                       $w.m.s conf -background green -text [mc "Success"]
+                       bind $w.m.s <Destroy> [list delete_this $this]
+                       $w.m.s conf -background green -foreground black \
+                               -text [mc "Success"]
                        if {$is_toplevel} {
                                $w.ok conf -state normal
                                focus $w.ok
                        }
+               } else {
+                       delete_this
                }
        } else {
                if {![winfo exists $w.m.s]} {
                        _init $this
                }
-               $w.m.s conf -background red -text [mc "Error: Command Failed"]
+               bind $w.m.s <Destroy> [list delete_this $this]
+               $w.m.s conf -background red -foreground black \
+                       -text [mc "Error: Command Failed"]
                if {$is_toplevel} {
                        $w.ok conf -state normal
                        focus $w.ok
                }
        }
-       delete_this
 }
 
 method _sb_set {sb orient first last} {
-       if {$first == 0 && $last == 1} {
-               if {[winfo exists $sb]} {
-                       destroy $sb
-               }
-               return
-       }
-
        if {![winfo exists $sb]} {
+               if {$first == $last || ($first == 0 && $last == 1)} return
                if {$orient eq {h}} {
                        scrollbar $sb -orient h -command [list $w_t xview]
                        pack $sb -fill x -side bottom -before $w_t
@@ -215,7 +216,7 @@ method _sb_set {sb orient first last} {
                        pack $sb -fill y -side right -before $w_t
                }
        }
-       catch {$sb set $first $last}
+       $sb set $first $last
 }
 
 }