Module: reefvision.widgets.textarea
Source: ./reefvision/widgets/textarea.reef
Overview
reefvision.widgets.textarea — multi-line editor (Wave 5)
object TextArea extends view.View. Lines stored separately; caret is (row, col). Vertical scroll via offset; last client column is the scrollbar hit-test when line_count > visible_rows (Task 8: client column, not window frame gutter).
MVP: ASCII printable insert; Enter splits; Backspace joins. Typing returns event_handled() (consumed, command 0). Insertion is Group.add.
Usage: let ed = new textarea.TextArea(cell.rect(0, 0, 48, 8), 128, 8, 100) ed.paste("hello\nworld") win.add(ed)
Objects
TextArea
Extends: view.View
Fields:
| Name | Type |
|---|---|
lines |
[string] |
capacity |
int |
line_count |
int |
caret_row |
int |
caret_col |
int |
offset |
int |
visible_rows |
int |
max_line_len |
int |
sb_dragging |
bool |
proc init(bounds: cell.Rect, max_lines: int, visible_rows: int, max_line_len: int)
Methods:
override shared fn wants_focus(): bool
override shared fn captures_mouse(): bool
shared fn line_count(): int
shared fn line(row: int): string
shared fn caret_row(): int
shared fn caret_col(): int
shared fn offset(): int
shared fn visible_rows(): int
shared fn max_lines(): int
shared fn max_line_len(): int
shared fn has_scrollbar(): bool
shared fn is_sb_dragging(): bool
exclusive proc clamp_caret()
exclusive proc ensure_visible()
exclusive proc scroll_by(delta: int)
exclusive proc set_caret(row: int, col: int)
exclusive proc paste(text: string)
shared fn text(): string
exclusive proc set_text(text: string)
override exclusive proc draw(buf: cell.CellBuffer, abs: cell.Rect, clip: cell.Rect, focused: bool, th: theme.Theme)
exclusive proc shift_lines_down(from: int)
exclusive proc shift_lines_up(from: int)
exclusive proc split_line_at_caret()
exclusive proc join_with_prev()
override exclusive fn handle_event(e: event.Event): view.EventResult
exclusive proc set_offset_from_y(abs_bounds: cell.Rect, y: int)
exclusive fn handle_mouse(e: event.Event): bool
Functions
fn max_lines_cap(): int
fn max_line_cap(): int
fn empty_line(): string
fn clamp_col(line: string, col: int): int
fn insert_char_line(line: string, col: int, cp: int, max_len: int): string
fn delete_before_line(line: string, col: int): string
fn delete_at_line(line: string, col: int): string
Generated by reefc doc