зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-08-28 11:36:17 +03:00
feat: add unicode-aware soft-wrap modes and wrapped rendering (#8)
* feat(textarea): add unicode-aware soft-wrap modes and wrapped rendering
- add WrapMode API/state: None, Word, Glyph, WordOrGlyph
- keep None behavior unchanged (horizontal scroll)
- implement wrapped render path with logical-to-visual row mapping
- add Unicode-aware wrapping via unicode-segmentation + unicode-width
- make wrap width tab-aware to prevent hidden text
- apply cursor-line style on wrapped continuation rows
- fix selection at soft-wrap boundaries (no synthetic highlighted space)
- add wrap-focused tests for long text, newlines, tabs, tiny widths, and line-number
continuations
* chore(release): bump to v0.9.0 and update README/CHANGELOG
Этот коммит содержится в:
18
README.md
18
README.md
@@ -385,6 +385,24 @@ Typing tab key inserts 2 spaces.
|
||||
textarea.set_tab_length(2);
|
||||
```
|
||||
|
||||
### Configure soft wrap mode
|
||||
|
||||
By default, soft wrapping is disabled and long lines are handled by horizontal scrolling. To enable soft wrapping, set
|
||||
`TextArea::set_wrap_mode()` with one of the supported modes.
|
||||
|
||||
```rust,ignore
|
||||
use tui_textarea::WrapMode;
|
||||
|
||||
textarea.set_wrap_mode(WrapMode::WordOrGlyph);
|
||||
```
|
||||
|
||||
Supported modes:
|
||||
|
||||
- `WrapMode::None`: Disable soft wrap (default behavior).
|
||||
- `WrapMode::Word`: Wrap only at word boundaries.
|
||||
- `WrapMode::Glyph`: Wrap at grapheme boundaries.
|
||||
- `WrapMode::WordOrGlyph`: Wrap at word boundaries with grapheme fallback for long words.
|
||||
|
||||
### Configure max history size
|
||||
|
||||
By default, past 50 modifications are stored as edit history. The history is used for undo/redo. To change how many past
|
||||
|
||||
Ссылка в новой задаче
Block a user