X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=lib%2Fconsole.tcl;h=c112464ec367a2db707a3f28ff6c588aefe7985f;hb=7cce5b2cbc12a73eca3f62a885e9dbad17b250a5;hp=cde9a092686ec0acb847c05e0166f07df954f579;hpb=fbc8a93cd5b03bf15a3ebef6c0a512d2da3df7c4;p=git.git diff --git a/lib/console.tcl b/lib/console.tcl index cde9a0926..c112464ec 100644 --- a/lib/console.tcl +++ b/lib/console.tcl @@ -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 [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 [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 } }