dpkg (1.2.12); priority=LOW
[dpkg.git] / dselect / pkgkeys.cc
blob198b040b05e0ac779839749c43f466492c071752
1 /*
2 * dselect - Debian GNU/Linux package maintenance user interface
3 * pkgkeys.cc - package list keybindings
5 * Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.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
9 * published by the Free Software Foundation; either version 2,
10 * or (at your option) any later version.
12 * This is distributed in the hope that it will be useful, but
13 * 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
18 * License along with this; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <stdio.h>
23 #include <string.h>
24 #include <ncurses.h>
25 #include <assert.h>
26 #include <signal.h>
28 extern "C" {
29 #include "config.h"
30 #include "dpkg.h"
31 #include "dpkg-db.h"
33 #include "dselect.h"
34 #include "bindings.h"
36 const keybindings::interpretation packagelist_kinterps[] = {
37 { "up", 0, packagelist::kd_up, qa_noquit },
38 { "down", 0, packagelist::kd_down, qa_noquit },
39 { "top", 0, packagelist::kd_top, qa_noquit },
40 { "bottom", 0, packagelist::kd_bottom, qa_noquit },
41 { "scrollon", 0, packagelist::kd_scrollon, qa_noquit },
42 { "scrollback", 0, packagelist::kd_scrollback, qa_noquit },
43 { "iscrollon", 0, packagelist::kd_iscrollon, qa_noquit },
44 { "iscrollback", 0, packagelist::kd_iscrollback, qa_noquit },
45 { "scrollon1", 0, packagelist::kd_scrollon1, qa_noquit },
46 { "scrollback1", 0, packagelist::kd_scrollback1, qa_noquit },
47 { "iscrollon1", 0, packagelist::kd_iscrollon1, qa_noquit },
48 { "iscrollback1", 0, packagelist::kd_iscrollback1, qa_noquit },
49 { "panon", 0, packagelist::kd_panon, qa_noquit },
50 { "panback", 0, packagelist::kd_panback, qa_noquit },
51 { "panon1", 0, packagelist::kd_panon1, qa_noquit },
52 { "panback1", 0, packagelist::kd_panback1, qa_noquit },
53 { "install", 0, packagelist::kd_select, qa_noquit },
54 { "remove", 0, packagelist::kd_deselect, qa_noquit },
55 { "purge", 0, packagelist::kd_purge, qa_noquit },
56 { "hold", 0, packagelist::kd_hold, qa_noquit },
57 { "unhold", 0, packagelist::kd_unhold, qa_noquit },
58 { "info", 0, packagelist::kd_info, qa_noquit },
59 { "toggleinfo", 0, packagelist::kd_toggleinfo, qa_noquit },
60 { "verbose", 0, packagelist::kd_verbose, qa_noquit },
61 { "versiondisplay", 0, packagelist::kd_versiondisplay, qa_noquit },
62 { "help", 0, packagelist::kd_help, qa_noquit },
63 { "search", 0, packagelist::kd_search, qa_noquit },
64 { "searchagain", 0, packagelist::kd_searchagain, qa_noquit },
65 { "swaporder", 0, packagelist::kd_swaporder, qa_noquit },
66 { "swapstatorder", 0, packagelist::kd_swapstatorder, qa_noquit },
67 { "redraw", 0, packagelist::kd_redraw, qa_noquit },
68 { "quitcheck", 0, packagelist::kd_quit_noop, qa_quitchecksave },
69 { "quitrejectsug", 0, packagelist::kd_revertdirect, qa_quitnochecksave },
70 { "quitnocheck", 0, packagelist::kd_quit_noop, qa_quitnochecksave },
71 { "abortnocheck", 0, packagelist::kd_revert_abort, qa_quitnochecksave },
72 { "revert", 0, packagelist::kd_revert_abort, qa_noquit },
73 { "revertsuggest", 0, packagelist::kd_revertsuggest, qa_noquit },
74 { "revertdirect", 0, packagelist::kd_revertdirect, qa_noquit },
75 { 0, 0, qa_noquit }
78 #define C(x) ((x)-'a'+1)
80 const keybindings::orgbinding packagelist_korgbindings[]= {
81 { 'j', "down" }, // vi style
82 { 'n', "down" },
83 { KEY_DOWN, "down" },
84 { 'k', "up" }, // vi style
85 { 'p', "up" },
86 { KEY_UP, "up" },
88 { 'N', "scrollon" },
89 { KEY_NPAGE, "scrollon" },
90 { ' ', "scrollon" },
91 { 'P', "scrollback" },
92 { KEY_PPAGE, "scrollback" },
93 { KEY_BACKSPACE, "scrollback" },
94 { 0177, "scrollback" }, // ASCII DEL
95 { C('h'), "scrollback" },
96 { C('n'), "scrollon1" },
97 { C('p'), "scrollback1" },
99 { 't', "top" },
100 { KEY_HOME, "top" },
101 { 'e', "bottom" },
102 { KEY_LL, "bottom" },
103 { KEY_END, "bottom" },
105 { 'u', "iscrollback" },
106 { 'd', "iscrollon" },
107 { C('u'), "iscrollback1" },
108 { C('d'), "iscrollon1" },
110 { 'B', "panback" },
111 { KEY_LEFT, "panback" },
112 { 'F', "panon" },
113 { KEY_RIGHT, "panon" },
114 { C('b'), "panback1" },
115 { C('f'), "panon1" },
117 { '+', "install" },
118 { KEY_IC, "install" },
119 { '-', "remove" },
120 { KEY_DC, "remove" },
121 { '_', "purge" },
122 { 'H', "hold" },
123 { '=', "hold" },
124 { 'G', "unhold" },
126 { '?', "help" },
127 { KEY_HELP, "help" },
128 { KEY_F(1), "help" },
129 { 'i', "info" },
130 { 'I', "toggleinfo" },
131 { 'o', "swaporder" },
132 { 'O', "swapstatorder" },
133 { 'v', "verbose" },
134 { 'V', "versiondisplay" },
135 { C('l'), "redraw" },
136 { '/', "search" },
137 { '\\', "searchagain" },
139 { KEY_ENTER, "quitcheck" },
140 { '\r', "quitcheck" },
141 { 'Q', "quitnocheck" },
142 { 'x', "abortnocheck" },
143 { 'X', "abortnocheck" },
144 { 'R', "revert" },
145 { 'U', "revertsuggest" },
146 { 'D', "revertdirect" },
148 { -1, 0 }