mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-06 07:02:09 -07:00
Do not print non-displayable characters
fzf used to print non-displayable characters (ascii code < 32) as '?', but we will simply ignore those characters with this patch, just like our terminals do. \n and \r are exceptions. They will be printed as a space character. TODO: \H should delete the preceding character, but this is not implemented. Related: #1253
This commit is contained in:
@@ -17,11 +17,12 @@ func RuneWidth(r rune, prefixWidth int, tabstop int) int {
|
||||
return tabstop - prefixWidth%tabstop
|
||||
} else if w, found := _runeWidths[r]; found {
|
||||
return w
|
||||
} else {
|
||||
w := Max(runewidth.RuneWidth(r), 1)
|
||||
_runeWidths[r] = w
|
||||
return w
|
||||
} else if r == '\n' || r == '\r' {
|
||||
return 1
|
||||
}
|
||||
w := runewidth.RuneWidth(r)
|
||||
_runeWidths[r] = w
|
||||
return w
|
||||
}
|
||||
|
||||
// Max returns the largest integer
|
||||
|
Reference in New Issue
Block a user