Commit Graph

59 Commits

Author SHA1 Message Date
Raphael 'kena' Poss
9a48dca003 feat: support key bindings in textinput like textarea 2022-10-07 11:27:19 -04:00
Maas Lalani
d3aed22a41 Revert "chore: move cursor bubble to internal"
This reverts commit a4ed54327f.
2022-10-06 15:33:16 -04:00
Maas Lalani
d177512114 fix: set value moves cursor only when empty and at starting position 2022-10-06 11:42:29 -04:00
Tom Payne
72d87e4513
chore: Miscellaneous minor fixes (#243)
* chore: remove internal use of deprecated NewModel

* chore: miscellaneous comment fixes
2022-09-15 10:51:42 -04:00
Maas Lalani
a4ed54327f chore: move cursor bubble to internal 2022-09-14 15:45:51 -04:00
Maas Lalani
a99b55cda1
Delegate Cursor Logic to cursor bubble (#181)
* refactor: remove cursor logic from textinput
* chore: Add Deprecated Fields to avoid breaking changes
* fix: Ctrl+A and typing moves to end bug
2022-09-14 10:44:10 -04:00
Maas Lalani
8f65160828 fix: add ctrl+h to backspace text 2022-07-31 13:20:02 -04:00
Gabriel Nagy
588393fbf8 fix(textinput): set cursor on initial value
This reverts the code back to the logic from 4ce16e8 which fixed the
issue of the cursor not being moved when an initial value was set with
SetValue.

The fix regressed in 16053f4.
2022-07-05 09:16:19 -04:00
IllusionMan1212
e57fd292cc feat: added Validate function for textinput 2022-06-10 12:17:24 -04:00
Christian Rocha
a1e1b461b6 fix(textinput): support KeySpace in both present and future Bubble Tea versions
Closes #144
2022-05-29 08:25:34 -07:00
Austin Schey
e349920524 Add Blink method to textinput to return blink state 2022-03-01 07:35:21 -05:00
Christian Rocha
746834a7ce Add safety check in textinput's clamp 2022-01-20 13:23:58 -05:00
Christian Rocha
fd306528f9 Rename var in deleteWordRight in textinput for additional clarity 2022-01-20 13:23:58 -05:00
Christian Rocha
a4dc540f3d Re-add panic guard in deleteWordLeft in textinput, just in case 2022-01-20 13:23:58 -05:00
IllusionMan1212
151d1026dd fix(textinput): use old cursor pos and simplify logic 2022-01-19 18:31:55 -05:00
Christian Rocha
764fd321f6 Cleanup an old var 2022-01-19 12:31:50 -05:00
Christian Rocha
091c915462 Fix various godoc comments 2022-01-19 12:31:50 -05:00
IllusionMan1212
c426cb580b fix textinput infinite loop and panic
fixes infinite loop when deleting input that only contains whitespace
using deleteWordLeft()
fixes index out of range panic when deleting input that only contains
whitespace using deleteWordRight()
2022-01-11 12:27:57 -05:00
Christian Rocha
b35f96cd2d Deprecate NewModel() constructors; use New() instead 2022-01-11 11:26:13 -05:00
Christian Rocha
d06aa4aa48 Ensure that textinputs can only receive their own blink messages 2021-06-02 10:49:43 -04:00
Christian Rocha
10962af2f2 Textinput's focus method now returns a command to initiate cursor blink 2021-06-02 10:49:43 -04:00
Christian Rocha
5082ae6f31 Add API for blink, static and hidden cursor modes to textinput
Closes #53.
2021-06-02 10:49:43 -04:00
Christian Rocha
9449cc7e41 Don't allow word-based deletion when input is masked in textinput
alt+d and ctrl+w will now delete all the way to the beginning and end,
respectively, if EchoMode is not EchoNormal.
2021-04-26 12:03:57 -04:00
Christian Rocha
58a177394e Don't allow word-to-word movement when input is masked in textinput
When EchoMode is not set to EchoNormal, alt+left/alt+b and
alt+right/alt+b jumps to the beginning and the end, respectively, so as
not to reveal word breaks in the masked text.
2021-04-26 12:03:57 -04:00
Christian Rocha
f016c31d83 Add method for returning cursor position in textinput
Previously, Cursor was a member on the model that did absolutely
nothing.
2021-04-26 12:03:57 -04:00
Christian Rocha
74436326b9 Public cursor movement functions no longer return values in textinput
Previously, textinput.SetCursor, textinput.CursotStart, and
textinput.CursorEnd returned bools used interally for managing cursor
blinking. Those methods have been replaced with private counterparts.
2021-04-26 12:03:57 -04:00
Christian Rocha
0d5d7e5acd Remove deadcode + small comment on Lip Gloss 2021-04-13 17:09:23 -04:00
Christian Rocha
ddd48d9ab7 TextInput now uses Lip Gloss for styling 2021-04-13 17:09:23 -04:00
Christian Muehlhaeuser
b2f42066a2 Drop naked returns in textinput model
This actually uncovered a few ineffective assignments, particularly
in deleteWordRight.
2021-03-11 20:09:32 -05:00
Kiyon
f719cc8cb1 Reset cursor in SetValue when initial pos is 0 2021-03-09 10:21:17 -05:00
Christian Rocha
d02641f6b5 Update textinput for multi-char (IME) input in Bubble Tea master 2020-11-01 09:11:18 -05:00
Christian Rocha
9b47f26bdd
Doc and logic corrections per the linter 2020-10-28 21:27:15 -04:00
Christian Rocha
9c780011ff
Underpinnings for always-on and always-hidden cursor modes 2020-10-28 21:27:15 -04:00
Christian Rocha
8148e61443
Correct ^F/^B keybindings for forward/back cursor movement 2020-10-28 21:27:15 -04:00
Christian Rocha
ce7d8da084
Fix lock-up that could occur with cursor blinking
Note that to do this we've replaced the blink timer with a context.
2020-10-28 21:27:15 -04:00
Christian Rocha
d14fdf585c
Textinput Update and View functions are now methods on the model 2020-10-28 21:27:15 -04:00
Christian Rocha
bf7719e6c1
Handle paste via command/message since it's IO 2020-10-28 21:27:15 -04:00
Christian Rocha
1b530b293c
Reset blink timer when moving the cursor 2020-10-28 21:27:15 -04:00
Christian Muehlhaeuser
97020cd0d2
Support Alt-Backspace to delete previous word 2020-10-27 08:50:22 +01:00
Christian Muehlhaeuser
f58fead10d Support Ctrl-W and Alt-D to delete words left/right of cursor
Ctrl-W: deletes word left of cursor
Alt-D: deletes word right of cursor
2020-10-25 14:52:16 -04:00
Christian Rocha
703de11da4 Fix regression where cursor was misplaced after a paste 2020-10-24 19:51:13 -04:00
Christian Rocha
03461d6804 Fix panic when pasting into a textinput with no char limit 2020-10-24 19:51:13 -04:00
Christian Muehlhaeuser
a0fe547fdb Make textinput cursor visible whenever it changes its position
This improves the UX because you never lose track of the cursor
moving around while it's currently hidden.
2020-10-24 00:12:27 -04:00
Christian Rocha
bdd909a5d7 Textinput: bind home/end and fix behavior of delete key 2020-10-22 15:36:54 -04:00
Christian Muehlhaeuser
83b6a2205f
Add an EchoMode and EchoCharacter property to textinputs (#11)
EchoModes are:

- EchoNormal, displays text as is
- EchoPassword, displays EchoCharacter mask instead of actual characters
- EchoNone, displays nothing

Note that EchoOnEdit, which should displays character as they are entered and is otherwise identical to EchoPassword, is not yet implemented.
2020-10-21 18:17:41 -04:00
Christian Rocha
9c10cd0586
Remove unused ErrMsg type from textinput module 2020-10-15 18:52:36 -04:00
Christian Rocha
154f3763f7
textinput.View can just accept a textinput.Model argument 2020-10-15 18:43:08 -04:00
Christian Muehlhaeuser
f78a02cc29
Avoid unnecessary conversions 2020-08-22 12:41:37 +02:00
Christian Muehlhaeuser
9a4fbb3be1
Make golint happy 2020-08-22 12:41:09 +02:00
Christian Rocha
f11ca377f4
Add clipboard paste support to textarea 2020-07-23 11:53:58 -04:00