diff --git a/Libraries/LibLine/Editor.cpp b/Libraries/LibLine/Editor.cpp index 3fef7468de..c75db47dcd 100644 --- a/Libraries/LibLine/Editor.cpp +++ b/Libraries/LibLine/Editor.cpp @@ -226,9 +226,9 @@ bool Editor::load_history(const String& path) if (!history_file->open(Core::IODevice::ReadOnly)) return false; while (history_file->can_read_line()) { - auto b = history_file->read_line(1024); - // skip the newline and terminating bytes - add_to_history(String(reinterpret_cast(b.data()), b.size() - 2)); + auto buffer = history_file->read_line(1024); + // -1 to skip the newline character + add_to_history(String(reinterpret_cast(buffer.data()), buffer.size() - 1)); } return true; }