1
0
зеркало из https://github.com/glebtv/tui-textarea.git synced 2026-09-04 06:45:50 +03:00

Feat/textarea row measurement min max (#14)

* feat(textarea): add row measurement API with configurable min/max bounds

- add TextAreaMeasure and TextArea::measure(width_cols)
- make measurement wrap-aware and include block chrome rows
- add set_min_rows/set_max_rows (+ getters) with invariant normalization
- clamp preferred_rows to effective [min_rows, max_rows]
- export TextAreaMeasure at crate root
- switch examples/variable.rs to measured preferred_rows
- add integration tests for measure + min/max behavior

* chore(release): bump to v0.10.0 and update changelog
Этот коммит содержится в:
srothgan
2026-02-25 16:00:26 +01:00
коммит произвёл GitHub
родитель 56f531a73f
Коммит 1a64a949b6
6 изменённых файлов: 236 добавлений и 4 удалений

Просмотреть файл

@@ -29,7 +29,8 @@ fn main() -> io::Result<()> {
loop {
term.draw(|f| {
const MIN_HEIGHT: usize = 3;
let height = cmp::max(textarea.lines().len(), MIN_HEIGHT) as u16 + 2; // + 2 for borders
let measure = textarea.measure(f.area().width);
let height = cmp::max(measure.preferred_rows as usize, MIN_HEIGHT) as u16;
let chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([Constraint::Length(height), Constraint::Min(0)])