[GH-ISSUE #124] Feature request: Methods to manually get/set TextView.lineOffset #96

Closed
opened 2026-03-04 01:01:53 +03:00 by kerem · 6 comments
Owner

Originally created by @albertito on GitHub (May 26, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/124

Hi!

I am using TextView to implement a "less with links", using regions and highlights, as part of a bigger application.

One think I keep running into is that I'd like to be able to manually get and set the lineOffset, so I can control the position from my application based on external input (and not only user's key movements).

This would also allow me to implement some usability tweaks (such as when the user presses "tab", I can highlight the next viewable region).

Do you think this would be reasonable?

Thanks!

Originally created by @albertito on GitHub (May 26, 2018). Original GitHub issue: https://github.com/rivo/tview/issues/124 Hi! I am using TextView to implement a "less with links", using regions and highlights, as part of a bigger application. One think I keep running into is that I'd like to be able to manually get and set the lineOffset, so I can control the position from my application based on external input (and not only user's key movements). This would also allow me to implement some usability tweaks (such as when the user presses "tab", I can highlight the next _viewable_ region). Do you think this would be reasonable? Thanks!
kerem closed this issue 2026-03-04 01:01:54 +03:00
Author
Owner

@rivo commented on GitHub (May 28, 2018):

I added ScrollTo() to the TextView primitive. Could you have a look and let me know if this works for you?

<!-- gh-comment-id:392591079 --> @rivo commented on GitHub (May 28, 2018): I added `ScrollTo()` to the `TextView` primitive. Could you have a look and let me know if this works for you?
Author
Owner

@albertito commented on GitHub (Jul 25, 2018):

Thanks for implementing that!

It helps, but what do you think about adding a method like GetPosition to get the current row?

I think the two combined would let me implement the behaviour I am after.
Of course, I'm happy to send patches!

Thanks!

<!-- gh-comment-id:407907739 --> @albertito commented on GitHub (Jul 25, 2018): Thanks for implementing that! It helps, but what do you think about adding a method like GetPosition to get the current row? I think the two combined would let me implement the behaviour I am after. Of course, I'm happy to send patches! Thanks!
Author
Owner

@rivo commented on GitHub (Jul 27, 2018):

You mean you need a function that returns the current scroll position? Like GetScrollOffset()?

<!-- gh-comment-id:408438040 --> @rivo commented on GitHub (Jul 27, 2018): You mean you need a function that returns the current scroll position? Like `GetScrollOffset()`?
Author
Owner

@albertito commented on GitHub (Jul 28, 2018):

Yes, a function that returns t.lineOffset.

<!-- gh-comment-id:408591842 --> @albertito commented on GitHub (Jul 28, 2018): Yes, a function that returns t.lineOffset.
Author
Owner

@rivo commented on GitHub (Jul 28, 2018):

I just added that function. See GetScrollOffset().

<!-- gh-comment-id:408630143 --> @rivo commented on GitHub (Jul 28, 2018): I just added that function. See [`GetScrollOffset()`](https://godoc.org/github.com/rivo/tview#TextView.GetScrollOffset).
Author
Owner

@albertito commented on GitHub (Jul 29, 2018):

Great, thanks a lot!

<!-- gh-comment-id:408666873 --> @albertito commented on GitHub (Jul 29, 2018): Great, thanks a lot!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#96
No description provided.