Commit fb41a078 authored by Chris Allegretta's avatar Chris Allegretta
Browse files

Add function check_bad_binding to check ppl arent binding things they shouldn,...

Add function check_bad_binding to check ppl arent binding things they shouldn, though currently its only one entry long ('meta-[') 



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4265 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent 1b6ed075
No related merge requests found
Showing with 23 additions and 0 deletions
+23 -0
...@@ -347,6 +347,20 @@ void parse_syntax(char *ptr) ...@@ -347,6 +347,20 @@ void parse_syntax(char *ptr)
} }
} }
int check_bad_binding(sc *s)
{
#define BADLISTLEN 1
int badtypes[BADLISTLEN] = {META};
int badseqs[BADLISTLEN] = { 91 };
int i;
for (i = 0; i < BADLISTLEN; i++)
if (s->type == badtypes[i] && s->seq == badseqs[i])
return 1;
return 0;
}
void parse_keybinding(char *ptr) void parse_keybinding(char *ptr)
{ {
char *keyptr = NULL, *keycopy = NULL, *funcptr = NULL, *menuptr = NULL; char *keyptr = NULL, *keycopy = NULL, *funcptr = NULL, *menuptr = NULL;
...@@ -405,6 +419,8 @@ void parse_keybinding(char *ptr) ...@@ -405,6 +419,8 @@ void parse_keybinding(char *ptr)
N_("Could not map name \"%s\" to a function\n"), funcptr); N_("Could not map name \"%s\" to a function\n"), funcptr);
return; return;
} }
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "newsc now address %d, menu func assigned = %d, menu = %d\n", fprintf(stderr, "newsc now address %d, menu func assigned = %d, menu = %d\n",
(int) newsc, (int) newsc->scfunc, menu); (int) newsc, (int) newsc->scfunc, menu);
...@@ -420,6 +436,13 @@ void parse_keybinding(char *ptr) ...@@ -420,6 +436,13 @@ void parse_keybinding(char *ptr)
fprintf(stderr, "s->seq = \"%d\"\n", newsc->seq); fprintf(stderr, "s->seq = \"%d\"\n", newsc->seq);
#endif #endif
if (check_bad_binding(newsc)) {
rcfile_error(
N_("Sorry, keystr \"%s\" is an illegal binding\n"), newsc->keystr);
return;
}
/* now let's have some fun. Try and delete the other entries /* now let's have some fun. Try and delete the other entries
we found for the same menu, then make this new new we found for the same menu, then make this new new
beginning */ beginning */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment