commit a18cebf58eb8362115170f97262e9c56a14f57fe
parent e83abfecdbc4ccdf84d53a380b108877b11627cf
Author: Byron Torres <b@torresjrjr.com>
Date: Sun, 7 Jan 2024 19:59:11 +0000
tidy and simplify global matched
Diffstat:
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/global.ha b/global.ha
@@ -22,9 +22,8 @@ fn global(s: *Session, cmd: *Command, matched: bool) (void | Error) = {
for (let i = a; i <= b; i += 1) {
const line = s.buf.lines[i];
line.globalmark = false; // TODO: is this necessary?
- if (matched ^^ !regex::test(®ex, line.text)) {
+ if (matched == regex::test(®ex, line.text))
line.globalmark = true;
- };
};
let subcmds: []Command = [];
@@ -122,9 +121,8 @@ fn global_interactive(s: *Session, cmd: *Command, matched: bool) (void | Error)
for (let i = a; i <= b; i += 1) {
const line = s.buf.lines[i];
line.globalmark = false; // TODO: is this necessary?
- if (matched ^^ !regex::test(®ex, line.text)) {
+ if (matched == regex::test(®ex, line.text))
line.globalmark = true;
- };
};
let prevsubcmd: (void | Command) = void; // TODO: handle mem