mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vrepl: add support for Home and End keys (#16116)
This commit is contained in:
@ -124,29 +124,6 @@ pub fn (_bytes []u8) utf8_to_utf32() ?rune {
|
||||
return res
|
||||
}
|
||||
|
||||
// Calculate length to read from the first byte
|
||||
fn utf8_len(c u8) int {
|
||||
mut b := 0
|
||||
mut x := c
|
||||
if (x & 240) != 0 {
|
||||
// 0xF0
|
||||
x >>= 4
|
||||
} else {
|
||||
b += 4
|
||||
}
|
||||
if (x & 12) != 0 {
|
||||
// 0x0C
|
||||
x >>= 2
|
||||
} else {
|
||||
b += 2
|
||||
}
|
||||
if (x & 2) == 0 {
|
||||
// 0x02
|
||||
b++
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// Calculate string length for formatting, i.e. number of "characters"
|
||||
// This is simplified implementation. if you need specification compliant width,
|
||||
// use utf8.east_asian.display_width.
|
||||
|
Reference in New Issue
Block a user