aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'st.c')
-rw-r--r--st.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/st.c b/st.c
index 1647cbd..671b386 100644
--- a/st.c
+++ b/st.c
@@ -194,6 +194,7 @@ typedef struct {
194 int bot; /* bottom scroll limit */ 194 int bot; /* bottom scroll limit */
195 int mode; /* terminal mode flags */ 195 int mode; /* terminal mode flags */
196 int esc; /* escape state flags */ 196 int esc; /* escape state flags */
197 bool numlock; /* lock numbers in keyboard */
197 bool *tabs; 198 bool *tabs;
198} Term; 199} Term;
199 200
@@ -261,6 +262,7 @@ typedef struct {
261/* function definitions used in config.h */ 262/* function definitions used in config.h */
262static void xzoom(const Arg *); 263static void xzoom(const Arg *);
263static void selpaste(const Arg *); 264static void selpaste(const Arg *);
265static void numlock(const Arg *);
264 266
265/* Config.h for applying patches and the configuration. */ 267/* Config.h for applying patches and the configuration. */
266#include "config.h" 268#include "config.h"
@@ -1100,6 +1102,7 @@ tnew(int col, int row) {
1100 term.alt [row] = xmalloc(term.col * sizeof(Glyph)); 1102 term.alt [row] = xmalloc(term.col * sizeof(Glyph));
1101 term.dirty[row] = 0; 1103 term.dirty[row] = 0;
1102 } 1104 }
1105 term.numlock = 1;
1103 memset(term.tabs, 0, term.col * sizeof(*term.tabs)); 1106 memset(term.tabs, 0, term.col * sizeof(*term.tabs));
1104 /* setup screen */ 1107 /* setup screen */
1105 treset(); 1108 treset();
@@ -2700,6 +2703,12 @@ match(uint mask, uint state) {
2700 return true; 2703 return true;
2701} 2704}
2702 2705
2706void
2707numlock(const Arg *dummy)
2708{
2709 term.numlock ^= 1;
2710}
2711
2703char* 2712char*
2704kmap(KeySym k, uint state) { 2713kmap(KeySym k, uint state) {
2705 uint mask; 2714 uint mask;
@@ -2725,8 +2734,12 @@ kmap(KeySym k, uint state) {
2725 if(!match(mask, state)) 2734 if(!match(mask, state))
2726 continue; 2735 continue;
2727 2736
2728 if((kp->appkey < 0 && IS_SET(MODE_APPKEYPAD)) || 2737 if(kp->appkey > 0) {
2729 (kp->appkey > 0 && !IS_SET(MODE_APPKEYPAD))) { 2738 if(!IS_SET(MODE_APPKEYPAD))
2739 continue;
2740 if(term.numlock && kp->appkey == 2)
2741 continue;
2742 } else if (kp->appkey < 0 && IS_SET(MODE_APPKEYPAD)) {
2730 continue; 2743 continue;
2731 } 2744 }
2732 2745