Window: add replace method
permits to replace selection by a string in a single undo step
This commit is contained in:
parent
a7309fbe87
commit
95f87a6694
|
@ -139,6 +139,14 @@ void Window::append_noundo(const String& string)
|
|||
scroll_to_keep_cursor_visible_ifn();
|
||||
}
|
||||
|
||||
void Window::replace(const std::string& string)
|
||||
{
|
||||
scoped_undo_group undo_group(m_buffer);
|
||||
erase_noundo();
|
||||
insert_noundo(string);
|
||||
}
|
||||
|
||||
|
||||
bool Window::undo()
|
||||
{
|
||||
return m_buffer.undo();
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
void erase();
|
||||
void insert(const String& string);
|
||||
void append(const String& string);
|
||||
void replace(const String& string);
|
||||
|
||||
const BufferCoord& position() const { return m_position; }
|
||||
DisplayCoord cursor_position() const;
|
||||
|
|
Loading…
Reference in New Issue
Block a user