aboutsummaryrefslogtreecommitdiffstats
path: root/src/keys.c
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2009-01-01 17:50:41 +0000
committerFrederic Culot <calcurse@culot.org>2009-01-01 17:50:41 +0000
commitcac30a7e1469a8f061f64712dbea100a012dd788 (patch)
tree0e38d019b5071df73555b541ec2ce8e84fa2b9c5 /src/keys.c
parent8fdd1510c68644184c3df9ba002092a41364b482 (diff)
downloadcalcurse-cac30a7e1469a8f061f64712dbea100a012dd788.tar.gz
calcurse-cac30a7e1469a8f061f64712dbea100a012dd788.zip
cut/paste feature aded
fixed a 2-years old bug that made repeated items with exceptions to load uncorrectly in some cases (thanks Jan for reporting it)
Diffstat (limited to 'src/keys.c')
-rwxr-xr-xsrc/keys.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/keys.c b/src/keys.c
index bfebe24..ecfeb38 100755
--- a/src/keys.c
+++ b/src/keys.c
@@ -1,4 +1,4 @@
-/* $calcurse: keys.c,v 1.11 2008/12/28 13:13:59 culot Exp $ */
+/* $calcurse: keys.c,v 1.12 2009/01/01 17:50:41 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -56,6 +56,8 @@ static struct keydef_s keydef[NBKEYS] = {
{"generic-help", "?"},
{"generic-quit", "q Q"},
{"generic-save", "s S C-s"},
+ {"generic-cut", "C-x"},
+ {"generic-paste", "C-v"},
{"generic-change-view", "TAB"},
{"generic-import", "i I"},
{"generic-export", "x X"},
@@ -591,3 +593,41 @@ keys_check_missing_bindings (void)
}
return 0;
}
+
+void
+keys_fill_missing (void)
+{
+ int i;
+
+ for (i = 0; i < NBKEYS; i++)
+ {
+ if (keys[i] == 0)
+ {
+ char *p, tmpbuf[BUFSIZ];
+
+ (void)strncpy (tmpbuf, keydef[i].binding, BUFSIZ);
+ p = tmpbuf;
+ for (;;)
+ {
+ char key_ch[BUFSIZ];
+
+ while (*p == ' ')
+ p++;
+ if (sscanf (p, "%s", key_ch) == 1)
+ {
+ int ch, used;
+
+ ch = keys_str2int (key_ch);
+ used = keys_assign_binding (ch, i);
+ if (used)
+ ERROR_MSG (_("When adding default key for \"%s\", "
+ "\"%s\" was already assigned!"),
+ keydef[i].label, key_ch);
+ p += strlen (key_ch) + 1;
+ }
+ else
+ break;
+ }
+ }
+ }
+}