xaizek / pipedial (License: GPLv3 only) (since 2019-01-08)
One more tool for selecting something in console.
Commit b73665d41846a1e370696619ee7ea31fb398299c

Add Ctrl-E and Ctrl-Y keys
To both normal and help modes.

Required updating libcursed and libvle.
Author: xaizek
Author date (UTC): 2019-05-21 15:45
Committer name: xaizek
Committer date (UTC): 2019-05-21 15:45
Parent(s): e3000b9a2e19fcdbe8f2d8672b5e711e9e8a6117
Signing key: 99DC5E4DB05F6BE2
Tree: 49276d951f20f0cd7b63109800027daf805e5452
File Lines added Lines deleted
docs/04-shortcuts.md 6 2
docs/pipedial.1 7 3
libs/cursed 1 1
libs/vle 1 1
src/PipeDial.cpp 21 6
File docs/04-shortcuts.md changed (mode: 100644) (index e23edf5..9124d39)
... ... Normal Mode
24 24
25 25 **[count]k** -- move cursor **[count]** (1 by default) elements up. **[count]k** -- move cursor **[count]** (1 by default) elements up.
26 26
27 **Ctrl-E** -- scroll one line down.
28
29 **Ctrl-Y** -- scroll one line up.
30
27 31 Help Mode Help Mode
28 32 --------- ---------
29 33
 
... ... Help Mode
33 37
34 38 **G** -- scroll to the bottom. **G** -- scroll to the bottom.
35 39
36 **j** -- scroll one line down.
40 **j**/**Ctrl-E** -- scroll one line down.
37 41
38 **k** -- scroll one line up.
42 **k**/**Ctrl-Y** -- scroll one line up.
File docs/pipedial.1 changed (mode: 100644) (index 908b00a..1abc8d0)
1 1 .\" Automatically generated by Pandoc 1.17.0.3 .\" Automatically generated by Pandoc 1.17.0.3
2 2 .\" .\"
3 .TH "pipedial" "1" "January 30, 2019" "" ""
3 .TH "pipedial" "1" "May 21, 2019" "" ""
4 4 .hy .hy
5 5 .SH NAME .SH NAME
6 6 .PP .PP
 
... ... elements down.
49 49 .PP .PP
50 50 \f[B][count]k\f[] \-\- move cursor \f[B][count]\f[] (1 by default) \f[B][count]k\f[] \-\- move cursor \f[B][count]\f[] (1 by default)
51 51 elements up. elements up.
52 .PP
53 \f[B]Ctrl\-E\f[] \-\- scroll one line down.
54 .PP
55 \f[B]Ctrl\-Y\f[] \-\- scroll one line up.
52 56 .SS Help Mode .SS Help Mode
53 57 .PP .PP
54 58 \f[B]h\f[] \-\- return to Normal mode. \f[B]h\f[] \-\- return to Normal mode.
 
... ... elements up.
57 61 .PP .PP
58 62 \f[B]G\f[] \-\- scroll to the bottom. \f[B]G\f[] \-\- scroll to the bottom.
59 63 .PP .PP
60 \f[B]j\f[] \-\- scroll one line down.
64 \f[B]j\f[]/\f[B]Ctrl\-E\f[] \-\- scroll one line down.
61 65 .PP .PP
62 \f[B]k\f[] \-\- scroll one line up.
66 \f[B]k\f[]/\f[B]Ctrl\-Y\f[] \-\- scroll one line up.
63 67 .SH EXAMPLES .SH EXAMPLES
64 68 .PP .PP
65 69 Switch to a branch inside git repository (doesn\[aq]t handle Switch to a branch inside git repository (doesn\[aq]t handle
File libs/cursed changed (mode: 160000) (index 8566541..b4d967e)
1 Subproject commit 8566541dc04c2c9b97756589c2954e14eafbe01a
1 Subproject commit b4d967e441f01af709ca7e0c686b0001773f44a4
File libs/vle changed (mode: 160000) (index 32bc9c9..007e559)
1 Subproject commit 32bc9c91577dc939193d80455d5413838783e262
1 Subproject commit 007e559a5fdf94372d590925d07a58c9de82cc85
File src/PipeDial.cpp changed (mode: 100644) (index 57b7d45..f64b41f)
31 31 #include "vle/KeyDispatcher.hpp" #include "vle/KeyDispatcher.hpp"
32 32 #include "vle/Mode.hpp" #include "vle/Mode.hpp"
33 33 #include "vle/Modes.hpp" #include "vle/Modes.hpp"
34 #include "vle/keys.hpp"
34 35
35 36 PipeDial::PipeDial(std::wstring titleText, std::vector<std::wstring> initLines) PipeDial::PipeDial(std::wstring titleText, std::vector<std::wstring> initLines)
36 37 : lines(std::move(initLines)), input(cursed::Keypad::Disabled), : lines(std::move(initLines)), input(cursed::Keypad::Disabled),
 
... ... PipeDial::buildHelpMessage()
130 131 L" -- move cursor " + L" -- move cursor " +
131 132 shortcut(L"[count]") + L" (1 by default) elements up." shortcut(L"[count]") + L" (1 by default) elements up."
132 133 ); );
134 lines.emplace_back();
135 lines.emplace_back(shortcut(L"^E") + L" -- scroll one line down.");
136 lines.emplace_back();
137 lines.emplace_back(shortcut(L"^Y") + L" -- scroll one line up.");
133 138
134 139 lines.emplace_back(); lines.emplace_back();
135 140 lines.emplace_back(modeTitle(L"Help Mode")); lines.emplace_back(modeTitle(L"Help Mode"));
 
... ... PipeDial::buildHelpMessage()
141 146 lines.emplace_back(); lines.emplace_back();
142 147 lines.emplace_back(shortcut(L"G") + L" -- scroll to the bottom."); lines.emplace_back(shortcut(L"G") + L" -- scroll to the bottom.");
143 148 lines.emplace_back(); lines.emplace_back();
144 lines.emplace_back(shortcut(L"j") + L" -- scroll one line down.");
149 lines.emplace_back(
150 shortcut(L"j") + L"/" + shortcut(L"^E") + L" -- scroll one line down."
151 );
145 152 lines.emplace_back(); lines.emplace_back();
146 lines.emplace_back(shortcut(L"k") + L" -- scroll one line up.");
153 lines.emplace_back(
154 shortcut(L"k") + L"/" + shortcut(L"^Y") + L" -- scroll one line up."
155 );
147 156 lines.emplace_back(); lines.emplace_back();
148 157
149 158 return lines; return lines;
 
... ... PipeDial::buildNormalMode()
171 180 }, "go to the first or [count]-th item" }); }, "go to the first or [count]-th item" });
172 181 normalMode.addShortcut({ L"j", [&](int count) { normalMode.addShortcut({ L"j", [&](int count) {
173 182 list.moveDown(count < 0 ? 1 : count); list.moveDown(count < 0 ? 1 : count);
174 }, "go to item below" });
183 }, "go [count] items below" });
175 184 normalMode.addShortcut({ L"k", [&](int count) { normalMode.addShortcut({ L"k", [&](int count) {
176 185 list.moveUp(count < 0 ? 1 : count); list.moveUp(count < 0 ? 1 : count);
177 }, "go to item above" });
186 }, "go [count] items above" });
178 187 normalMode.addShortcut({ L"q", [&]() { normalMode.addShortcut({ L"q", [&]() {
179 188 quit = true; quit = true;
180 189 }, "quit the application with no selection" }); }, "quit the application with no selection" });
 
... ... PipeDial::buildNormalMode()
203 212 screen.replaceTopWidget(&track); screen.replaceTopWidget(&track);
204 213 } }
205 214 }, "edit and accept" }); }, "edit and accept" });
215 normalMode.addShortcut({ vle::Key(L'e').ctrl(), [&]() {
216 list.scrollDown();
217 }, "scroll one line down" });
218 normalMode.addShortcut({ vle::Key(L'y').ctrl(), [&]() {
219 list.scrollUp();
220 }, "scroll one line up" });
206 221 normalMode.addShortcut({ L"/", [&]() { normalMode.addShortcut({ L"/", [&]() {
207 222 cursed::List filterList; cursed::List filterList;
208 223 filterList.setItems({ lines.cbegin(), lines.cend() }); filterList.setItems({ lines.cbegin(), lines.cend() });
 
... ... PipeDial::buildHelpMode()
270 285 helpMode.addShortcut({ L"gg", [&]() { helpMode.addShortcut({ L"gg", [&]() {
271 286 help.scrollToTop(); help.scrollToTop();
272 287 }, "scroll to the bottom" }); }, "scroll to the bottom" });
273 helpMode.addShortcut({ L"j", [&]() {
288 helpMode.addShortcut({ { L"j", vle::Key(L'e').ctrl() }, [&]() {
274 289 help.scrollDown(); help.scrollDown();
275 290 }, "scroll one line down" }); }, "scroll one line down" });
276 helpMode.addShortcut({ L"k", [&]() {
291 helpMode.addShortcut({ { L"k", vle::Key(L'y').ctrl() }, [&]() {
277 292 help.scrollUp(); help.scrollUp();
278 293 }, "scroll one line up" }); }, "scroll one line up" });
279 294
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/pipedial

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/pipedial

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master