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

Added support for tcell.Screen.SetCursorStyle #114

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Kavantix
Copy link

@Kavantix Kavantix commented Jan 2, 2022

This draft adds very basic support for the new SetCursorStyle feature of tcell (not yet released as far as I can see).
We probably want to be more declarative about this though.

@mjarkk @dankox any suggestions on how to make this nicer?

Perhaps it makes sense to add a CursorStyle field to View that people can set and we then update the cursor style depending on which view is the current view?

tcell_driver.go Outdated Show resolved Hide resolved
gui.go Outdated Show resolved Hide resolved
Kavantix and others added 2 commits January 2, 2022 15:24
Co-authored-by: Mark Kopenga <mkopenga@gmail.com>
Co-authored-by: Mark Kopenga <mkopenga@gmail.com>
Copy link

@dankox dankox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Nice feature.

Sorry for such late response on this one.

github.com/gdamore/tcell/v2 v2.4.0
github.com/mattn/go-runewidth v0.0.10
golang.org/x/text v0.3.3 // indirect
github.com/gdamore/tcell/v2 v2.4.1-0.20211227212015-3260e4ac4385
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this needs to be updated to 2.5.

Copy link

@dankox dankox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I didn't realize that the version doesn't match, so it needs to be updated.

Other than that, I like the design. There is not much to do to be honest. You set the style of cursor and that's it :) At least that's how I see it. The function makes sense.

@dankox
Copy link

dankox commented Jun 15, 2022

Perhaps it makes sense to add a CursorStyle field to View that people can set and we then update the cursor style depending on which view is the current view?

I like the function more, because that way you can change the style of cursor on fly and reflect specific ways of editing for example. If it would be set as a field it would feel a bit "permanent".

However, you have a point, that maybe it could be also per View. Maybe even keep both. Global one set on gocui and View one which would make the global one changed to view when a view is active (current).
But this could be added even later. This PR or at least this current implementation definitely makes sense to me. The view implementation can be a "cherry on top". :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants