Set buffer filename if it has none and it is written with an explicit filename

This commit is contained in:
josh committed 2018-03-20 21:23:11 -04:00
1 parent 8d158e4ed9
commit d93953a929
3 files changed
+12 -2

No files matched your search

+5
View File
@@ -487,3 +487,8 @@ EncodedString Buffer::get_string()
m_gap_buffer->compact();
return EncodedString(m_gap_buffer->address(0u), m_gap_buffer->size(), m_encoding);
}
void Buffer::set_filename(const std::string & filename)
{
m_filename = std::make_shared<std::string>(filename);
}
+1
View File
@@ -183,6 +183,7 @@ public:
void erase_code_point(const Buffer::Iterator & position);
void erase_range(const Buffer::Range & range);
std::shared_ptr<std::string> filename() const { return m_filename; }
void set_filename(const std::string & filename);
Iterator begin() const { return Iterator(this); }
std::shared_ptr<Iterator> beginp() const { return std::make_shared<Iterator>(this); }
Iterator end() const { return *m_eof_iterator; }