Skip to content

Commit

Permalink
fix percents in output: concat is bad :)
Browse files Browse the repository at this point in the history
  • Loading branch information
piranha committed Sep 4, 2014
1 parent b23887f commit ba1627f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 5 additions & 4 deletions goreplace.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

const (
Author = "Alexander Solovyov"
Version = "2.2"
Version = "2.3"
)

var byteNewLine = []byte("\n")
Expand Down Expand Up @@ -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)
}
}

Expand Down
9 changes: 9 additions & 0 deletions tests/main.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..

0 comments on commit ba1627f

Please sign in to comment.