Commit Graph
114 Commits
Author SHA1 Message Date
Christian Rocha 56bbc4a1ba fix(textinput,textarea): don't draw real cusor when blurred 2025-06-03 08:37:20 -04:00
Christian Rocha e89dc94c85 chore!(cursor): improve naming around 'blinking' 2025-05-26 09:15:38 -04:00
Christian Rocha 0f113d10c4 chore(textarea,textinput/lint): use slices.Delete() 2025-05-26 09:15:38 -04:00
Christian Rocha 3cbcdd9249 chore(textinput): minor logic improvement with regard to cursors 2025-05-26 09:15:38 -04:00
Christian Rocha 8e84f33a49 fix!(textinput): cursor fixes and improvements
* Fix virtual cursor blinking
* Use getter and setter for styles
* Use getter and setter for virtual-real cursor management
2025-05-26 09:15:38 -04:00
Carlos Alexandro Becker bb6a2a461d Merge remote-tracking branch 'origin/master' into v2-exp 2025-04-14 11:07:20 -03:00
Andrey Nering 3e2a8caedb chore: fix lint warning 2025-04-10 10:33:29 -03:00
Carlos Alexandro Becker 9d2d5dfc71 Merge remote-tracking branch 'origin/master' into v2-exp 2025-03-31 14:20:56 -03:00
Carlos Alexandro BeckerandGitHub bd2a5b0c6a fix: golangci-lint 2 fixes (#769) 2025-03-31 14:18:18 -03:00
Carlos Alexandro Becker d5bc1ac332 Merge remote-tracking branch 'origin/master' into v2-exp-update
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2025-03-25 11:31:38 -03:00
bashbunniandGitHub 9e5365e0ec docs: add example for ValidateFunc (#705)
* docs(textinput): add ValidateFunc example

* chore: remove print statement

* chore: rename the -> this anonymous func
2025-03-25 10:51:14 -03:00
Andrey Nering fff86382cc chore(lint): remove custom min and max functions
These are now available as builtins.
2025-03-20 10:42:52 -03:00
Carlos Alexandro Becker 71493456d9 Merge remote-tracking branch 'origin/master' into v2-exp 2025-03-13 16:55:11 -03:00
Ayman Bagabas 59511a71e0 fix(textinput): account for width when calculating cursor position 2025-03-10 15:18:55 -04:00
Christian Rocha 739fec5f64 chore(input,textarea): return nil for cursors when using virtual cursors 2025-03-01 10:10:36 -05:00
Carlos Alexandro BeckerandGitHub 605d06c42b feat: real cursor in textinput (#727) 2025-02-07 10:48:26 -03:00
Carlos Alexandro BeckerandGitHub 64c16e990e feat(v2)!: update to go 1.22 (#724)
* feat(v2)!: update to go 1.22

* fix: ci

* fix: more
2025-02-05 10:00:01 -03:00
Christian Rocha 1fd9c2666a chore(textarea,cursor): simplify cursor API 2025-01-31 16:21:17 -05:00
Christian Rocha 9d5d140b3c chore(textarea,cursor): flesh out real cursor API 2025-01-31 16:21:17 -05:00
Pierre RossiandChristian Rocha 0f9e38c9a7 Don't render suggestions when textinput is not focused.
This can look confusing in forms otherwise.
2025-01-28 09:24:43 -05:00
Carlos Alexandro Becker fbe642df17 chore(deps): update 2025-01-14 15:34:37 -03:00
Carlos Alexandro Becker f28e78e6ab Merge remote-tracking branch 'origin/master' into v2-exp 2025-01-14 14:22:36 -03:00
8624776d45 fix(textinput): slicing outside cap (#532)
* textinput: fix slicing outside cap

* textinput: add test that makes slicing outside cap occur

* chore: tidy with gofmt

---------

Co-authored-by: bashbunni <bunni@bashbunni.dev>
2024-12-05 13:40:33 -08:00
Christian Rocha 591dfd528e chore(textinput): use a getter and setter for width 2024-10-31 15:02:05 -04:00
Christian Rocha 73fe314cc6 feat!(textinput): DefaultKeyMap is now a function; was formerly a global 2024-10-31 15:02:05 -04:00
Ayman Bagabas db64e3cd78 feat: update lipgloss to v2 2024-10-29 15:54:24 -04:00
Christian Rocha 57ac102802 chore(merge): branch 'master' into v2-mini-tidy 2024-10-24 15:22:16 -04:00
Christian Rocha 4e05c24fc4 chore: move runeutil and memoization into internal 2024-10-24 15:21:20 -04:00
Christian Rocha 358a6c58c8 chore(lint): fix and suppress all soft lint issues; update directives 2024-10-24 12:35:42 -04:00
Ayman Bagabas 287c9c4ffd chore: merge branch 'master' into v2-exp 2024-10-21 14:16:22 -04:00
David Luevano AlvaradoandChristian Rocha 4382fdf1c6 feat(textinput): expose matched suggestions and index 2024-09-19 14:16:51 -04:00
Ayman Bagabas 09242fdf67 refactor!: remove deprecated references
This removes all the `NewModel` functions from all the bubbles and any
deprecated fields and types.
2024-09-19 13:44:03 -04:00
Ayman Bagabas a2602f8509 feat!: v2: move to v2 module 2024-09-18 14:12:55 -04:00
Ayman Bagabas 0fdf5f5be5 feat: use bubbletea/v2 2024-09-18 14:09:58 -04:00
Ayman Bagabas a93bfef532 feat!: use bubbletea@v2-exp 2024-09-09 14:12:52 -04:00
Ayman BagabasandGitHub 11a9fccd58 chore: fix lint issues (#534) 2024-05-31 16:48:29 -04:00
Kevin MillerandMaas Lalani 63b0917193 fix textinput.CurrentSuggestion() panic
When suggestions are not yet set CurrentSuggestion() will panic. This change fixes that with a guard and returns an empty string when there is no current suggestion.
2024-04-22 14:20:02 -04:00
9030d22eec feat(textinput): do not block input on validation (#185)
* feat(textinput): do not block input on validation

This PR builds upon the excellent work in #167 and #114 and makes a
breaking change to the validation API.

Currently, validation will completely block text input if the Validate
function returns an error. This is now changed so the function no longer
blocks input if this is the case, thus handing this responsibility to
the clients.

This is helpful for cases where the user is requested to type an
existing system path, and the Validate function keeps asserting the
existence of the path. With the current implementation such a validation
is not possible.

For example:

    > /
    Err: nil

    > /t
    Err: /t: No such file or directory

    > /tm
    Err: /tm: No such file or directory

    > /tmp
    Err: nil

* fix: change name

---------

Co-authored-by: Maas Lalani <maas@lalani.dev>
2024-03-13 21:22:49 -04:00
Maas LalaniandGitHub 8a6f531287 feat: add ctrl+right and ctrl+left to perform WordBackward and WordForward actions (#387) 2024-03-04 11:00:05 -05:00
79cc9621d5 fix(textinput): out of range panic if no matched suggestions (#473)
* fix(textinput): out of range panic if no matched suggestions

* fix(textinput): out of bounds check

Co-authored-by: Maas Lalani <maas@lalani.dev>

---------

Co-authored-by: Maas Lalani <maas@lalani.dev>
2024-02-02 16:02:24 -05:00
Maas Lalani 6399027ab7 perf(textinput): use uniseg.StringWidth 2024-01-22 15:37:12 -05:00
naglisandMaas Lalani ec883029c8 refactor(textinput): reduce allocations
As the number of items in `suggestions` and `m.suggestions` is known,
we can use `make` with the expected size instead of appending, which
requires more allocations as the slice grows.
2024-01-08 12:07:49 -05:00
f36aa3c4b5 fix(textinput): Placeholder No Longer Changes Width + Paste Calculation (#451)
* Fix pasting calculations

Available length calculation now correctly trims pasted text.

* fix(textInput): Width padding added when placeholder is used

When `placeholder` is set, padding from `Width` was not added within the `placeholderView()` function.

* Adding missing 'm.'

* Maintain Width no matter placeholder size delta

* Fixed Math

* Added Comments

* fix: lint

---------

Co-authored-by: Donovan Hubbard <37090676+donovanhubbard@users.noreply.github.com>
Co-authored-by: Maas Lalani <maas@lalani.dev>
2023-12-23 16:02:26 -05:00
Maas LalaniandGitHub fc50558f4b Revert "fix: truncate textinput placeholder (#442)" (#450)
This reverts commit 9a0ff2ba4d.
2023-12-23 13:57:42 -05:00
9a0ff2ba4d fix: truncate textinput placeholder (#442)
Co-authored-by: Sean Banko <seanbanko@Seans-MacBook-Air.local>
2023-12-21 23:14:53 -05:00
lc-1010andChristian Rocha f53b3d9f61 fix: Unicode character encoding error 2023-09-28 10:29:30 -04:00
eda891258c Support suggestions and autocompletion in textinput (#407)
* migrate all autocomplete-work from old branch

* added support for multiple suggestions

* fix linter issues

* refactored to only offer matching suggestions for completion

* fix: SetSuggestions + Suggestions

* make: configuration behaviour configurable

* fix for double-width runes

* refactored all suggestions to be rune-arrays

also: accepting suggestions does not overwrite the already given input, rather appends

* fix: make suggestions and OnAcceptSuggestions unexported

* refactor: refreshingMatchingSuggestions -> updateSuggestions

---------

Co-authored-by: Maas Lalani <maas@lalani.dev>
2023-08-21 11:26:02 -04:00
remiposoandGitHub 9266653c39 Reset blink only when CursorBlink (#378) 2023-05-13 12:56:18 -04:00
Maas Lalani dc58240609 chore(lint): help msg unused param 2023-05-01 12:56:08 -04:00
Maas Lalani ab1f7134e4 fix: deprecate CursorStyle in favour of Cursor.Style 2023-04-08 14:19:53 -04:00