Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow removing view cursor to "un-highlight" all lines #108

Closed
coloursofnoise opened this issue Nov 23, 2021 · 2 comments · Fixed by #110
Closed

Allow removing view cursor to "un-highlight" all lines #108

coloursofnoise opened this issue Nov 23, 2021 · 2 comments · Fixed by #110
Labels
enhancement New feature or request

Comments

@coloursofnoise
Copy link

Demonstrated using _examples/mouse.go

  • Current behaviour:
    gocui_mouse_bug
  • Desired behaviour:
    gocui_mouse_fixed

The fix displayed above was done by adding a View.RemoveCursor method to set the cursor position to (-1, -1), which was called during Gui.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.

@coloursofnoise coloursofnoise added the enhancement New feature or request label Nov 23, 2021
@dankox
Copy link

dankox commented Nov 24, 2021

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.

@coloursofnoise
Copy link
Author

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.

Kavantix added a commit to Kavantix/gocui that referenced this issue Dec 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants