11 Commits
Author SHA1 Message Date
Raphael 'kena' PossandMaas Lalani afb975b469 feat(textarea): make max width/height configurable 2023-05-01 13:06:34 -04:00
Raphael 'kena' PossandMaas Lalani ee382285e7 fix(textarea): fix data corruption after multi-line input
Previously, when inserting multiple lines of input at once, the underlying
Go data array was incorrectly shared in memory across multiple rows
of the textarea. This was causing input corruption, where a user trying
to modify one line would see their text added on the next line as well.

This patch fixes it.
2023-02-05 10:19:05 -08:00
Raphael 'kena' PossandMaas Lalani db06ae17d3 fix(textarea): support pastes that end with a newline character
My previous fix did not properly handle a multi-rune input that *ends*
with a newline character. In that case, the final newline was removed.

I found this using the test suite I built for textarea in bubbline at
https://github.com/knz/bubbline/tree/main/editline/internal/textarea/testdata.
2023-01-24 14:19:14 -05:00
Raphael 'kena' PossandMaas Lalani 53724e6a72 feat: bracketed paste in textarea + textinput
This also fixes a longstanding bug where newlines, tabs
or other control characters in the clipboard would cause
the input to be corrupted on paste.
2023-01-09 16:30:24 -05:00
Raphael 'kena' PossandMaas Lalani 85da9addba feat: make the paginator key bindings customizable 2022-10-07 12:49:15 -04:00
Raphael 'kena' PossandMaas Lalani 9a48dca003 feat: support key bindings in textinput like textarea 2022-10-07 11:27:19 -04:00
062b257e8c fix(cursor): apply TextStyle inline (#230)
Co-authored-by: Maas Lalani <maas@lalani.dev>
2022-09-07 16:05:25 -04:00
Raphael 'kena' PossandGitHub 278edd1c2b fix(viewport): properly truncate to size (#228)
There are many "interesting" cases:

- logical content is wider than display width (long lines).
  In this case, we truncate.
- logical content is smaller than display height (fewer lines
  than visible).
  In this case, we pad with empty lines up to the specified height.
- logical content is higher than display height (more lines than
  visible).
  In this case, we truncate.

- style specifies a width wider than the display width.
  In this case, we ignore the style width and
  fit in the display width.
- style specifies a height higher than the display height.
  Same as width, we ignore the style and fit in the display height.
- style specifies a narrower width or smaller height than the display.
  In this case we obey the style.
2022-09-02 12:50:33 -07:00
Raphael 'kena' PossandMaas Lalani 09e1f00349 textarea: support dynamic prompts
The dynamic prompt can be different on every line.
See for example:
[![asciicast](https://asciinema.org/a/iFBPBwoDZOzcoRJOgfmPk8ObH.svg)](https://asciinema.org/a/iFBPBwoDZOzcoRJOgfmPk8ObH)
2022-09-02 14:31:26 -04:00
Raphael 'kena' PossandMaas Lalani c099d31570 textarea: add some comments 2022-09-02 14:31:26 -04:00
Raphael 'kena' PossandMaas Lalani db2a8b4e16 textarea: new bindings for "go to begin" / "go to end" 2022-09-02 13:44:52 -04:00