ed

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

commit 3354f41adc477539f2763576bb3140071dd9b7d6
parent effb6ef4458ee0a0dc605d5e620232990ae0859a
Author: Byron Torres <b@torresjrjr.com>
Date:   Mon,  8 Jan 2024 20:30:30 +0000

amend cmd_shellescape() % parsing

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

diff --git a/command.ha b/command.ha @@ -636,18 +636,22 @@ fn cmd_shellescape(s: *Session, cmd: *Command) (void | Error) = { break; case let r: rune => switch (r) { - case '\\' => - match (strings::next(&iter)) { - case void => - break; - case let r: rune => - memio::appendrune(&new, r)!; - }; + case => + memio::appendrune(&new, r)!; case '%' => + if (strings::prev(&iter) == '\\') { + strings::next(&iter); + memio::appendrune(&new, '%')!; + continue; + } else { + strings::next(&iter); + }; + + if (s.buf.filename == "") + return NoFilename; + memio::concat(&new, s.buf.filename)!; preview = true; - case => - memio::appendrune(&new, r)!; }; }; };