Window: do not manage undo groups when an inserter is active

This commit is contained in:
Maxime Coste 2011-12-21 18:56:32 +00:00
parent 913ee3f096
commit 6c817c8117

View File

@ -81,10 +81,15 @@ BufferIterator Window::cursor_iterator() const
}
void Window::erase()
{
if (m_current_inserter == nullptr)
{
scoped_undo_group undo_group(m_buffer);
erase_noundo();
}
else
erase_noundo();
}
void Window::erase_noundo()
{
@ -118,10 +123,15 @@ static DisplayCoord measure_string(const Window::String& string)
}
void Window::insert(const String& string)
{
if (m_current_inserter == nullptr)
{
scoped_undo_group undo_group(m_buffer);
insert_noundo(string);
}
else
insert_noundo(string);
}
void Window::insert_noundo(const String& string)
{
@ -131,10 +141,15 @@ void Window::insert_noundo(const String& string)
}
void Window::append(const String& string)
{
if (m_current_inserter == nullptr)
{
scoped_undo_group undo_group(m_buffer);
append_noundo(string);
}
else
append_noundo(string);
}
void Window::append_noundo(const String& string)
{
@ -144,12 +159,19 @@ void Window::append_noundo(const String& string)
}
void Window::replace(const std::string& string)
{
if (m_current_inserter == nullptr)
{
scoped_undo_group undo_group(m_buffer);
erase_noundo();
insert_noundo(string);
}
else
{
erase_noundo();
insert_noundo(string);
}
}
bool Window::undo()
{