Skip to content

Commit

Permalink
allows ANY single character for a bookmark, while still enforcing boo…
Browse files Browse the repository at this point in the history
…kmarks specified by users are letters. (eteran#218)

Should help address issues raised in eteran#212
  • Loading branch information
eteran authored and 1div0 committed Dec 29, 2020
1 parent d7f223d commit 9f9948f
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3141,8 +3141,11 @@ void MainWindow::action_Shift_Replace_Again() {
*/
void MainWindow::action_Mark(DocumentWidget *document, const QString &mark) {

if (mark.size() != 1 || !mark[0].isLetter()) {
qWarning("NEdit: action requires a single-letter label");
// NOTE(eteran): as per discussion#212, bookmarks from macros
// might not be letters! So we have looser requirements here than
// the UI instigated version.
if (mark.size() != 1) {
qWarning("NEdit: action requires a single-character label");
QApplication::beep();
return;
}
Expand Down Expand Up @@ -3176,6 +3179,12 @@ void MainWindow::action_Mark(DocumentWidget *document) {
return;
}

if (result.size() != 1 || !result[0].isLetter()) {
qWarning("NEdit: action requires a single-letter label");
QApplication::beep();
return;
}

action_Mark(document, result);
}

Expand Down Expand Up @@ -3213,8 +3222,11 @@ void MainWindow::action_Goto_Mark(DocumentWidget *document, const QString &mark,

emit_event("goto_mark", mark);

if (mark.size() != 1 || !mark[0].isLetter()) {
qWarning("NEdit: action requires a single-letter label");
// NOTE(eteran): as per discussion#212, bookmarks from macros
// might not be letters! So we have looser requirements here than
// the UI instigated version.
if (mark.size() != 1) {
qWarning("NEdit: action requires a single-character label");
QApplication::beep();
return;
}
Expand Down Expand Up @@ -3245,6 +3257,12 @@ void MainWindow::action_Goto_Mark_Dialog(DocumentWidget *document, bool extend)
return;
}

if (result.size() != 1 || !result[0].isLetter()) {
qWarning("NEdit: action requires a single-letter label");
QApplication::beep();
return;
}

action_Goto_Mark(document, result, extend);
}

Expand Down

0 comments on commit 9f9948f

Please sign in to comment.