summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/calcurse.c2
-rw-r--r--src/calcurse.h2
-rw-r--r--src/custom.c10
-rw-r--r--src/help.c2
-rw-r--r--src/keys.c23
5 files changed, 27 insertions, 12 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index 44fc0fe..37b1ed6 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -186,7 +186,7 @@ main (int argc, char **argv)
wins_reset ();
}
- key = keys_getch (win[STA].p);
+ key = keys_getch (win[STA].p, NULL);
switch (key)
{
case KEY_GENERIC_REDRAW:
diff --git a/src/calcurse.h b/src/calcurse.h
index 047a392..8e06cda 100644
--- a/src/calcurse.h
+++ b/src/calcurse.h
@@ -712,7 +712,7 @@ void keys_free (void);
void keys_dump_defaults (char *);
char *keys_get_label (enum key);
enum key keys_get_action (int);
-enum key keys_getch (WINDOW *win);
+enum key keys_getch (WINDOW *win, int *);
int keys_assign_binding (int, enum key);
void keys_remove_binding (int, enum key);
int keys_str2int (char *);
diff --git a/src/custom.c b/src/custom.c
index 50c2e82..90e28be 100644
--- a/src/custom.c
+++ b/src/custom.c
@@ -390,7 +390,7 @@ custom_load_conf (struct conf *conf)
status_mesg (mesg_line1, mesg_line2);
wnoutrefresh (win[STA].p);
wins_doupdate ();
- (void)keys_getch (win[STA].p);
+ (void)keys_getch (win[STA].p, NULL);
}
pthread_mutex_lock (&nbar.mutex);
@@ -579,7 +579,7 @@ custom_layout_config (void)
display_layout_config (&conf_win, mark, cursor);
clear ();
- while ((ch = keys_getch (win[STA].p)) != KEY_GENERIC_QUIT)
+ while ((ch = keys_getch (win[STA].p, NULL)) != KEY_GENERIC_QUIT)
{
need_reset = 0;
switch (ch)
@@ -663,7 +663,7 @@ custom_sidebar_config (void)
keys_display_bindings_bar (win[STA].p, binding, 0, binding_size);
wins_doupdate ();
- while ((ch = keys_getch (win[STA].p)) != KEY_GENERIC_QUIT)
+ while ((ch = keys_getch (win[STA].p, NULL)) != KEY_GENERIC_QUIT)
{
switch (ch)
{
@@ -902,7 +902,7 @@ custom_color_config (void)
display_color_config (&conf_win, &mark_fore, &mark_back, cursor, theme_changed);
clear ();
- while ((ch = keys_getch (win[STA].p)) != KEY_GENERIC_QUIT)
+ while ((ch = keys_getch (win[STA].p, NULL)) != KEY_GENERIC_QUIT)
{
need_reset = 0;
theme_changed = 0;
@@ -1379,7 +1379,7 @@ custom_keys_config (void)
{
int ch;
- ch = keys_getch (win[STA].p);
+ ch = keys_getch (win[STA].p, NULL);
switch (ch)
{
case KEY_MOVE_UP:
diff --git a/src/help.c b/src/help.c
index 7c43d44..86611ca 100644
--- a/src/help.c
+++ b/src/help.c
@@ -792,7 +792,7 @@ help_screen (void)
}
wins_scrollwin_display (&hwin);
- ch = keys_getch (win[STA].p);
+ ch = keys_getch (win[STA].p, NULL);
}
wins_scrollwin_delete (&hwin);
if (need_resize)
diff --git a/src/keys.c b/src/keys.c
index 1a46530..180b80d 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -194,11 +194,26 @@ keys_get_action (int pressed)
}
enum key
-keys_getch (WINDOW *win)
+keys_getch (WINDOW *win, int *count)
{
- int ch;
+ int ch = '0';
+
+ if (count)
+ {
+ *count = 0;
+ do
+ {
+ *count = *count * 10 + ch - '0';
+ ch = wgetch (win);
+ }
+ while ((ch == '0' && *count > 0) || (ch >= '1' && ch <= '9'));
+
+ if (*count == 0)
+ *count = 1;
+ }
+ else
+ ch = wgetch (win);
- ch = wgetch (win);
switch (ch)
{
case KEY_RESIZE:
@@ -586,7 +601,7 @@ keys_popup_info (enum key key)
#define WINCOL (col - 4)
infowin = popup (WINROW, WINCOL, (row - WINROW) / 2, (col - WINCOL) / 2,
keydef[key].label, info[key], 1);
- (void)keys_getch (infowin);
+ (void)keys_getch (infowin, NULL);
delwin (infowin);
#undef WINROW
#undef WINCOL