[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] input: recognize the keystrokes to be used for jumping to bo
From: |
Benno Schulenberg |
Subject: |
[PATCH 1/3] input: recognize the keystrokes to be used for jumping to bookmarks |
Date: |
Thu, 2 Apr 2020 11:03:27 +0200 |
Logically it ought to be <Ctrl+PageUp> and <Ctrl+PageDown> (because
the Ctrl modifier is used for "jumping"), but most terminal emulators
use those keystrokes to switch between tabs.
So, use <Alt+PageUp> and <Alt+PageDown> instead.
---
src/global.c | 2 +-
src/nano.c | 2 ++
src/nano.h | 2 ++
src/proto.h | 1 +
src/winio.c | 12 ++++++++++++
5 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/global.c b/src/global.c
index 6c9a981c..e8fa4629 100644
--- a/src/global.c
+++ b/src/global.c
@@ -104,7 +104,7 @@ int shiftleft, shiftright, shiftup, shiftdown;
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
int shiftcontrolhome, shiftcontrolend;
int altleft, altright, altup, altdown;
-int altdelete;
+int altpageup, altpagedown, altdelete;
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
#endif
diff --git a/src/nano.c b/src/nano.c
index 440db100..cc101680 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2399,6 +2399,8 @@ int main(int argc, char **argv)
altright = get_keycode("kRIT3", ALT_RIGHT);
altup = get_keycode("kUP3", ALT_UP);
altdown = get_keycode("kDN3", ALT_DOWN);
+ altpageup = get_keycode("kPRV3", ALT_PAGEUP);
+ altpagedown = get_keycode("kNXT3", ALT_PAGEDOWN);
altdelete = get_keycode("kDC3", ALT_DELETE);
shiftaltleft = get_keycode("kLFT4", SHIFT_ALT_LEFT);
diff --git a/src/nano.h b/src/nano.h
index a4a15d84..3538750e 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -588,6 +588,8 @@ enum
#define ALT_RIGHT 0x422
#define ALT_UP 0x423
#define ALT_DOWN 0x424
+#define ALT_PAGEUP 0x427
+#define ALT_PAGEDOWN 0x428
#define ALT_DELETE 0x42D
#define SHIFT_ALT_LEFT 0x431
#define SHIFT_ALT_RIGHT 0x432
diff --git a/src/proto.h b/src/proto.h
index 6660d603..58838280 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -76,6 +76,7 @@ extern int shiftcontrolup, shiftcontroldown;
extern int shiftcontrolhome, shiftcontrolend;
extern int altleft, altright;
extern int altup, altdown;
+extern int altpageup, altpagedown;
extern int altdelete;
extern int shiftaltleft, shiftaltright;
extern int shiftaltup, shiftaltdown;
diff --git a/src/winio.c b/src/winio.c
index 0506c132..da150950 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -670,6 +670,8 @@ int convert_sequence(const int *seq, size_t length, int
*consumed)
#ifndef NANO_TINY
if (seq[3] == '2')
return
shiftaltup;
+ if (seq[3] == '3')
+ return
ALT_PAGEUP;
#endif
}
break;
@@ -682,6 +684,8 @@ int convert_sequence(const int *seq, size_t length, int
*consumed)
#ifndef NANO_TINY
if (seq[3] == '2')
return
shiftaltdown;
+ if (seq[3] == '3')
+ return
ALT_PAGEDOWN;
#endif
}
break;
@@ -1067,6 +1071,10 @@ int parse_kbinput(WINDOW *win)
return ALT_UP;
else if (retval == altdown)
return ALT_DOWN;
+ else if (retval == altpageup)
+ return ALT_PAGEUP;
+ else if (retval == altpagedown)
+ return ALT_PAGEDOWN;
else if (retval == altdelete)
return ALT_DELETE;
else if (retval == shiftaltleft) {
@@ -1114,6 +1122,10 @@ int parse_kbinput(WINDOW *win)
return ALT_UP;
if (retval == KEY_DOWN)
return ALT_DOWN;
+ if (retval == KEY_PPAGE)
+ return ALT_PAGEUP;
+ if (retval == KEY_NPAGE)
+ return ALT_PAGEDOWN;
}
#endif
/* Is Ctrl being held? */
--
2.25.2
- [PATCH 1/3] input: recognize the keystrokes to be used for jumping to bookmarks,
Benno Schulenberg <=
- [PATCH 2/3] new feature: "knots" -- a kind of bookmarks, that can be cycled through, Benno Schulenberg, 2020/04/02
- Re: [PATCH 2/3] new feature: "knots" -- a kind of bookmarks, that can be cycled through, Marco Diego Aurélio Mesquita, 2020/04/03
- Re: [PATCH 2/3] new feature: "knots" -- a kind of bookmarks, that can be cycled through, Benno Schulenberg, 2020/04/05
- Message not available
- Fwd: [PATCH 2/3] new feature: "knots" -- a kind of bookmarks, that can be cycled through, Marco Diego Aurélio Mesquita, 2020/04/05
- Re: Fwd: [PATCH 2/3] new feature: "knots" -- a kind of bookmarks, that can be cycled through, Benno Schulenberg, 2020/04/05
- Re: Fwd: [PATCH 2/3] new feature: "knots" -- a kind of bookmarks, that can be cycled through, Marco Diego Aurélio Mesquita, 2020/04/05
- Re: Fwd: [PATCH 2/3] new feature: "knots" -- a kind of bookmarks, that can be cycled through, Benno Schulenberg, 2020/04/06
- Re: Fwd: [PATCH 2/3] new feature: "knots" -- a kind of bookmarks, that can be cycled through, Brand Huntsman, 2020/04/05
- Re: Fwd: [PATCH 2/3] new feature: "knots" -- a kind of bookmarks, that can be cycled through, Benno Schulenberg, 2020/04/06
- Re: Fwd: [PATCH 2/3] new feature: "knots" -- a kind of bookmarks, that can be cycled through, Brand Huntsman, 2020/04/06