Commit 77368ce7 authored by dearblue's avatar dearblue

Revert part of 8c90b5fc

`IO#readline` and `IO#readchar` process in character units.
parent 0734d9f3
...@@ -253,12 +253,14 @@ class IO ...@@ -253,12 +253,14 @@ class IO
break break
end end
if limit && limit <= @buf.bytesize if limit && limit <= @buf.size
array.push IO._bufread(@buf, limit) array.push @buf[0, limit]
@buf = @buf[limit, @buf.size - limit]
break break
elsif idx = @buf.index(rs) elsif idx = @buf.index(rs)
len = idx + rs.bytesize len = idx + rs.size
array.push IO._bufread(@buf, len) array.push @buf[0, len]
@buf = @buf[len, @buf.size - len]
break break
else else
array.push @buf array.push @buf
...@@ -281,7 +283,9 @@ class IO ...@@ -281,7 +283,9 @@ class IO
def readchar def readchar
_read_buf _read_buf
IO._bufread(@buf, 1) c = @buf[0]
@buf = @buf[1, @buf.size]
c
end end
def getc def getc
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment