all repos — fae @ da7ed7453657b43bcb0023c26a5da7619494b4fc

A minuscule find and edit utility.

Minor changes.
h3rald h3rald@h3rald.com
Sun, 24 May 2015 13:00:21 +0200
commit

da7ed7453657b43bcb0023c26a5da7619494b4fc

parent

9f23c088dce9a005ba5f2c117b11ecece0923396

1 files changed, 3 insertions(+), 2 deletions(-)

jump to
M far.nimfar.nim

@@ -43,8 +43,8 @@ """

proc matchBounds(str, regex: string, start = 0): StringBounds = var c = cast[ptr array[0..9,Capture]](alloc0(sizeof(array[0..9, Capture]))) - var str = str.substr(start).cstring - let match = slre_match(("(" & regex & ")").cstring, str, str.len.cint, c, 10, 0) + var s = str.substr(start).cstring + let match = slre_match(("(" & regex & ")").cstring, s, s.len.cint, c, 10, 0) if match >= 0: result = [match-c[0].len+start, match-1+start] else:

@@ -79,6 +79,7 @@ if i < last and s[i+1] == '\10': inc(i)

elif s[i] == '\10': inc result inc i + inc result proc displayMatch(str: string, start, finish: int, color = fgYellow) = let context_start = max(start-10, 0)