ed

[hare] The standard editor
Log | Files | Refs | README | LICENSE

commit 85c2713c7dbb77a98d847f1e067578e239c92d12
parent 9c424f72cc0e2c42ae646ed84f3dff3c22d50f7d
Author: Byron Torres <b@torresjrjr.com>
Date:   Sat,  6 Jan 2024 21:15:01 +0000

fix text input mem

Diffstat:
Mcommand.ha | 2+-
Mparse.ha | 6+++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/command.ha b/command.ha @@ -375,7 +375,7 @@ fn cmd_insert(s: *Session, cmd: *Command) (void | Error) = { for (let i = 0z; i < len(cmd.textinput); i += 1) { const l = alloc(Line{ text = cmd.textinput[i], ... }); - debug("cmd_append(): l.text={}", l.text); + debug("cmd_insert(): l.text={}", l.text); buf_insert(s.buf, n + i, l); }; diff --git a/parse.ha b/parse.ha @@ -66,14 +66,14 @@ fn parse(input: *bufio::scanner) (Command | ParseError | InteractionError) = { if (inputline == ".") break; - append(cmd.textinput, inputline); + append(cmd.textinput, strings::dup(inputline)); }; case 'q', 'v' => if (!strings::hassuffix(cmd.arg2, '\\')) yield; for (true) { - let inputstr = match (bufio::scan_line(input)?) { + let inputline = match (bufio::scan_line(input)?) { case let s: const str => yield s; case io::EOF => @@ -81,7 +81,7 @@ fn parse(input: *bufio::scanner) (Command | ParseError | InteractionError) = { }; // TODO: parse and append to .subcmds ? - append(cmd.textinput, inputstr); + append(cmd.textinput, strings::dup(inputline)); }; };