pkgkeys.cc 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * dselect - Debian package maintenance user interface
  3. * pkgkeys.cc - package 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 packagelist_kinterps[] = {
  26. { "up", nullptr, &packagelist::kd_up, qa_noquit },
  27. { "down", nullptr, &packagelist::kd_down, qa_noquit },
  28. { "top", nullptr, &packagelist::kd_top, qa_noquit },
  29. { "bottom", nullptr, &packagelist::kd_bottom, qa_noquit },
  30. { "scrollon", nullptr, &packagelist::kd_scrollon, qa_noquit },
  31. { "scrollback", nullptr, &packagelist::kd_scrollback, qa_noquit },
  32. { "iscrollon", nullptr, &packagelist::kd_iscrollon, qa_noquit },
  33. { "iscrollback", nullptr, &packagelist::kd_iscrollback, qa_noquit },
  34. { "scrollon1", nullptr, &packagelist::kd_scrollon1, qa_noquit },
  35. { "scrollback1", nullptr, &packagelist::kd_scrollback1, qa_noquit },
  36. { "iscrollon1", nullptr, &packagelist::kd_iscrollon1, qa_noquit },
  37. { "iscrollback1", nullptr, &packagelist::kd_iscrollback1, qa_noquit },
  38. { "panon", nullptr, &packagelist::kd_panon, qa_noquit },
  39. { "panback", nullptr, &packagelist::kd_panback, qa_noquit },
  40. { "panon1", nullptr, &packagelist::kd_panon1, qa_noquit },
  41. { "panback1", nullptr, &packagelist::kd_panback1, qa_noquit },
  42. { "install", nullptr, &packagelist::kd_select, qa_noquit },
  43. { "remove", nullptr, &packagelist::kd_deselect, qa_noquit },
  44. { "purge", nullptr, &packagelist::kd_purge, qa_noquit },
  45. { "hold", nullptr, &packagelist::kd_hold, qa_noquit },
  46. { "unhold", nullptr, &packagelist::kd_unhold, qa_noquit },
  47. { "info", nullptr, &packagelist::kd_info, qa_noquit },
  48. { "toggleinfo", nullptr, &packagelist::kd_toggleinfo, qa_noquit },
  49. { "verbose", nullptr, &packagelist::kd_verbose, qa_noquit },
  50. { "archdisplay", nullptr, &packagelist::kd_archdisplay, qa_noquit },
  51. { "versiondisplay", nullptr, &packagelist::kd_versiondisplay, qa_noquit },
  52. { "help", nullptr, &packagelist::kd_help, qa_noquit },
  53. { "search", nullptr, &packagelist::kd_search, qa_noquit },
  54. { "searchagain", nullptr, &packagelist::kd_searchagain, qa_noquit },
  55. { "swaporder", nullptr, &packagelist::kd_swaporder, qa_noquit },
  56. { "swapstatorder", nullptr, &packagelist::kd_swapstatorder, qa_noquit },
  57. { "redraw", nullptr, &packagelist::kd_redraw, qa_noquit },
  58. { "quitcheck", nullptr, &packagelist::kd_quit_noop, qa_quitchecksave },
  59. { "quitrejectsug", nullptr, &packagelist::kd_revertdirect, qa_quitnochecksave },
  60. { "quitnocheck", nullptr, &packagelist::kd_quit_noop, qa_quitnochecksave },
  61. { "abortnocheck", nullptr, &packagelist::kd_revert_abort, qa_quitnochecksave },
  62. { "revert", nullptr, &packagelist::kd_revert_abort, qa_noquit },
  63. { "revertsuggest", nullptr, &packagelist::kd_revertsuggest, qa_noquit },
  64. { "revertdirect", nullptr, &packagelist::kd_revertdirect, qa_noquit },
  65. { "revertinstalled", nullptr, &packagelist::kd_revertinstalled, qa_noquit },
  66. { nullptr, nullptr, nullptr, qa_noquit }
  67. };
  68. const keybindings::orgbinding packagelist_korgbindings[]= {
  69. { 'j', "down" }, // vi style
  70. { KEY_DOWN, "down" },
  71. { 'k', "up" }, // vi style
  72. { 'p', "up" },
  73. { KEY_UP, "up" },
  74. { 'N', "scrollon" },
  75. { KEY_NPAGE, "scrollon" },
  76. { ' ', "scrollon" },
  77. { 'P', "scrollback" },
  78. { KEY_PPAGE, "scrollback" },
  79. { KEY_BACKSPACE, "scrollback" },
  80. { 0177, "scrollback" }, // ASCII DEL
  81. { CTRL('h'), "scrollback" },
  82. { CTRL('n'), "scrollon1" },
  83. { CTRL('p'), "scrollback1" },
  84. { 't', "top" },
  85. { KEY_HOME, "top" },
  86. { 'e', "bottom" },
  87. { KEY_LL, "bottom" },
  88. { KEY_END, "bottom" },
  89. { 'u', "iscrollback" },
  90. { 'd', "iscrollon" },
  91. { CTRL('u'), "iscrollback1" },
  92. { CTRL('d'), "iscrollon1" },
  93. { 'B', "panback" },
  94. { KEY_LEFT, "panback" },
  95. { 'F', "panon" },
  96. { KEY_RIGHT, "panon" },
  97. { CTRL('b'), "panback1" },
  98. { CTRL('f'), "panon1" },
  99. { '+', "install" },
  100. { KEY_IC, "install" },
  101. { '-', "remove" },
  102. { KEY_DC, "remove" },
  103. { '_', "purge" },
  104. { 'H', "hold" },
  105. { '=', "hold" },
  106. { 'G', "unhold" },
  107. { '?', "help" },
  108. { KEY_HELP, "help" },
  109. { KEY_F(1), "help" },
  110. { 'i', "info" },
  111. { 'I', "toggleinfo" },
  112. { 'o', "swaporder" },
  113. { 'O', "swapstatorder" },
  114. { 'v', "verbose" },
  115. { 'A', "archdisplay" },
  116. { 'V', "versiondisplay" },
  117. { CTRL('l'), "redraw" },
  118. { '/', "search" },
  119. { 'n', "searchagain" },
  120. { '\\', "searchagain" },
  121. { KEY_ENTER, "quitcheck" },
  122. { '\r', "quitcheck" },
  123. { 'Q', "quitnocheck" },
  124. { 'x', "abortnocheck" },
  125. { 'X', "abortnocheck" },
  126. { 'R', "revert" },
  127. { 'U', "revertsuggest" },
  128. { 'D', "revertdirect" },
  129. { 'C', "revertinstalled" },
  130. { -1, nullptr }
  131. };