nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1ace812
)
text/flat: FlatText::char_to_byte_index shortcut length_of_char_at if possible
author
Jean Privat
<jean@pryen.org>
Fri, 4 Mar 2016 02:40:57 +0000
(21:40 -0500)
committer
Jean Privat
<jean@pryen.org>
Fri, 4 Mar 2016 02:59:15 +0000
(21:59 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>
lib/core/text/flat.nit
patch
|
blob
|
history
diff --git
a/lib/core/text/flat.nit
b/lib/core/text/flat.nit
index
200fdcf
..
2615304
100644
(file)
--- a/
lib/core/text/flat.nit
+++ b/
lib/core/text/flat.nit
@@
-55,7
+55,11
@@
redef class FlatText
var its = _items
if dpos == 1 then
- b += _items.length_of_char_at(b)
+ if its[b] & 0x80u8 == 0x00u8 then
+ b += 1
+ else
+ b += its.length_of_char_at(b)
+ end
_bytepos = b
_position = index
return b