It seems there is some type of bug with sline positioning dependent on whats been done to the window and what line might have previously been selected.
Its a bit hard to explain so I created a short chunk of code to demonstrate it.
simple type /ex1
Use the side listbox and do the following
(1) click "line 10" , mainwindow line 10 highlights and is the bottom line (expected behavour)
(2) click "line 5" , mainwindow line 5 highlights and is near the bottom line, one visual line of line 6 shown (expected behavour)
(3) click "line 2" , mainwindow line 2 highlights and is near the bottom line, one visual line of line 3 shown (expected behavour)
(4) click "line 5" , mainwindow line 5 highlights but is the bottom line
(unexpected behavour)(4) click "line 5" , mainwindow line 5 highlights but is the bottom line
(unexpected behavour)The unexpected behavour can sometimes become far worse in the full script, in that part or all of the line i want highlighted and visual sometimes is off the bottom of the window.
The remarked line(s) *1 or *2 can be used to correct the problem, however it took me a while to track the problem down and implement this patch.
* the fact im doing /RLINE seems to be important, however the reverse coloring is not, as i have tested with no /RLINE and it acts as expected (no bug) but with /RLINE even with no contents change (no ctrl-r added) the bug appears, I have therorised that it is caused by some type of internal displacement list not being updated to reflect the rline update, totally guessing realy tho.
(I have also posted this in scripts and popups but not for the same thing, im asking if anyone knows how to center the highlighted line)
alias ex1 {
window -c @ex1
window -el20 @ex1
var %i = 1
while (%i <= 10) {
var %line, %j = 100
while (%j) { var %line = $+(%line,$chr(3),$calc(%j % 16) %i) | dec %j }
aline -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
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))
;*1 sline $active $line($active,0,0)
sline $active $calc(%num + 1)
;*2 sline $active $calc(%num + 1)
; sline $active $calc(%num + 1)
}
}