Skip to content

Commit

Permalink
#2946 spellchecker: remove obsolete checks
Browse files Browse the repository at this point in the history
  • Loading branch information
pbek committed Jan 18, 2024
1 parent 808c92e commit fdf3eaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# QOwnNotes Changelog

## 24.1.4
- the spellchecking menu will now also be shown on already selected words
(for [#2946](https://github.com/pbek/QOwnNotes/issues/2946))

## 24.1.3
- you now can also use <kbd>Ctrl</kbd> + <kbd>=</kbd> to increase the text size
in the note text edit (for [#2941](https://github.com/pbek/QOwnNotes/issues/2941))
Expand Down
18 changes: 5 additions & 13 deletions src/widgets/qownnotesmarkdowntextedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1076,30 +1076,22 @@ QMenu *QOwnNotesMarkdownTextEdit::spellCheckContextMenu(QPoint pos) {
wordSelectCursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor,
selectedWord.size());

const bool wordIsMisspelled = isMouseCursorInsideWord && spellchecker &&
const bool wordIsMisspelled = isMouseCursorInsideWord &&
spellchecker->isActive() && !selectedWord.isEmpty() &&
spellchecker->isWordMisspelled(selectedWord);

// Use standard context menu for already selected words, correctly spelled
// words and words inside quotes.
if (!wordIsMisspelled || selectedWordClicked) {
if (!wordIsMisspelled) {
return nullptr;
}

if (!selectedWordClicked) {
// If the user clicked on a misspelled word, select that word.
if (wordIsMisspelled) {
setTextCursor(wordSelectCursor);
}
// If the user clicked somewhere else, move the cursor there.
else {
setTextCursor(cursorAtMouse);
}
setTextCursor(wordSelectCursor);
cursor = textCursor();
}

// create the suggestion menu
QMenu *menu = new QMenu(this);
// Create the suggestion menu
auto *menu = new QMenu(this);
// Add the suggestions to the menu
const QStringList reps = spellchecker->suggestionsForWord(selectedWord, cursor, 8);
if (reps.isEmpty()) {
Expand Down

0 comments on commit fdf3eaf

Please sign in to comment.