forked from charmbracelet/bubbles
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle textinput max-width edge cases
I noticed that the cursor seemed to be adding an extra space which the width calculations weren't accounting for. This also led me to discover an edge case with the view (`offset`/`offsetRight`) calculation when the cursor (`pos`) sits at the very end. Additionally, `View()` was always rendering the cursor, even when `focus` was false, which the comment suggests should not be the case. These should all be resolved, such that Width is now fully respected in both `View()` and `placeholderView()`: they should _never_ render a string that exceeds the requested width. (Well... with one caveat: I did not touch the suggestion logic, as I've never used it. I did leave a comment, however, that perhaps suggestions shouldn't even render when the component does not have focus.) Fixes charmbracelet#358, charmbracelet#307
- Loading branch information
1 parent
eed309f
commit 0623a0c
Showing
1 changed file
with
50 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters