From 0fc9fc5f22f835bc300ca00de782c512f47622ee Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 20 Apr 2023 23:41:25 -0700 Subject: [PATCH] show how to load lines in editor --- reference.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/reference.md b/reference.md index 66685f7..999e22e 100644 --- a/reference.md +++ b/reference.md @@ -205,6 +205,9 @@ early warning if you break something. `x=right`. Wraps long lines at word boundaries where possible, or in the middle of words (no hyphenation yet) when it must. +* `state.lines = load_array(lines)` -- loads the editor state with the array + of `lines` + * `edit.quit()` -- calling this ensures any final edits are flushed to disk before the app exits. @@ -230,7 +233,9 @@ early warning if you break something. buffer. * `Text.redraw_all(state)` -- call this to clear and recompute any cached - state as the cursor moves and the buffer scrolls. + state as the cursor moves and the buffer scrolls. You shouldn't need to do + this for the most part, just run it after loading or modifying + `state.lines`. If you need more precise control, look at the comment at the top of `edit.initialize_state` in edit.lua. In brief, the widget contains an array of