Updates.
h3rald h3rald@h3rald.com
Tue, 03 Nov 2020 10:30:26 +0000
2 files changed,
8 insertions(+),
5 deletions(-)
M
fae.nim
→
fae.nim
@@ -68,8 +68,10 @@ let c = s.search(expr, options.flags)
if c.len > 0: let match = c[0] let mstart = s.find(match) - let mfinish = mstart + match.len - result = [mstart, mfinish] + let mfinish = mstart + match.len-1 + result = [mstart+start, mfinish+start] + echo match, start, "-----" + discard quit else: result = [-1, -1]@@ -133,7 +135,6 @@
proc displayMatch(str: string, start, finish: int, color = fgYellow, lineN: int, silent = false) = if silent: return - echo start, " - ", finish, "<<<" let max_extra_chars = 20 let context_start = max(start-max_extra_chars, 0) let context_finish = min(finish+max_extra_chars, str.len)@@ -198,10 +199,10 @@ lineN.inc
contentsLen = contents.len fileLines.add contents var match = matchBounds(contents, options.regex, 0, options) + var matchstart, matchend: int + var offset = 0 while match[0] >= 0: matchesN.inc - var offset = 0 - var matchstart, matchend: int matchstart = match[0] matchend = match[1] if options.substitute != "":@@ -221,6 +222,7 @@ fileLines[fileLines.high] = replacement
else: displayFile(f, silent = options.silent) displayMatch(contents, matchstart, matchend, fgYellow, lineN, silent = options.silent) + echo "match:", match, "matchend: ", matchend, "contents: ", contents match = matchBounds(contents, options.regex, matchend+offset+1, options) file.close() if (not options.test) and (options.substitute != "") and hasSubstitutions: