Skip to content

Commit

Permalink
Introduce "goto-title" operation which works like the "goto" command
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisschagt committed Oct 29, 2020
1 parent fb11be5 commit 87e37f6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/keycmds.dsv
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ home||HOME||Go to the first item in the list.
end||END||Go to the last item in the list.
macro-prefix||,||Initiate macro execution. The next key press selects the actual macro and runs it.
switch-focus||TAB||Switch focus between widgets. This is currently only applicable to the `filebrowser` and `dirbrowser` contexts.
goto-title||||Go to item whose title contains the specified string.
2 changes: 2 additions & 0 deletions include/keymap.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ enum Operation {
OP_SETTAG,
OP_SEARCH,
OP_GOTO_URL,
OP_GOTO_TITLE,
OP_ENQUEUE,
OP_REDRAW,
OP_CMDLINE,
Expand Down Expand Up @@ -122,6 +123,7 @@ enum Operation {
OP_INT_BM_END,
OP_INT_EDITFLAGS_END,
OP_INT_START_SEARCH,
OP_INT_GOTO_TITLE,

OP_INT_GOTO_URL,

Expand Down
15 changes: 15 additions & 0 deletions src/feedlistformaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,18 @@ bool FeedListFormAction::process_operation(Operation op,
qna, OP_INT_START_SEARCH, &searchhistory);
}
break;
case OP_GOTO_TITLE:
if (automatic) {
if (args->size() >= 1) {
qna_responses = {args[0]};
finished_qna(OP_INT_GOTO_TITLE);
}
} else {
std::vector<QnaPair> qna;
qna.push_back(QnaPair(_("Title: "), ""));
this->start_qna(qna, OP_INT_GOTO_TITLE);
}
break;
case OP_CLEARFILTER:
apply_filter = false;
do_redraw = true;
Expand Down Expand Up @@ -827,6 +839,9 @@ void FeedListFormAction::finished_qna(Operation op)
case OP_INT_START_SEARCH:
op_start_search();
break;
case OP_INT_GOTO_TITLE:
goto_feed(qna_responses[0]);
break;
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions src/keymap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ static const std::vector<OpDesc> opdescs = {
KM_FEEDLIST | KM_HELP | KM_ARTICLELIST | KM_ARTICLE
},
{OP_GOTO_URL, "goto-url", "#", _("Goto URL #"), KM_ARTICLE},
{OP_GOTO_TITLE, "goto-title", "", _("Goto item with title"), KM_FEEDLIST},
{OP_ENQUEUE, "enqueue", "e", _("Add download to queue"), KM_ARTICLE},
{
OP_RELOADURLS,
Expand Down
3 changes: 2 additions & 1 deletion test/keymap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ TEST_CASE(
if (i == OP_OPENALLUNREADINBROWSER ||
i == OP_MARKALLABOVEASREAD ||
i == OP_OPENALLUNREADINBROWSER_AND_MARK ||
i == OP_SAVEALL) {
i == OP_SAVEALL ||
i == OP_GOTO_TITLE) {
continue;
}
bool used_in_some_context = false;
Expand Down

0 comments on commit 87e37f6

Please sign in to comment.