mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 17:50:04 +01:00
[escher/layout_field] When pasting, force cursor right of pasted text
Even if the text is inserted code point per code point
This commit is contained in:
@@ -336,7 +336,7 @@ bool LayoutField::handleEventWithText(const char * text, bool indentation, bool
|
||||
if (resultExpression.isUninitialized()) {
|
||||
// The text is not parsable (for instance, ",") and is added char by char.
|
||||
KDSize previousLayoutSize = minimalSizeForOptimalDisplay();
|
||||
m_contentView.cursor()->insertText(text);
|
||||
m_contentView.cursor()->insertText(text, forceCursorRightOfText);
|
||||
reload(previousLayoutSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
void addEmptyTenPowerLayout();
|
||||
void addFractionLayoutAndCollapseSiblings();
|
||||
void addXNTCodePointLayout();
|
||||
void insertText(const char * text);
|
||||
void insertText(const char * text, bool forceCursorRightOfText = false);
|
||||
void addLayoutAndMoveCursor(Layout l);
|
||||
bool showEmptyLayoutIfNeeded() { return privateShowHideEmptyLayoutIfNeeded(true); }
|
||||
bool hideEmptyLayoutIfNeeded() { return privateShowHideEmptyLayoutIfNeeded(false); }
|
||||
|
||||
@@ -154,7 +154,7 @@ void LayoutCursor::addXNTCodePointLayout() {
|
||||
m_layout.addSibling(this, CodePointLayout::Builder(m_layout.XNTCodePoint()), true);
|
||||
}
|
||||
|
||||
void LayoutCursor::insertText(const char * text) {
|
||||
void LayoutCursor::insertText(const char * text, bool forceCursorRightOfText) {
|
||||
Layout newChild;
|
||||
Layout pointedChild;
|
||||
UTF8Decoder decoder(text);
|
||||
@@ -199,7 +199,7 @@ void LayoutCursor::insertText(const char * text) {
|
||||
codePoint = decoder.nextCodePoint();
|
||||
}
|
||||
}
|
||||
if (!pointedChild.isUninitialized() && !pointedChild.parent().isUninitialized()) {
|
||||
if (!forceCursorRightOfText && !pointedChild.isUninitialized() && !pointedChild.parent().isUninitialized()) {
|
||||
m_layout = pointedChild;
|
||||
m_position = Position::Right;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user