mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-27 17:13:40 +00:00
Clear formatting at the start of the field.
This commit is contained in:
parent
dfbe11efdb
commit
f334e2d0f4
@ -1122,6 +1122,7 @@ InputField::InputField(
|
||||
connect(_inner->document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(onDocumentContentsChange(int,int,int)));
|
||||
connect(_inner, SIGNAL(undoAvailable(bool)), this, SLOT(onUndoAvailable(bool)));
|
||||
connect(_inner, SIGNAL(redoAvailable(bool)), this, SLOT(onRedoAvailable(bool)));
|
||||
connect(_inner, SIGNAL(cursorPositionChanged()), this, SLOT(onCursorPositionChanged()));
|
||||
if (App::wnd()) connect(_inner, SIGNAL(selectionChanged()), App::wnd(), SLOT(updateGlobalMenu()));
|
||||
|
||||
const auto bar = _inner->verticalScrollBar();
|
||||
@ -1979,6 +1980,14 @@ void InputField::onDocumentContentsChange(
|
||||
}
|
||||
}
|
||||
|
||||
void InputField::onCursorPositionChanged() {
|
||||
auto cursor = textCursor();
|
||||
if (!cursor.hasSelection() && !cursor.position()) {
|
||||
cursor.setCharFormat(_defaultCharFormat);
|
||||
setTextCursor(cursor);
|
||||
}
|
||||
}
|
||||
|
||||
void InputField::chopByMaxLength(int insertPosition, int insertLength) {
|
||||
Expects(_correcting);
|
||||
|
||||
|
@ -289,6 +289,7 @@ private slots:
|
||||
void onTouchTimer();
|
||||
|
||||
void onDocumentContentsChange(int position, int charsRemoved, int charsAdded);
|
||||
void onCursorPositionChanged();
|
||||
|
||||
void onUndoAvailable(bool avail);
|
||||
void onRedoAvailable(bool avail);
|
||||
|
Loading…
Reference in New Issue
Block a user