diff options
author | Frederic Culot <calcurse@culot.org> | 2009-01-01 17:50:41 +0000 |
---|---|---|
committer | Frederic Culot <calcurse@culot.org> | 2009-01-01 17:50:41 +0000 |
commit | cac30a7e1469a8f061f64712dbea100a012dd788 (patch) | |
tree | 0e38d019b5071df73555b541ec2ce8e84fa2b9c5 /src/keys.c | |
parent | 8fdd1510c68644184c3df9ba002092a41364b482 (diff) | |
download | calcurse-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-x | src/keys.c | 42 |
1 files changed, 41 insertions, 1 deletions
@@ -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; + } + } + } +} |