nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c5a3751
)
text/ropes: Fixed `RopeBuffer::add` when dealing with something other than an ASCII...
author
Lucas Bajolet
<r4pass@hotmail.com>
Fri, 30 Oct 2015 15:23:45 +0000
(11:23 -0400)
committer
Lucas Bajolet
<r4pass@hotmail.com>
Fri, 6 Nov 2015 21:33:47 +0000
(16:33 -0500)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>
lib/core/text/ropes.nit
patch
|
blob
|
history
diff --git
a/lib/core/text/ropes.nit
b/lib/core/text/ropes.nit
index
c164529
..
bcfa7e5
100644
(file)
--- a/
lib/core/text/ropes.nit
+++ b/
lib/core/text/ropes.nit
@@
-463,14
+463,15
@@
class RopeBuffer
redef fun add(c) do
var rp = rpos
- if rp >= buf_size then
+ var remsp = buf_size - rp
+ var cln = c.u8char_len
+ if cln > remsp then
dump_buffer
rp = 0
end
- # TODO: Fix when supporting UTF-8
- ns[rp] = c.ascii
- rp += 1
- _bytelen += 1
+ ns.set_char_at(rp, c)
+ rp += cln
+ _bytelen += cln
rpos = rp
end