alias ex1 {
window -c @ex1
window -el20 @ex1
var %i = 1
while (%i <= 100) {
var %line, %j = 100
while (%j) { var %line = $+(%line,$chr(3),$calc(%j % 16) %i) | dec %j }
[color:blue]if ($r(0,1)) { aline -p @ex1 Line %i ----- %line } | else { aline @ex1 $str($chr(31),2) $+ Line %i ----- %line }
;^ any line not wrapping leades off with to ctrl-u's
;[/color]
iline -l @ex1 1 Line %i
inc %i
}
}
menu @ex1 {
lbclick : {
///echo -st LBCLICK $active : $1- : $line($active,$1,1)
sline -l $active $1
var %num = $gettok($line($active,$1,1),2,32)
var %rev = $chr(22)
while ($fline($active,$+(%rev,*),1,0)) { rline $active $v1 $mid($line($active,$v1,0),2) }
rline $active %num $+(%rev,$line($active,%num,0))
selectmiddleline %num
}
}
alias selectmiddleline {
var %x = $1, %wanted = $calc($window(@ex1).dh / 2 / $window(@ex1).fontsize) , %t, %text
window -hf @wrap -1 -1 $window(@ex1).dw $window(@ex1).dh
while $line(@ex1,%x) != $null {
%text = $v1
%t = $line(@wrap,0)
[color:blue]if ($asc($mid(%text,2)) != 31) { echo -h @wrap %text } | else { echo @wrap . }
;^ if second character on line is NOT a ctrl-u then it a wrapped line so display it, else just show a "." to represent a single line
; 2nd character as line might be the selected line being ctrl-R,ctrl-U,ctrl-U or an unselected line ctrl-U,ctrl-U
;[/color]
if $calc($line(@wrap,0) - %wanted) > 0 {
if ($v1 > $calc(%wanted - %t)) { dec %x }
sline -a @ex1 %x | sline -a @ex1 %x | sline -a @ex1 %x | close -@ @wrap | return
;^ still expreneced the odd aligment problem so simple /sline x3 to fix it.
;
}
inc %x
}
close -@ @wrap
sline -a @ex1 $line(@ex1,0) | sline -a @ex1 $line(@ex1,0) | sline -a @ex1 $line(@ex1,0)
;^ still expreneced the odd aligment problem so simple /sline x3 to fix it.
;
}