methkeys.cc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * dselect - Debian GNU/Linux package maintenance user interface
  3. * methkeys.cc - method list keybindings
  4. *
  5. * Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
  6. *
  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.
  11. *
  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.
  16. *
  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.
  20. */
  21. #include <stdio.h>
  22. #include <string.h>
  23. #include <assert.h>
  24. extern "C" {
  25. #include <config.h>
  26. #include <dpkg.h>
  27. #include <dpkg-db.h>
  28. }
  29. #include "dselect.h"
  30. #include "bindings.h"
  31. const keybindings::interpretation methodlist_kinterps[] = {
  32. { "up", &methodlist::kd_up, 0, qa_noquit },
  33. { "down", &methodlist::kd_down, 0, qa_noquit },
  34. { "top", &methodlist::kd_top, 0, qa_noquit },
  35. { "bottom", &methodlist::kd_bottom, 0, qa_noquit },
  36. { "scrollon", &methodlist::kd_scrollon, 0, qa_noquit },
  37. { "scrollback", &methodlist::kd_scrollback, 0, qa_noquit },
  38. { "iscrollon", &methodlist::kd_iscrollon, 0, qa_noquit },
  39. { "iscrollback", &methodlist::kd_iscrollback, 0, qa_noquit },
  40. { "scrollon1", &methodlist::kd_scrollon1, 0, qa_noquit },
  41. { "scrollback1", &methodlist::kd_scrollback1, 0, qa_noquit },
  42. { "iscrollon1", &methodlist::kd_iscrollon1, 0, qa_noquit },
  43. { "iscrollback1", &methodlist::kd_iscrollback1, 0, qa_noquit },
  44. { "panon", &methodlist::kd_panon, 0, qa_noquit },
  45. { "panback", &methodlist::kd_panback, 0, qa_noquit },
  46. { "panon1", &methodlist::kd_panon1, 0, qa_noquit },
  47. { "panback1", &methodlist::kd_panback1, 0, qa_noquit },
  48. { "help", &methodlist::kd_help, 0, qa_noquit },
  49. { "search", &methodlist::kd_search, 0, qa_noquit },
  50. { "searchagain", &methodlist::kd_searchagain, 0, qa_noquit },
  51. { "redraw", &methodlist::kd_redraw, 0, qa_noquit },
  52. { "select-and-quit", &methodlist::kd_quit, 0, qa_quitchecksave },
  53. { "abort", &methodlist::kd_abort, 0, qa_quitnochecksave },
  54. { 0, 0, 0, qa_noquit }
  55. };
  56. #define C(x) ((x)-'a'+1)
  57. const keybindings::orgbinding methodlist_korgbindings[]= {
  58. { 'j', "down" }, // vi style
  59. //{ 'n', "down" }, // no style
  60. { KEY_DOWN, "down" },
  61. { 'k', "up" }, // vi style
  62. //{ 'p', "up" }, // no style
  63. { KEY_UP, "up" },
  64. { C('f'), "scrollon" }, // vi style
  65. { 'N', "scrollon" },
  66. { KEY_NPAGE, "scrollon" },
  67. { ' ', "scrollon" },
  68. { C('b'), "scrollback" }, // vi style
  69. { 'P', "scrollback" },
  70. { KEY_PPAGE, "scrollback" },
  71. { KEY_BACKSPACE, "scrollback" },
  72. { 0177,/*DEL*/ "scrollback" },
  73. { C('h'), "scrollback" },
  74. { C('n'), "scrollon1" },
  75. { C('p'), "scrollback1" },
  76. { 't', "top" },
  77. { KEY_HOME, "top" },
  78. { 'e', "bottom" },
  79. { KEY_LL, "bottom" },
  80. { KEY_END, "bottom" },
  81. { 'u', "iscrollback" },
  82. { 'd', "iscrollon" },
  83. { C('u'), "iscrollback1" },
  84. { C('d'), "iscrollon1" },
  85. { 'B', "panback" },
  86. { KEY_LEFT, "panback" },
  87. { 'F', "panon" },
  88. { KEY_RIGHT, "panon" },
  89. { C('b'), "panback1" },
  90. { C('f'), "panon1" },
  91. { '?', "help" },
  92. { KEY_HELP, "help" },
  93. { KEY_F(1), "help" },
  94. { '/', "search" },
  95. { 'n', "searchagain" },
  96. { '\\', "searchagain" },
  97. { C('l'), "redraw" },
  98. { KEY_ENTER, "select-and-quit" },
  99. { '\r', "select-and-quit" },
  100. { 'x', "abort" },
  101. { 'X', "abort" },
  102. { -1, 0 }
  103. };