summaryrefslogtreecommitdiff
path: root/src/curses
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-10-23 01:12:31 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-10-23 01:12:31 +0900
commit4d709e0dd2c1dc677c4ca54dc8c6f8e17875d5fc (patch)
treefc163615ec1118ddf7d74e5f4c8f4c91d1353832 /src/curses
parentae04f56dbdc9cd635f5a3d56082faf2399d91f75 (diff)
downloadfzf-4d709e0dd2c1dc677c4ca54dc8c6f8e17875d5fc.tar.gz
Fix #391 - Strip non-printable characters
Diffstat (limited to 'src/curses')
-rw-r--r--src/curses/curses.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/curses/curses.go b/src/curses/curses.go
index 8311719e..9619925d 100644
--- a/src/curses/curses.go
+++ b/src/curses/curses.go
@@ -11,6 +11,7 @@ import "C"
import (
"fmt"
"os"
+ "strings"
"syscall"
"time"
"unicode/utf8"
@@ -514,7 +515,12 @@ func MoveAndClear(y int, x int) {
}
func Print(text string) {
- C.addstr(C.CString(text))
+ C.addstr(C.CString(strings.Map(func(r rune) rune {
+ if r < 32 {
+ return -1
+ }
+ return r
+ }, text)))
}
func CPrint(pair int, bold bool, text string) {