awesome-gocui / gocui

Minimalist Go package aimed at creating Console User Interfaces.
BSD 3-Clause "New" or "Revised" License
344 stars 39 forks source link

Added support for tcell.Screen.SetCursorStyle #114

Open Kavantix opened 2 years ago

Kavantix commented 2 years ago

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?

dankox commented 2 years ago

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". :)