Revert part of 8c90b5fc6

`IO#readline` and `IO#readchar` process in character units.
This commit is contained in:
dearblue
2019-09-15 22:31:59 +09:00
parent 0734d9f314
commit 77368ce762
+9 -5
View File
@@ -253,12 +253,14 @@ class IO
break
end
if limit && limit <= @buf.bytesize
array.push IO._bufread(@buf, limit)
if limit && limit <= @buf.size
array.push @buf[0, limit]
@buf = @buf[limit, @buf.size - limit]
break
elsif idx = @buf.index(rs)
len = idx + rs.bytesize
array.push IO._bufread(@buf, len)
len = idx + rs.size
array.push @buf[0, len]
@buf = @buf[len, @buf.size - len]
break
else
array.push @buf
@@ -281,7 +283,9 @@ class IO
def readchar
_read_buf
IO._bufread(@buf, 1)
c = @buf[0]
@buf = @buf[1, @buf.size]
c
end
def getc