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 }
aline $iif($r(0,1),-p) @ex1 Line %i ----- %line
iline -l @ex1 1 Line %i
inc %i
}
}
menu @ex1 {
lbclick : {
///echo -st LBCLICK $active : $1- : $line($active,$1,1)
sline -l $active $1
;^ activate the select the listbox line
;
var %num = $gettok($line($active,$1,1),2,32)
;^ get the correct mainwindow linenumber (true code this is more complexe but results the same with %num being the line)
;
var %rev = $chr(22)
while ($fline($active,$+(%rev,*),1,0)) { rline $active $v1 $mid($line($active,$v1,0),2) }
;^ this removes any and all highlighted (reversed) lines in the mainwindow
;
rline $active %num $+(%rev,$line($active,%num,0))
;^ highlight (reverse) the selected line in the mainwindow
;
sline $active $line($active,0,0)
;^ This line is a patch to make the following line work correctly each time
;
sline $active $calc(%num + 1)
;^ This line selects the line following the highlighted line, thus makes the highlighted line appear near the bottom of the mainwindow
;
}
}