* feat(textarea): add CursorPosition method
This returns the current cursor position accounting any soft-wrapped
lines and multi-rune characters.
* chore(textarea): redefine how real cursor properties are accessed (#714)
---------
Co-authored-by: Christian Rocha <christian@rocha.is>
This reduces the amount of styling needed for what's likely more common
use cases, such as using Styles.Base to apply a background color to the
entire field.
Add the capability to show a multiline placeholder. Some refactoring was
required to improve readability and improve logic.
End of line buffer character was only shown when line numbers were
displayed which requires some verification whether this is the intended
outcome. This change resolves this issue.
When setting the width of the textarea there were some issues
preventing this from working correctly. These problems included:
- If the maximum width needed to be used, the width of the textarea did
not take into account the prompt and line number width.
- The viewport width did not take into account the style width.
The entire function was confusing to understand and a refactor was
warranted.
As part of this refactor, the bugs mentioned above were fixed and the
code was simplified.
To verify that the logic works as expected, unit tests were expanded to
validate that setting the width works as expected.
Signed-off-by: Michael Lorant <michael.lorant@nine.com.au>
Add improved unit tests for textarea view function.
The end of buffer unit test was flawed and failed to properly check
whether the end of buffer character was in the correct location. This
test has been removed as this feature is now verified as part of these
test cases.
Signed-off-by: Michael Lorant <michael.lorant@nine.com.au>
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.
* fix(textarea): app would crash if deleteWordRight was called at the end
of line
* fix(textarea): deleteWordRight would work incorrectly
Co-authored-by: infastin <thecookied123@gmail.com>