.tclshrc
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sun, 30 Dec 2018 12:26:48 +0200
changeset 915 691db6af02e4
parent 635 799341bb0ea7
permissions -rw-r--r--
Change rules size only on SIGWINCH. $COLUMNS isn't updated on SIGWINCH yet so "tput" is used. For better performance ruler is calculated by substring. Moving ruler handler to trap cleans console from garbage when "set -x" is set in interactive session. It is useful during debugging of bash completion.

# -*- mode: tcl -*-

if {$tcl_interactive} {
    catch {
        package require tclreadline
        namespace eval tclreadline {
            if ([regexp "^(xterm|eterm-color)" "$::env(TERM)"]) {
                proc prompt1 {} { return "\[0;31m\[1mtcl>\[0m " }
                proc prompt2 {} { return "\[0;31m...> \[0m" }
            } {
                proc prompt1 {} { return "tcl> " }
                proc prompt2 {} { return "...> " }
            }
        }
        ::tclreadline::Loop
    }
}