ed

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

commit 307231e7325386b4c74130c8d4f65eb44bdd6776
parent db30ac46bf4bd6ce42f8b08495cc5643446ae202
Author: Byron Torres <b@torresjrjr.com>
Date:   Sun, 14 Jan 2024 22:33:05 +0000

cmd_mark(): improve suffix storage

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

diff --git a/command.ha b/command.ha @@ -12,6 +12,7 @@ type Command = struct{ addrs: []Address, linenums: []size, name: rune, + suffix: rune, printmode: PrintMode, arg1: str, arg2: str, @@ -293,8 +294,7 @@ fn cmd_mark(s: *Session, cmd: *Command) (void | Error) = { const n = get_linenum(cmd.linenums, s.buf.cursor); assert_nonzero(s, n)?; - // TODO: improve this - const mark = strings::torunes(cmd.arg1)[0]; + const mark = cmd.suffix; :clearmark { for (let i = 0z; i < len(s.buf.lines); i += 1) { diff --git a/parse.ha b/parse.ha @@ -127,7 +127,7 @@ fn parse_cmdargs(cmd: *Command, iter: *strings::iterator) (bool | ParseError) = case 'k' => match (strings::next(iter)) { case let r: rune => - cmd.arg1 = strings::fromrunes([r]); + cmd.suffix = r; case void => return ExpectedMark; }; @@ -325,7 +325,7 @@ fn scan_addr(iter: *strings::iterator) (Address | void) = { yield LastLine; case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' => strings::prev(iter); - yield scan_size(iter): size; + yield scan_size(iter); case '\'' => yield scan_mark(iter); case '/' =>