Revert "[eshcer/layout_field] Factor handleEvent"

This reverts commit d1ebbc685d67702994aa3ef822886a681cee63b9.

There were problems in the calculation app for instance:
- Write 34 then press ans -> the cursor is not drawn right of ans, but
left.
- Write a large layout, go up in th history, then go back to edition:
the view is not scrolled to the cursor
This commit is contained in:
Léa Saviot
2020-01-22 15:46:14 +01:00
parent 8554bbd8c8
commit 40ed9b3557

View File

@@ -301,6 +301,8 @@ void LayoutField::reload(KDSize previousSize) {
if (m_delegate && previousSize.height() != newSize.height()) {
m_delegate->layoutFieldDidChangeSize(this);
}
m_contentView.cursorPositionChanged();
scrollToCursor();
markRectAsDirty(bounds());
}
@@ -401,11 +403,12 @@ bool LayoutField::handleEvent(Ion::Events::Event event) {
return false;
}
shouldRecomputeLayout = didHideLayouts || shouldRecomputeLayout;
if (shouldRecomputeLayout) {
if (!shouldRecomputeLayout) {
m_contentView.cursorPositionChanged();
scrollToCursor();
} else {
reload(previousSize);
}
m_contentView.cursorPositionChanged();
scrollToCursor();
return true;
}