Skip to content

Added support for tcell.Screen.SetCursorStyle#114

Draft
Kavantix wants to merge 3 commits into
awesome-gocui:masterfrom
Kavantix:set-cursor-style
Draft

Added support for tcell.Screen.SetCursorStyle#114
Kavantix wants to merge 3 commits into
awesome-gocui:masterfrom
Kavantix:set-cursor-style

Conversation

@Kavantix

@Kavantix Kavantix commented Jan 2, 2022

Copy link
Copy Markdown

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?

Comment thread tcell_driver.go Outdated
Comment thread gui.go Outdated
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>

@dankox dankox left a comment

Copy link
Copy Markdown

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.

Comment thread go.mod
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
Copy Markdown

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.

@dankox dankox left a comment

Copy link
Copy Markdown

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

dankox commented Jun 15, 2022

Copy link
Copy Markdown

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.

3 participants