summaryrefslogtreecommitdiffstats
path: root/library/console.tcl
diff options
context:
space:
mode:
authorhobbs <hobbs>2005-05-31 04:59:38 (GMT)
committerhobbs <hobbs>2005-05-31 04:59:38 (GMT)
commit465be84f8698aef1f80358f246dc9457a9fc66a1 (patch)
treea5da0e207a25b1436dc8e9033b1a8858ff8a28ae /library/console.tcl
parenta612dfd71cac20e4db9bbbe3099e075702d03bd1 (diff)
downloadtk-465be84f8698aef1f80358f246dc9457a9fc66a1.zip
tk-465be84f8698aef1f80358f246dc9457a9fc66a1.tar.gz
tk-465be84f8698aef1f80358f246dc9457a9fc66a1.tar.bz2
more elaborate variant to get first prompt displayed without a puts call
Diffstat (limited to 'library/console.tcl')
-rw-r--r--library/console.tcl16
1 files changed, 14 insertions, 2 deletions
diff --git a/library/console.tcl b/library/console.tcl
index 1462175..893e086 100644
--- a/library/console.tcl
+++ b/library/console.tcl
@@ -4,7 +4,7 @@
# can be used by non-unix systems that do not have built-in support
# for shells.
#
-# RCS: @(#) $Id: console.tcl,v 1.27 2005/05/30 23:41:01 hobbs Exp $
+# RCS: @(#) $Id: console.tcl,v 1.28 2005/05/31 04:59:38 hobbs Exp $
#
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 Ajuba Solutions.
@@ -137,7 +137,19 @@ proc ::tk::ConsoleInit {} {
$con mark set promptEnd insert
$con mark gravity promptEnd left
- ConsolePrompt
+ # A variant of ConsolePrompt to avoid a 'puts' call
+ set w $con
+ set temp [$w index "end - 1 char"]
+ $w mark set output end
+ if {![consoleinterp eval "info exists tcl_prompt1"]} {
+ set string [EvalAttached $::tk::console::defaultPrompt]
+ $w insert output $string stdout
+ }
+ $w mark set output $temp
+ ::tk::TextSetCursor $w end
+ $w mark set promptEnd insert
+ $w mark gravity promptEnd left
+
if {$tcl_platform(platform) eq "windows"} {
# Subtle work-around to erase the '% ' that tclMain.c prints out
after idle [list $con delete 1.0 output]