[GH-ISSUE #1014] Issue with setTranform in textArea #733

Closed
opened 2026-03-04 01:07:22 +03:00 by kerem · 5 comments
Owner

Originally created by @kirankn8 on GitHub (Aug 3, 2024).
Original GitHub issue: https://github.com/rivo/tview/issues/1014

@rivo I am trying to write a custom input handler which handles sensitive information, the setTranform function is not public due to which I am unable to utilize the functionality to mask sensitive information.
github.com/rivo/tview@65571ae51e/textarea.go (L1607C20-L1607C32)

Could you please fix it

Originally created by @kirankn8 on GitHub (Aug 3, 2024). Original GitHub issue: https://github.com/rivo/tview/issues/1014 @rivo I am trying to write a custom input handler which handles sensitive information, the setTranform function is not public due to which I am unable to utilize the functionality to mask sensitive information. https://github.com/rivo/tview/blob/65571ae51e71d29a5e8a0082667b778939cca29f/textarea.go#L1607C20-L1607C32 Could you please fix it
kerem closed this issue 2026-03-04 01:07:22 +03:00
Author
Owner

@rivo commented on GitHub (Aug 3, 2024):

That's what InputField and its SetMaskCharacter() function is for.

<!-- gh-comment-id:2266681740 --> @rivo commented on GitHub (Aug 3, 2024): That's what `InputField` and its [`SetMaskCharacter()`](https://pkg.go.dev/github.com/rivo/tview#InputField.SetMaskCharacter) function is for.
Author
Owner

@kirankn8 commented on GitHub (Aug 3, 2024):

yes @rivo , but when I try to write a custom inputField (because I have a custom design/logic) similar to the InputField, the textArea does not expose setTranform function. hence I cannot implement masking of password in my custom inputField

<!-- gh-comment-id:2267114938 --> @kirankn8 commented on GitHub (Aug 3, 2024): yes @rivo , but when I try to write a custom inputField (because I have a custom design/logic) similar to the InputField, the textArea does not expose setTranform function. hence I cannot implement masking of password in my custom inputField
Author
Owner

@rivo commented on GitHub (Aug 4, 2024):

I don't plan on making setTransform public. It's a hack to make password masking work in InputFields. But it's not a functionality that TextArea needs IMHO. In the grander scheme of things, TextArea might benefit from a way to format text, e.g. for colour coding, line numbers, or auto-formatting. But that's a huge undertaking and setTransform will not fit the bill, it will likely be removed at that point (which I can't if it's public). I haven't even begun to think about this.

I don't know what your "custom design/logic" is but I would suggest you build on top of InputField instead of TextArea. If you want to describe your customizations, I might be able to give you some pointers.

<!-- gh-comment-id:2267476583 --> @rivo commented on GitHub (Aug 4, 2024): I don't plan on making `setTransform` public. It's a hack to make password masking work in `InputField`s. But it's not a functionality that `TextArea` needs IMHO. In the grander scheme of things, `TextArea` might benefit from a way to format text, e.g. for colour coding, line numbers, or auto-formatting. But that's a huge undertaking and `setTransform` will not fit the bill, it will likely be removed at that point (which I can't if it's public). I haven't even begun to think about this. I don't know what your "custom design/logic" is but I would suggest you build on top of `InputField` instead of `TextArea`. If you want to describe your customizations, I might be able to give you some pointers.
Author
Owner

@kirankn8 commented on GitHub (Aug 4, 2024):

ok, understood. one of my requirement is I want to change the appearance of the input field from the box look (as seen in your examples https://github.com/rivo/tview/wiki/InputField) to something like this
Enter a number : [ ].

How could I approach this

<!-- gh-comment-id:2267615251 --> @kirankn8 commented on GitHub (Aug 4, 2024): ok, understood. one of my requirement is I want to change the appearance of the input field from the box look (as seen in your examples https://github.com/rivo/tview/wiki/InputField) to something like this `Enter a number : [ ]`. How could I approach this
Author
Owner

@kirankn8 commented on GitHub (Aug 4, 2024):

Nvm, I think I figured it out how to go about this. thank you for your quick response. I am closing this ticket.

<!-- gh-comment-id:2267650450 --> @kirankn8 commented on GitHub (Aug 4, 2024): Nvm, I think I figured it out how to go about this. thank you for your quick response. I am closing this ticket.
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#733
No description provided.