Remove Buffer::Rows() and the Line wrapper
The row cache rebuilt a string for every line of the file after each edit and had one production caller left (filetype detection in the ImGui frontend, which needs only the first line). Removed with it: rows_, nrows_, the dirty flag set on every edit, ensure_rows_cache and a mutex guarding only that cache. Tests read lines with GetLineString, Nrows or, where they compare every line, a test-only LinesForTests(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
This commit is contained in:
@@ -12,7 +12,7 @@ static std::string
|
||||
to_string_rows(const Buffer &buf)
|
||||
{
|
||||
std::string out;
|
||||
for (const auto &r: buf.Rows()) {
|
||||
for (const auto &r: buf.LinesForTests()) {
|
||||
out += static_cast<std::string>(r);
|
||||
out.push_back('\n');
|
||||
}
|
||||
@@ -46,7 +46,7 @@ TEST(ReflowParagraph_NumberedList_HangingIndent)
|
||||
const int width = 25;
|
||||
ASSERT_TRUE(Execute(ed, std::string("reflow-paragraph"), std::string(), width));
|
||||
|
||||
const auto &rows = buf->Rows();
|
||||
const auto &rows = buf->LinesForTests();
|
||||
ASSERT_TRUE(!rows.empty());
|
||||
const std::string dump = to_string_rows(*buf);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user