diff --git a/goreplace.go b/goreplace.go index 0872eb2..13836fb 100644 --- a/goreplace.go +++ b/goreplace.go @@ -17,7 +17,7 @@ import ( const ( Author = "Alexander Solovyov" - Version = "2.2" + Version = "2.3" ) var byteNewLine = []byte("\n") @@ -284,9 +284,10 @@ func (v *GRVisitor) SearchFile(fn string, content []byte) { }) v.printer.FilePrintf(fn, - "@!@y" + idxFmt + "@|" + colored + "\n", - idxFmt + colored + "\n", - info.num) + "@!@y" + idxFmt + "@|%s\n", + idxFmt + "%s\n", + info.num, + colored) } } diff --git a/tests/main.t b/tests/main.t index e6c9a2b..7d60cb0 100644 --- a/tests/main.t +++ b/tests/main.t @@ -82,3 +82,12 @@ Check that .* matches only files starting with dot: notignore 1:qwe $ cd .. + +Check that percents don't do anything bad: + + $ mkdir percent && cd percent + $ echo 'hello %username%' > one + $ gr user + one + 1:hello %username% + $ cd ..