mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 16:34:30 +01:00
cmd/ncdu: use negative values for key runes
The previous version used values after the maximum Unicode code-point to encode a key. This could lead to an overflow since a key is a int16, a rune is int32 and the maximum Unicode code-point is larger than int16. A better solution is to simply use negative runes for keys.
This commit is contained in:
parent
a4c65532ea
commit
7672cde4f3
@ -1032,8 +1032,7 @@ outer:
|
||||
return nil
|
||||
}
|
||||
|
||||
// key returns a rune representing the key k. It is larger than the maximum Unicode code-point.
|
||||
// key returns a rune representing the key k. It is a negative value, to not collide with Unicode code-points.
|
||||
func key(k tcell.Key) rune {
|
||||
// This is the maximum possible Unicode code point. Anything greater fails to compile as a Go quoted rune literal.
|
||||
return '\U0010FFFF' + rune(k)
|
||||
return rune(-k)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user