summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/tqlineedit.cpp14
-rw-r--r--src/widgets/tqtextedit.cpp16
2 files changed, 25 insertions, 5 deletions
diff --git a/src/widgets/tqlineedit.cpp b/src/widgets/tqlineedit.cpp
index 2267706d4..94cc54bc8 100644
--- a/src/widgets/tqlineedit.cpp
+++ b/src/widgets/tqlineedit.cpp
@@ -860,10 +860,18 @@ void TQLineEdit::backspace()
if ( d->hasSelectedText() ) {
d->removeSelectedText();
} else if ( d->cursor ) {
+ --d->cursor;
+ if ( d->maskData ) {
+ d->cursor = d->prevMaskBlank( d->cursor );
+ }
+ // second half of a surrogate, check if we have the first half as well,
+ // if yes delete both at once
+ if (d->cursor > 0 && d->text.at(d->cursor).isLowSurrogate() &&
+ d->text.at(d->cursor - 1).isHighSurrogate()) {
+ d->del(true);
--d->cursor;
- if ( d->maskData )
- d->cursor = d->prevMaskBlank( d->cursor );
- d->del( TRUE );
+ }
+ d->del(true);
}
d->finishChange( priorState );
}
diff --git a/src/widgets/tqtextedit.cpp b/src/widgets/tqtextedit.cpp
index cc88b3dd9..7ea000f21 100644
--- a/src/widgets/tqtextedit.cpp
+++ b/src/widgets/tqtextedit.cpp
@@ -1782,8 +1782,20 @@ void TQTextEdit::doKeyboardAction( KeyboardAction action )
undoRedoInfo.index = cursor->index();
undoRedoInfo.d->text = TQString::null;
}
- undoRedoInfo.d->text.insert( 0, cursor->paragraph()->at( cursor->index()-1 ), TRUE );
- undoRedoInfo.index = cursor->index()-1;
+ int cur_idx = cursor->index();
+ const TQTextParagraph *para = cursor->paragraph();
+ if (para->at(cur_idx - 1)->c.isLowSurrogate() && cur_idx > 1 &&
+ para->at(cur_idx - 2)->c.isHighSurrogate())
+ {
+ undoRedoInfo.d->text.insert( 0, para->at(cur_idx - 1), TRUE );
+ undoRedoInfo.d->text.insert( 0, para->at(cur_idx - 2), TRUE );
+ undoRedoInfo.index = cursor->index() - 2;
+ }
+ else
+ {
+ undoRedoInfo.d->text.insert( 0, para->at(cur_idx - 1), TRUE );
+ undoRedoInfo.index = cursor->index() - 1;
+ }
}
cursor->removePreviousChar();
lastFormatted = cursor->paragraph();