Closed coloursofnoise closed 2 years ago
This is quite a specific solution to specific problem. There is no restore cursor position after it's removed (when the view is activated thru other means than mouse) and it also doesn't work when user wants to keep the line highlighted for some reason. Although I'm not sure if the keep-highlighted actually works even now :)
I think the correct solution would be to implement something like gocui.MousePosition()
function, which can return mouse position on the screen which can be then used to check what View is underneath. This way, user can turn v.Highlighted
on and off as needed.
That sounds much more reasonable. I probably won't try to implement it until I'm a bit more familiar with the library so it's free for anyone else to do if they wish.
Demonstrated using
_examples/mouse.go
The fix displayed above was done by adding a
View.RemoveCursor
method to set the cursor position to(-1, -1)
, which was called duringGui.onKey
on the last view selected by the mouse. Patch File (as.txt
due to GitHub restrictions)This implementation is presumeably a bad idea due to setting the cursor position to an invalid point, so other ideas would be appreciated.