mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:47:35 +00:00
cut: Ignore trailing newline if present
This commit is contained in:
parent
da67d593d8
commit
e740489abd
1 changed files with 3 additions and 1 deletions
|
@ -241,8 +241,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
auto file = TRY(Core::InputBufferedFile::create(maybe_file.release_value()));
|
auto file = TRY(Core::InputBufferedFile::create(maybe_file.release_value()));
|
||||||
|
|
||||||
Array<u8, PAGE_SIZE> buffer;
|
Array<u8, PAGE_SIZE> buffer;
|
||||||
while (!file->is_eof()) {
|
while (TRY(file->can_read_line())) {
|
||||||
auto line = TRY(file->read_line(buffer));
|
auto line = TRY(file->read_line(buffer));
|
||||||
|
if (line == "\n" && TRY(file->can_read_line()))
|
||||||
|
break;
|
||||||
|
|
||||||
if (selected_bytes) {
|
if (selected_bytes) {
|
||||||
process_line_bytes(line, disjoint_ranges);
|
process_line_bytes(line, disjoint_ranges);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue