[DEV] Update position on undo/redo & write char

This commit is contained in:
Edouard DUPIN 2013-11-27 21:45:56 +01:00
parent 14419a521b
commit 02c6e75822
3 changed files with 11 additions and 3 deletions

View File

@ -757,10 +757,12 @@ bool appl::TextViewer::write(const std::string& _data, const appl::Buffer::Itera
markToRedraw(); markToRedraw();
if (appl::textPluginManager::onWrite(*this, _pos, _data) == true) { if (appl::textPluginManager::onWrite(*this, _pos, _data) == true) {
// no call of the move cursor, because pluging might call theses function to copy and cut data... // no call of the move cursor, because pluging might call theses function to copy and cut data...
updateScrolling();
return true; return true;
} }
bool ret = m_buffer->write(_data, _pos); bool ret = m_buffer->write(_data, _pos);
appl::textPluginManager::onCursorMove(*this, m_buffer->cursor()); appl::textPluginManager::onCursorMove(*this, m_buffer->cursor());
updateScrolling();
return ret; return ret;
} }
@ -771,10 +773,12 @@ bool appl::TextViewer::replace(const std::string& _data, const appl::Buffer::Ite
markToRedraw(); markToRedraw();
if (appl::textPluginManager::onReplace(*this, _pos, _data, _posEnd) == true) { if (appl::textPluginManager::onReplace(*this, _pos, _data, _posEnd) == true) {
// no call of the move cursor, because pluging might call theses function to copy and cut data... // no call of the move cursor, because pluging might call theses function to copy and cut data...
updateScrolling();
return true; return true;
} }
bool ret = m_buffer->replace(_data, _pos, _posEnd); bool ret = m_buffer->replace(_data, _pos, _posEnd);
appl::textPluginManager::onCursorMove(*this, m_buffer->cursor()); appl::textPluginManager::onCursorMove(*this, m_buffer->cursor());
updateScrolling();
return ret; return ret;
} }

View File

@ -97,6 +97,7 @@ namespace appl {
return; return;
} }
m_buffer->removeSelection(); m_buffer->removeSelection();
updateScrolling();
} }
/** /**
@ -132,7 +133,9 @@ namespace appl {
if (m_buffer==NULL) { if (m_buffer==NULL) {
return false; return false;
} }
return m_buffer->write(_data, _pos); bool ret = m_buffer->write(_data, _pos);
updateScrolling();
return ret;
} }
/** /**
* @brief Write data at a specific position (No plugin call) * @brief Write data at a specific position (No plugin call)
@ -145,7 +148,9 @@ namespace appl {
if (m_buffer==NULL) { if (m_buffer==NULL) {
return false; return false;
} }
return m_buffer->replace(_data, _pos, _posEnd); bool ret = m_buffer->replace(_data, _pos, _posEnd);
updateScrolling();
return ret;
} }
appl::Buffer::Iterator getMousePosition(const vec2& _relativePos); appl::Buffer::Iterator getMousePosition(const vec2& _relativePos);

View File

@ -26,7 +26,6 @@ List of all thing to do to have a corect text editor :
|plop() | | |plop() | |
| | | | | |
+-------+------------+ +-------+------------+
- Undo / Redo modification position event (now undo but the windows is not update ...)
- Add workspace - Add workspace
- Add hexadecimal editor - Add hexadecimal editor
- Add a cocillage - Add a cocillage