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

feat(table): add function to set cursor position #219

Merged
merged 1 commit into from Aug 31, 2022
Merged

feat(table): add function to set cursor position #219

merged 1 commit into from Aug 31, 2022

Conversation

nikaro
Copy link
Contributor

@nikaro nikaro commented Aug 20, 2022

This would allow to (re)set the cursor position after the table is updated.

nikaro added a commit to nikaro/zabbixmon that referenced this pull request Aug 20, 2022
@@ -291,6 +291,12 @@ func (m Model) Cursor() int {
return m.cursor
}

// SetCursor sets the cursor position in the table.
func (m *Model) SetCursor(n int) {
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if MoveTo is a better name, to match MoveUp and MoveDown.

Copy link
Contributor Author

@nikaro nikaro Aug 21, 2022

Choose a reason for hiding this comment

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

I used SetCursor since it matches with Cursor and the others Set* methods, and it literally sets the cursor attribute :-) But it's up to you, i don't have a preference on this, let me know if you want me to amend the commit.

Copy link
Member

@maaslalani maaslalani left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @nikaro

@maaslalani maaslalani merged commit afd6f58 into charmbracelet:master Aug 31, 2022
@nikaro nikaro deleted the feat/table/set-cursor branch August 31, 2022 07:38
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

2 participants