Let parse_lines ensure that there's at least 1 line with \n
This commit is contained in:
parent
f6e58e7271
commit
947e071066
|
@ -53,6 +53,9 @@ static ParsedLines parse_lines(StringView data)
|
|||
pos = eol + 1;
|
||||
}
|
||||
|
||||
if (res.lines.empty())
|
||||
res.lines.emplace_back(StringData::create({"\n"}));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -79,9 +82,6 @@ Buffer::Buffer(String name, Flags flags, StringView data,
|
|||
{
|
||||
ParsedLines parsed_lines = parse_lines(data);
|
||||
|
||||
if (parsed_lines.lines.empty())
|
||||
parsed_lines.lines.emplace_back(StringData::create({"\n"}));
|
||||
|
||||
#ifdef KAK_DEBUG
|
||||
for (auto& line : parsed_lines.lines)
|
||||
kak_assert(not (line->length == 0) and
|
||||
|
@ -245,9 +245,6 @@ void Buffer::reload(StringView data, timespec fs_timestamp)
|
|||
{
|
||||
ParsedLines parsed_lines = parse_lines(data);
|
||||
|
||||
if (parsed_lines.lines.empty())
|
||||
parsed_lines.lines.emplace_back(StringData::create({"\n"}));
|
||||
|
||||
const bool record_undo = not (m_flags & Flags::NoUndo);
|
||||
|
||||
commit_undo_group();
|
||||
|
|
Loading…
Reference in New Issue
Block a user