Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for issue #335 - reset cursor blink phase when user enters character #336

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix for issue #335 - reset cursor blink phase when user enters character
  • Loading branch information
bairesearch committed Oct 11, 2022
commit 0f0c9abe24f1dfc5f2b66b705d6514fa88a26fdc
8 changes: 2 additions & 6 deletions src/DocumentWidget.cpp
Original file line number Diff line number Diff line change
@@ -937,12 +937,8 @@ void DocumentWidget::movedCallback(TextArea *area) {
// Check for changes to read-only status and/or file modifications
checkForChangesToFile();

if (QTimer *const blinkTimer = area->cursorBlinkTimer()) {
if (!blinkTimer->isActive()) {
// Start blinking the caret again.
blinkTimer->start();
}
}
// Start blinking the caret again.
area->resetCursorBlink(false);
}

/**
18 changes: 18 additions & 0 deletions src/TextArea.cpp
Original file line number Diff line number Diff line change
@@ -7205,6 +7205,24 @@ void TextArea::addSmartIndentCallback(SmartIndentCallback callback, void *arg) {
smartIndentCallbacks_.emplace_back(callback, arg);
}

/*
** Sets the caret to on or off and restart the caret blink timer.
** This could be used by other modules to modify the caret's blinking.
*/
void TextArea::resetCursorBlink(bool startsBlanked)
{
if (cursorBlinkTimer_->isActive()) {
// Start blinking the caret again.
cursorBlinkTimer_->start();

if (startsBlanked) {
TextDBlankCursor();
} else {
unblankCursor();
}
}
}

bool TextArea::focusNextPrevChild(bool next) {

// Prevent tab from changing focus
1 change: 1 addition & 0 deletions src/TextArea.h
Original file line number Diff line number Diff line change
@@ -97,6 +97,7 @@ class TextArea final : public QAbstractScrollArea {
void addDragStartCallback(DragStartCallback callback, void *arg);
void addDragEndCallback(DragEndCallback callback, void *arg);
void addSmartIndentCallback(SmartIndentCallback callback, void *arg);
void resetCursorBlink(bool startsBlanked);

protected:
bool focusNextPrevChild(bool next) override;