Skip to content

Commit

Permalink
Fix stringwidth build
Browse files Browse the repository at this point in the history
  • Loading branch information
zyedidia committed Feb 3, 2017
1 parent c3a165e commit 28af256
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/micro/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func StringWidth(str string, tabsize int) int {
switch ch {
case '\t':
ts := tabsize - (lineIdx % tabsize)
sw += ts - 1
sw += ts
lineIdx += ts
case '\n':
lineIdx = 0
Expand Down

2 comments on commit 28af256

@DanielPower
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still getting a stringWidth error on make test with the latest commit. Am I doing something wrong?

[daniel@daniel-thinkpad]: ~/Dropbox/Programming/Third Party/micro-master>$ make test
go get -d ./cmd/micro
go test ./cmd/micro
--- FAIL: TestStringWidth (0.00s)
	util_test.go:123: StringWidth 1 Failed. Got 6
	util_test.go:126: StringWidth 2 Failed. Got 5
	util_test.go:129: StringWidth 3 Failed. Got 5
	util_test.go:132: StringWidth 4 Failed. Got 10
	util_test.go:135: StringWidth 5 Failed. Got 10
FAIL
FAIL	_/home/daniel/Dropbox/Programming/Third_Party/micro-master/cmd/micro	0.007s
make: *** [Makefile:48: test] Error 1

@zyedidia
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this problem was caused by a change in the go-runewidth dependency. It seems that now that package counts tabs as having a string width of 0 instead of 1. Anyway, you'll need to update your dependencies for micro. You can run go get -u -d ./cmd/micro to do that (that will update all of them. You can also just go to $GOPATH/src/github.com/mattn/go-runewidth and git pull from there).

Please sign in to comment.