@@ -199,9 +199,9 @@ struct Buffer::Modification
199
199
200
200
Type type;
201
201
ByteCoord coord;
202
- SharedString content;
202
+ StringDataPtr content;
203
203
204
- Modification (Type type, ByteCoord coord, SharedString content)
204
+ Modification (Type type, ByteCoord coord, StringDataPtr content)
205
205
: type(type), coord(coord), content(std::move(content)) {}
206
206
207
207
Modification inverse () const
@@ -248,7 +248,7 @@ void Buffer::reload(StringView data, timespec fs_timestamp)
248
248
for (LineCount line = 0 ; line < d.len ; ++line)
249
249
m_current_undo_group.emplace_back (
250
250
Modification::Insert, cur_line + line,
251
- SharedString{ parsed_lines.lines [(int )(d.posB + line)]} );
251
+ parsed_lines.lines [(int )(d.posB + line)]);
252
252
253
253
m_changes.push_back ({ Change::Insert, it == m_lines.end (), cur_line, cur_line + d.len });
254
254
m_lines.insert (it, &parsed_lines.lines [d.posB ], &parsed_lines.lines [d.posB + d.len ]);
@@ -261,7 +261,7 @@ void Buffer::reload(StringView data, timespec fs_timestamp)
261
261
for (LineCount line = d.len -1 ; line >= 0 ; --line)
262
262
m_current_undo_group.emplace_back (
263
263
Modification::Erase, cur_line + line,
264
- SharedString{ m_lines.get_storage (cur_line + line)} );
264
+ m_lines.get_storage (cur_line + line));
265
265
266
266
it = m_lines.erase (it, it + d.len );
267
267
m_changes.push_back ({ Change::Erase, it == m_lines.end (), cur_line, cur_line + d.len });
@@ -433,7 +433,7 @@ ByteCoord Buffer::do_erase(ByteCoord begin, ByteCoord end)
433
433
434
434
void Buffer::apply_modification (const Modification& modification)
435
435
{
436
- StringView content = modification.content ;
436
+ StringView content = modification.content -> strview () ;
437
437
ByteCoord coord = modification.coord ;
438
438
439
439
kak_assert (is_valid (coord));
@@ -467,7 +467,7 @@ BufferIterator Buffer::insert(const BufferIterator& pos, StringView content)
467
467
if (content.empty ())
468
468
return pos;
469
469
470
- SharedString real_content;
470
+ StringDataPtr real_content;
471
471
if (pos == end () and content.back () != ' \n ' )
472
472
real_content = intern (content + " \n " );
473
473
else
@@ -478,7 +478,7 @@ BufferIterator Buffer::insert(const BufferIterator& pos, StringView content)
478
478
auto coord = pos == end () ? ByteCoord{line_count ()} : pos.coord ();
479
479
if (not (m_flags & Flags::NoUndo))
480
480
m_current_undo_group.emplace_back (Modification::Insert, coord, real_content);
481
- return {*this , do_insert (pos.coord (), real_content)};
481
+ return {*this , do_insert (pos.coord (), real_content-> strview () )};
482
482
}
483
483
484
484
BufferIterator Buffer::erase (BufferIterator begin, BufferIterator end)
0 commit comments