mirror of https://github.com/garabik/grc.git
fix infinite loop (closes #3)
This commit is contained in:
parent
1a2ff5c22d
commit
91f9c1b453
|
@ -24,7 +24,7 @@ regexp=(inet6?|netmask|broadcast)
|
|||
colours=cyan
|
||||
=======
|
||||
#flags
|
||||
regexp=(?<=[,<])[^,]*(?=[,>])
|
||||
regexp=(?<=[,<])[^,]+?(?=[,>])
|
||||
colours=blue
|
||||
=======
|
||||
# mtu
|
||||
|
|
|
@ -2,6 +2,7 @@ grc (1.8-1) unstable; urgency=low
|
|||
|
||||
* added support for Ki, Gi, Ti for df (thanks to Juraj Bednár)
|
||||
* added example aliases for bash (thanks to Juraj Bednár)
|
||||
* fix infinite loop if regexp matches but does not consume anything
|
||||
|
||||
-- Radovan Garabík <garabik@kassiopeia.juls.savba.sk> Mon, 16 Mar 2015 14:38:42 +0100
|
||||
|
||||
|
|
8
grcat
8
grcat
|
@ -185,7 +185,13 @@ while 1:
|
|||
break
|
||||
if currcount == "more":
|
||||
prevcount = "more"
|
||||
pos = m.end(0)
|
||||
newpos = m.end(0)
|
||||
# special case, if the regexp matched but did not consume anything,
|
||||
# advance the position by 1 to escape endless loop
|
||||
if newpos == pos:
|
||||
pos += 1
|
||||
else:
|
||||
pos = newpos
|
||||
else:
|
||||
prevcount = "once"
|
||||
pos = len(line)
|
||||
|
|
Loading…
Reference in New Issue