Add indent accessor to document_t

This commit is contained in:
Allan Odgaard
2013-07-29 10:11:51 +02:00
parent 585a32344a
commit 2ad22d7662
2 changed files with 22 additions and 0 deletions

View File

@@ -512,6 +512,23 @@ namespace document
return map;
}
void document_t::set_indent (text::indent_t const& indent)
{
if(_buffer)
_buffer->indent() = indent;
if(_indent != indent)
{
_indent = indent;
const_cast<document_t*>(this)->broadcast(callback_t::did_change_indent_settings);
}
}
text::indent_t const& document_t::indent () const
{
return _indent;
}
void document_t::setup_buffer ()
{
D(DBF_Document, bug("%s, %s\n", display_name().c_str(), _file_type.c_str()););

View File

@@ -227,6 +227,9 @@ namespace document
void set_disk_encoding (encoding::type const& encoding) { _disk_newlines = encoding.newlines(); _disk_encoding = encoding.charset(); _disk_bom = encoding.byte_order_mark(); }
encoding::type disk_encoding () const { return encoding::type(_disk_newlines, _disk_encoding, _disk_bom); }
void set_indent (text::indent_t const& indent);
text::indent_t const& indent () const;
encoding::type encoding_for_save_as_path (std::string const& path);
bool recent_tracking () const { return _recent_tracking && _path != NULL_STR; }
@@ -323,6 +326,8 @@ namespace document
std::string _disk_newlines;
bool _disk_bom;
text::indent_t _indent;
protected: // so that we can trigger the callback in unit tests
watch_ptr _file_watcher;
friend struct watch_t;