From cd52aaba13d5561c50abaf572353132f10e0a389 Mon Sep 17 00:00:00 2001 From: Niklas Hennigs Date: Wed, 7 Sep 2016 17:29:38 +0200 Subject: [PATCH 1/2] This fixes zyedidia/micro#329 Now all multi-byte characters are considered a wordchar --- cmd/micro/util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/micro/util.go b/cmd/micro/util.go index 8d68dbdc..a91295fe 100644 --- a/cmd/micro/util.go +++ b/cmd/micro/util.go @@ -65,7 +65,7 @@ func Max(a, b int) int { func IsWordChar(str string) bool { if len(str) > 1 { // Unicode - return false + return true } c := str[0] return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c == '_') From 956b1bdb3aaa96b316c103a58dde77267dfc84fd Mon Sep 17 00:00:00 2001 From: Niklas Hennigs Date: Wed, 7 Sep 2016 17:48:26 +0200 Subject: [PATCH 2/2] Missed the test for the last commit, now fixed --- cmd/micro/util_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/micro/util_test.go b/cmd/micro/util_test.go index e3d417d5..c3060ff5 100644 --- a/cmd/micro/util_test.go +++ b/cmd/micro/util_test.go @@ -50,15 +50,15 @@ func TestIsWordChar(t *testing.T) { if IsWordChar("_") == false { t.Errorf("IsWordChar(_) = false") } + if IsWordChar("ß") == false { + t.Errorf("IsWordChar(ß) = false") + } if IsWordChar("~") == true { t.Errorf("IsWordChar(~) = true") } if IsWordChar(" ") == true { t.Errorf("IsWordChar( ) = true") } - if IsWordChar("ß") == true { - t.Errorf("IsWordChar(ß) = true") - } if IsWordChar(")") == true { t.Errorf("IsWordChar()) = true") }