ed

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

commit 3411c624b4fc926d0426ae41e65aca083faada01
parent 76e309f80c64bc2c34cc6ddccc224eb3a738c3bb
Author: Byron Torres <b@torresjrjr.com>
Date:   Thu,  2 Nov 2023 12:29:21 +0000

update per upstream hare stdlib

Diffstat:
Mcommand.ha | 26+++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/command.ha b/command.ha @@ -6,7 +6,7 @@ use os; use os::exec; use regex; use strings; -use strio; +use memio; type Command = struct { addrs: []Address, @@ -274,7 +274,7 @@ fn cmd_mark(s: *Session, cmd: *Command) (void | Error) = { // TODO: this should use ".suffix", not ".arg", and parse() should // handle this // TODO: check len, etc... - const mark = strings::runes(cmd.arg)[0]; + const mark = strings::torunes(cmd.arg)[0]; debug("cmd_mark(): mark={}", mark); :search { @@ -445,7 +445,7 @@ fn cmd_substitute(s: *Session, cmd: *Command) (void | Error) = { }; let iter = strings::iter(s.buf.lines[i].text); - let new = strio::dynamic(); defer io::close(&new)!; + let new = memio::dynamic(); defer io::close(&new)!; let start = 0z; let lbound = 0z; @@ -453,14 +453,14 @@ fn cmd_substitute(s: *Session, cmd: *Command) (void | Error) = { for (let j = 0z; j < len(results); j += 1) { lbound = results[j][0].start; rbound = results[j][0].end; - strio::concat(&new, strings::sub(old, start, lbound))!; - strio::concat(&new, replacement)!; + memio::concat(&new, strings::sub(old, start, lbound))!; + memio::concat(&new, replacement)!; start = rbound; }; - strio::concat(&new, strings::sub(old, rbound, strings::end))!; + memio::concat(&new, strings::sub(old, rbound, strings::end))!; let newline = alloc(Line { - text = strings::dup(strio::string(&new)), + text = strings::dup(memio::string(&new)!), ... }); @@ -551,7 +551,7 @@ fn cmd_linenumber(s: *Session, cmd: *Command) (void | Error) = { fn cmd_shellescape(s: *Session, cmd: *Command) (void | Error) = { let iter = strings::iter(cmd.arg); - let new = strio::dynamic(); defer io::close(&new)!; + let new = memio::dynamic(); defer io::close(&new)!; let preview = false; // handling '!!' @@ -560,7 +560,7 @@ fn cmd_shellescape(s: *Session, cmd: *Command) (void | Error) = { case void => return NoPrevShCmd; case let s: str => - strio::concat(&new, s)!; + memio::concat(&new, s)!; }; preview = true; } else { @@ -579,18 +579,18 @@ fn cmd_shellescape(s: *Session, cmd: *Command) (void | Error) = { case void => break; case let r: rune => - strio::appendrune(&new, r)!; + memio::appendrune(&new, r)!; }; case '%' => - strio::concat(&new, s.buf.filename)!; + memio::concat(&new, s.buf.filename)!; preview = true; case => - strio::appendrune(&new, r)!; + memio::appendrune(&new, r)!; }; }; }; - let shcmdline = strings::dup(strio::string(&new)); + let shcmdline = strings::dup(memio::string(&new)!); let shcmd = exec::cmd("sh", "-c", shcmdline)!; let pipe = exec::pipe();