+set next_console_id 0
+
+proc new_console {short_title long_title} {
+ global next_console_id gitdir appname mainfont difffont
+
+ set w .console[incr next_console_id]
+ toplevel $w
+ frame $w.m
+ label $w.m.l1 -text "$long_title:" \
+ -anchor w \
+ -justify left \
+ -font [concat $mainfont bold]
+ text $w.m.t \
+ -background white -borderwidth 1 \
+ -relief sunken \
+ -width 80 -height 10 \
+ -font $difffont \
+ -state disabled \
+ -yscrollcommand [list $w.m.sby set]
+ scrollbar $w.m.sby -command [list $w.m.t yview]
+ pack $w.m.l1 -side top -fill x
+ pack $w.m.sby -side right -fill y
+ pack $w.m.t -side left -fill both -expand 1
+ pack $w.m -side top -fill both -expand 1 -padx 5 -pady 10
+
+ button $w.ok -text {OK} \
+ -width 15 \
+ -font $mainfont \
+ -state disabled \
+ -command "destroy $w"
+ pack $w.ok -side bottom
+
+ bind $w <Visibility> "focus $w"
+ bind $w <Destroy> break
+ wm title $w "$appname ([file dirname [file normalize [file dirname $gitdir]]]): $short_title"
+ return $w
+}
+
+proc console_read {w fd} {
+ $w.m.t conf -state normal
+ while {[gets $fd line] >= 0} {
+ $w.m.t insert end $line
+ $w.m.t insert end "\n"
+ }
+ $w.m.t conf -state disabled
+
+ if {[eof $fd]} {
+ close $fd
+ $w.ok conf -state normal
+ }
+}
+