summaryrefslogtreecommitdiff
path: root/src/buffer.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-01-28 13:04:55 +0000
committerMaxime Coste <mawww@kakoune.org>2017-01-28 13:04:55 +0000
commit072064407a6699d1168b7ac8919fea3056501a77 (patch)
tree66a5e8b27df6bdd7ccb7d349438f327cbc216ea8 /src/buffer.cc
parent1048036d3c165e0430820da27badd729d58ace5c (diff)
Remove hash from StringData
Maintaining the hash value of strings is not worth it as we only use it for buffer reload, but pay for it on any buffer modifications.
Diffstat (limited to 'src/buffer.cc')
-rw-r--r--src/buffer.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/buffer.cc b/src/buffer.cc
index 00506c7f..27556262 100644
--- a/src/buffer.cc
+++ b/src/buffer.cc
@@ -249,7 +249,7 @@ void Buffer::reload(StringView data, timespec fs_timestamp)
auto diff = find_diff(m_lines.begin(), m_lines.size(),
parsed_lines.lines.begin(), (int)parsed_lines.lines.size(),
[](const StringDataPtr& lhs, const StringDataPtr& rhs)
- { return lhs->hash == rhs->hash and lhs->strview() == rhs->strview(); });
+ { return lhs->strview() == rhs->strview(); });
auto it = m_lines.begin();
for (auto& d : diff)
@@ -476,7 +476,7 @@ BufferCoord Buffer::do_insert(BufferCoord pos, StringView content)
auto line_it = m_lines.begin() + (int)pos.line;
auto new_lines_it = new_lines.begin();
- if (not append_lines)
+ if (not append_lines) // replace first line with new first line
*line_it++ = std::move(*new_lines_it++);
m_lines.insert(line_it,