Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10600
Modified Files: Tag: desiredata desire.tk Log Message: Listener and Runcommand now also uses History, still got some deatils to sort out..
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.280 retrieving revision 1.1.2.600.2.281 diff -C2 -d -r1.1.2.600.2.280 -r1.1.2.600.2.281 *** desire.tk 4 Aug 2007 07:04:47 -0000 1.1.2.600.2.280 --- desire.tk 4 Aug 2007 16:45:20 -0000 1.1.2.600.2.281 *************** *** 469,481 **** set @hist [linsert $@hist 0 $stuff] if {[llength $@hist] >= $@size} {set @hist [lrange $@hist 0 [expr $@size-1]]} }
def History traverse {incr tmp_text} { if {![llength $@hist]} {return} set find [lsearch $@hist $@tmp_text] #what if the tmp_text is well formed?? ! if {$find >= 0 && !$@hist_on} {set @hist [lreplace $@hist $find $find]} set @tmp_text $tmp_text ! if {$tmp_text != "" && !$@hist_on} {lappend @hist $tmp_text; set @hist_on 1} set @histi [expr $@histi + $incr] set mod [expr ([llength $@hist]<[expr $@size+1]) ?[llength $@hist]:[expr $@size+1]] --- 469,484 ---- set @hist [linsert $@hist 0 $stuff] if {[llength $@hist] >= $@size} {set @hist [lrange $@hist 0 [expr $@size-1]]} + puts "hist::: $@hist" }
def History traverse {incr tmp_text} { + puts "hist_on :::::::: $@hist_on" if {![llength $@hist]} {return} set find [lsearch $@hist $@tmp_text] #what if the tmp_text is well formed?? ! if {$find >= 0 && !$@hist_on} {set @hist [lreplace $@hist $find $find]; puts "REMOVE::: $@tmp_text"} set @tmp_text $tmp_text ! if {$tmp_text != "" && !$@hist_on} {lappend @hist $tmp_text; set @hist_on 1; puts "ADD::: $@tmp_text"} ! puts "history:::: $@hist" set @histi [expr $@histi + $incr] set mod [expr ([llength $@hist]<[expr $@size+1]) ?[llength $@hist]:[expr $@size+1]] *************** *** 3307,3312 ****
def Runcommand init {serf name command} { ! set @hist {} ! set @histi 0 set @serf ${serf}.run set @command $command --- 3310,3314 ----
def Runcommand init {serf name command} { ! set @history [History new 20] set @serf ${serf}.run set @command $command *************** *** 3365,3371 **** set f $@serf if {[winfo exists $f.completion]} { ! set @hist [linsert $@hist 0 [string range $@comp 0 [expr [string first ":" $@comp 0]-1]]] ! set @histi 0 ! $self replace destroy $f.completion return --- 3367,3373 ---- set f $@serf if {[winfo exists $f.completion]} { ! set l [string range $@comp 0 [expr [string first ":" $@comp 0]-1]] ! $@history prepend $l ! $self replace $l destroy $f.completion return *************** *** 6293,6296 **** --- 6295,6299 ----
def Listener init {serf name command} { + set @history [History new 20] set @hist {} set @histi 0 *************** *** 6338,6362 **** }
! def Listener replace {} { $@serf.entry delete 0 end ! $@serf.entry insert 0 [lindex $@hist $@histi] $@serf.entry icursor end }
! def Listener up {} {if {$@histi>0} {set @histi [expr $@histi-1]; $self replace}} ! def Listener down {} {if {$@histi<[llength $@hist]} {incr @histi; $self replace}} ! def Listener append {v} {lappend @hist $v; set @histi [llength $@hist]}
! def Listener eval {} { set e $@serf.entry if {$@expanded} { ! set l [$e get 0.0 end] ! $self append $l ! $e delete 0.0 end ! } { ! set l [$e get] ! $self append $l ! $e delete 0 end } $@command $self $l } --- 6341,6374 ---- }
! def Listener replace {stuff} { $@serf.entry delete 0 end ! $@serf.entry insert 0 $stuff $@serf.entry icursor end }
! def Listener up {} {$self replace [$@history traverse +1 [$self get_command]]} ! def Listener down {} {$self replace [$@history traverse -1 [$self get_command]]}
! def Listener append {v} { ! $@history prepend $v ! lappend @hist $v; set @histi [llength $@hist] ! } ! ! def Listener get_command {} { set e $@serf.entry if {$@expanded} { ! set l [$e get 0.0 end]; return $l ! } else { ! set l [$e get]; return $l } + + } + + def Listener eval {} { + set e $@serf.entry + $@history hist_on= 0; $@history histi= -1 + set l [$self get_command] + $self append $l + if {$@expanded} {$e delete 0.0 end} {$e delete 0 end} $@command $self $l }