test: Quote command variables in case these contain spaces
[dpkg.git] / dselect / pkgkeys.cc
blobddf4987fb1f835e7bf2a57122e6dbb7731c7ac06
1 /*
2 * dselect - Debian package maintenance user interface
3 * pkgkeys.cc - package list keybindings
5 * Copyright © 1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
7 * This is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 #include <config.h>
22 #include <compat.h>
24 #include <dpkg/dpkg-db.h>
26 #include "dselect.h"
27 #include "bindings.h"
29 const keybindings::interpretation packagelist_kinterps[] = {
30 { "up", nullptr, &packagelist::kd_up, qa_noquit },
31 { "down", nullptr, &packagelist::kd_down, qa_noquit },
32 { "top", nullptr, &packagelist::kd_top, qa_noquit },
33 { "bottom", nullptr, &packagelist::kd_bottom, qa_noquit },
34 { "scrollon", nullptr, &packagelist::kd_scrollon, qa_noquit },
35 { "scrollback", nullptr, &packagelist::kd_scrollback, qa_noquit },
36 { "iscrollon", nullptr, &packagelist::kd_iscrollon, qa_noquit },
37 { "iscrollback", nullptr, &packagelist::kd_iscrollback, qa_noquit },
38 { "scrollon1", nullptr, &packagelist::kd_scrollon1, qa_noquit },
39 { "scrollback1", nullptr, &packagelist::kd_scrollback1, qa_noquit },
40 { "iscrollon1", nullptr, &packagelist::kd_iscrollon1, qa_noquit },
41 { "iscrollback1", nullptr, &packagelist::kd_iscrollback1, qa_noquit },
42 { "panon", nullptr, &packagelist::kd_panon, qa_noquit },
43 { "panback", nullptr, &packagelist::kd_panback, qa_noquit },
44 { "panon1", nullptr, &packagelist::kd_panon1, qa_noquit },
45 { "panback1", nullptr, &packagelist::kd_panback1, qa_noquit },
46 { "install", nullptr, &packagelist::kd_select, qa_noquit },
47 { "remove", nullptr, &packagelist::kd_deselect, qa_noquit },
48 { "purge", nullptr, &packagelist::kd_purge, qa_noquit },
49 { "hold", nullptr, &packagelist::kd_hold, qa_noquit },
50 { "unhold", nullptr, &packagelist::kd_unhold, qa_noquit },
51 { "info", nullptr, &packagelist::kd_info, qa_noquit },
52 { "toggleinfo", nullptr, &packagelist::kd_toggleinfo, qa_noquit },
53 { "verbose", nullptr, &packagelist::kd_verbose, qa_noquit },
54 { "archdisplay", nullptr, &packagelist::kd_archdisplay, qa_noquit },
55 { "versiondisplay", nullptr, &packagelist::kd_versiondisplay, qa_noquit },
56 { "help", nullptr, &packagelist::kd_help, qa_noquit },
57 { "search", nullptr, &packagelist::kd_search, qa_noquit },
58 { "searchagain", nullptr, &packagelist::kd_searchagain, qa_noquit },
59 { "swaporder", nullptr, &packagelist::kd_swaporder, qa_noquit },
60 { "swapstatorder", nullptr, &packagelist::kd_swapstatorder, qa_noquit },
61 { "redraw", nullptr, &packagelist::kd_redraw, qa_noquit },
62 { "quitcheck", nullptr, &packagelist::kd_quit_noop, qa_quitchecksave },
63 { "quitrejectsug", nullptr, &packagelist::kd_revertdirect, qa_quitnochecksave },
64 { "quitnocheck", nullptr, &packagelist::kd_quit_noop, qa_quitnochecksave },
65 { "abortnocheck", nullptr, &packagelist::kd_revert_abort, qa_quitnochecksave },
66 { "revert", nullptr, &packagelist::kd_revert_abort, qa_noquit },
67 { "revertsuggest", nullptr, &packagelist::kd_revertsuggest, qa_noquit },
68 { "revertdirect", nullptr, &packagelist::kd_revertdirect, qa_noquit },
69 { "revertinstalled", nullptr, &packagelist::kd_revertinstalled, qa_noquit },
70 { nullptr, nullptr, nullptr, qa_noquit }
73 const keybindings::orgbinding packagelist_korgbindings[]= {
74 { 'j', "down" }, // vi style
75 { KEY_DOWN, "down" },
76 { 'k', "up" }, // vi style
77 { 'p', "up" },
78 { KEY_UP, "up" },
80 { 'N', "scrollon" },
81 { KEY_NPAGE, "scrollon" },
82 { ' ', "scrollon" },
83 { 'P', "scrollback" },
84 { KEY_PPAGE, "scrollback" },
85 { KEY_BACKSPACE, "scrollback" },
86 { 0177, "scrollback" }, // ASCII DEL
87 { CTRL('h'), "scrollback" },
88 { CTRL('n'), "scrollon1" },
89 { CTRL('p'), "scrollback1" },
91 { 't', "top" },
92 { KEY_HOME, "top" },
93 { 'e', "bottom" },
94 { KEY_LL, "bottom" },
95 { KEY_END, "bottom" },
97 { 'u', "iscrollback" },
98 { 'd', "iscrollon" },
99 { CTRL('u'), "iscrollback1" },
100 { CTRL('d'), "iscrollon1" },
102 { 'B', "panback" },
103 { KEY_LEFT, "panback" },
104 { 'F', "panon" },
105 { KEY_RIGHT, "panon" },
106 { CTRL('b'), "panback1" },
107 { CTRL('f'), "panon1" },
109 { '+', "install" },
110 { KEY_IC, "install" },
111 { '-', "remove" },
112 { KEY_DC, "remove" },
113 { '_', "purge" },
114 { 'H', "hold" },
115 { '=', "hold" },
116 { 'G', "unhold" },
118 { '?', "help" },
119 { KEY_HELP, "help" },
120 { KEY_F(1), "help" },
121 { 'i', "info" },
122 { 'I', "toggleinfo" },
123 { 'o', "swaporder" },
124 { 'O', "swapstatorder" },
125 { 'v', "verbose" },
126 { 'A', "archdisplay" },
127 { 'V', "versiondisplay" },
128 { CTRL('l'), "redraw" },
129 { '/', "search" },
130 { 'n', "searchagain" },
131 { '\\', "searchagain" },
133 { KEY_ENTER, "quitcheck" },
134 { '\r', "quitcheck" },
135 { 'Q', "quitnocheck" },
136 { 'x', "abortnocheck" },
137 { 'X', "abortnocheck" },
138 { 'R', "revert" },
139 { 'U', "revertsuggest" },
140 { 'D', "revertdirect" },
141 { 'C', "revertinstalled" },
143 { -1, nullptr }