methkeys.cc 4.8 KB

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