mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-02 22:24:26 +00:00
cut: Don't skip final character when using byte or character ranges
This commit is contained in:
parent
f3fbcb28e7
commit
5070830acc
|
@ -130,7 +130,7 @@ static bool expand_list(ByteString& list, Vector<Range>& ranges)
|
|||
static void process_line_bytes(StringView line, Vector<Range> const& ranges)
|
||||
{
|
||||
for (auto& i : ranges) {
|
||||
if (i.m_from >= line.length())
|
||||
if (i.m_from > line.length())
|
||||
continue;
|
||||
|
||||
auto to = min(i.m_to, line.length());
|
||||
|
@ -143,7 +143,7 @@ static void process_line_bytes(StringView line, Vector<Range> const& ranges)
|
|||
static void process_line_characters(StringView line, Vector<Range> const& ranges)
|
||||
{
|
||||
for (auto const& range : ranges) {
|
||||
if (range.m_from >= line.length())
|
||||
if (range.m_from > line.length())
|
||||
continue;
|
||||
|
||||
auto s = String::from_utf8(line).release_value_but_fixme_should_propagate_errors();
|
||||
|
|
Loading…
Reference in a new issue