methkeys.cc 5.0 KB

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