dpkg (1.1.6); priority=MEDIUM
[dpkg.git] / dselect / methkeys.cc
blobc62947cb1f2daae41cac178929c5400f8cea54eb
1 /*
2 * dselect - Debian GNU/Linux package maintenance user interface
3 * methkeys.cc - method 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 methodlist_kinterps[] = {
37 { "up", methodlist::kd_up, 0, qa_noquit },
38 { "down", methodlist::kd_down, 0, qa_noquit },
39 { "top", methodlist::kd_top, 0, qa_noquit },
40 { "bottom", methodlist::kd_bottom, 0, qa_noquit },
41 { "scrollon", methodlist::kd_scrollon, 0, qa_noquit },
42 { "scrollback", methodlist::kd_scrollback, 0, qa_noquit },
43 { "iscrollon", methodlist::kd_iscrollon, 0, qa_noquit },
44 { "iscrollback", methodlist::kd_iscrollback, 0, qa_noquit },
45 { "scrollon1", methodlist::kd_scrollon1, 0, qa_noquit },
46 { "scrollback1", methodlist::kd_scrollback1, 0, qa_noquit },
47 { "iscrollon1", methodlist::kd_iscrollon1, 0, qa_noquit },
48 { "iscrollback1", methodlist::kd_iscrollback1, 0, qa_noquit },
49 { "panon", methodlist::kd_panon, 0, qa_noquit },
50 { "panback", methodlist::kd_panback, 0, qa_noquit },
51 { "panon1", methodlist::kd_panon1, 0, qa_noquit },
52 { "panback1", methodlist::kd_panback1, 0, qa_noquit },
53 { "help", methodlist::kd_help, 0, qa_noquit },
54 { "search", methodlist::kd_search, 0, qa_noquit },
55 { "searchagain", methodlist::kd_searchagain, 0, qa_noquit },
56 { "redraw", methodlist::kd_redraw, 0, qa_noquit },
57 { "select-and-quit", methodlist::kd_quit, 0, qa_quitchecksave },
58 { "abort", methodlist::kd_abort, 0, qa_quitnochecksave },
59 { 0, 0, qa_noquit }
62 #define C(x) ((x)-'a'+1)
64 const keybindings::orgbinding methodlist_korgbindings[]= {
65 { 'j', "down" }, // vi style
66 { 'n', "down" },
67 { KEY_DOWN, "down" },
68 { 'k', "up" }, // vi style
69 { 'p', "up" },
70 { KEY_UP, "up" },
72 { C('f'), "scrollon" }, // vi style
73 { 'N', "scrollon" },
74 { KEY_NPAGE, "scrollon" },
75 { ' ', "scrollon" },
76 { C('b'), "scrollback" }, // vi style
77 { 'P', "scrollback" },
78 { KEY_PPAGE, "scrollback" },
79 { KEY_BACKSPACE, "scrollback" },
80 { 0177,/*DEL*/ "scrollback" },
81 { C('h'), "scrollback" },
82 { C('n'), "scrollon1" },
83 { C('p'), "scrollback1" },
85 { 't', "top" },
86 { KEY_HOME, "top" },
87 { 'e', "bottom" },
88 { KEY_LL, "bottom" },
89 { KEY_END, "bottom" },
91 { 'u', "iscrollback" },
92 { 'd', "iscrollon" },
93 { C('u'), "iscrollback1" },
94 { C('d'), "iscrollon1" },
96 { 'B', "panback" },
97 { KEY_LEFT, "panback" },
98 { 'F', "panon" },
99 { KEY_RIGHT, "panon" },
100 { C('b'), "panback1" },
101 { C('f'), "panon1" },
103 { '?', "help" },
104 { KEY_HELP, "help" },
105 { KEY_F(1), "help" },
106 { '/', "search" },
107 { '\\', "searchagain" },
108 { C('l'), "redraw" },
110 { KEY_ENTER, "select-and-quit" },
111 { '\r', "select-and-quit" },
112 { 27, "abort" }, // esc
113 { 'x', "abort" },
114 { 'X', "abort" },
116 { -1, 0 }