File src/cmd_handlers.c changed (mode: 100644) (index e5153a604..33934813f) |
... |
... |
static int |
5392 |
5392 |
do_map(const cmd_info_t *cmd_info, const char map_type[], int mode, |
do_map(const cmd_info_t *cmd_info, const char map_type[], int mode, |
5393 |
5393 |
int no_remap) |
int no_remap) |
5394 |
5394 |
{ |
{ |
5395 |
|
wchar_t *keys, *mapping; |
|
5396 |
|
char *raw_rhs, *rhs; |
|
5397 |
|
char t; |
|
5398 |
|
|
|
5399 |
5395 |
if(cmd_info->argc <= 1) |
if(cmd_info->argc <= 1) |
5400 |
5396 |
{ |
{ |
5401 |
|
keys = substitute_specs(cmd_info->args); |
|
|
5397 |
|
wchar_t *keys = substitute_specs(cmd_info->args); |
5402 |
5398 |
if(keys != NULL) |
if(keys != NULL) |
5403 |
5399 |
{ |
{ |
5404 |
5400 |
int save_msg = show_map_menu(curr_view, map_type, mode, keys); |
int save_msg = show_map_menu(curr_view, map_type, mode, keys); |
|
... |
... |
do_map(const cmd_info_t *cmd_info, const char map_type[], int mode, |
5414 |
5410 |
const int flags = (no_remap ? KEYS_FLAG_NOREMAP : KEYS_FLAG_NONE) |
const int flags = (no_remap ? KEYS_FLAG_NOREMAP : KEYS_FLAG_NONE) |
5415 |
5411 |
| parse_map_args(&args); |
| parse_map_args(&args); |
5416 |
5412 |
|
|
5417 |
|
raw_rhs = vle_cmds_past_arg(args); |
|
5418 |
|
t = *raw_rhs; |
|
|
5413 |
|
char *raw_rhs = vle_cmds_past_arg(args); |
5419 |
5414 |
*raw_rhs = '\0'; |
*raw_rhs = '\0'; |
5420 |
5415 |
|
|
5421 |
|
int error = 0; |
|
5422 |
|
rhs = vle_cmds_at_arg(raw_rhs + 1); |
|
5423 |
|
keys = substitute_specs(args); |
|
5424 |
|
mapping = substitute_specs(rhs); |
|
|
5416 |
|
char *rhs = vle_cmds_at_arg(raw_rhs + 1); |
|
5417 |
|
wchar_t *keys = substitute_specs(args); |
|
5418 |
|
wchar_t *mapping = substitute_specs(rhs); |
5425 |
5419 |
if(keys != NULL && mapping != NULL) |
if(keys != NULL && mapping != NULL) |
5426 |
5420 |
{ |
{ |
5427 |
|
error = vle_keys_user_add(keys, mapping, mode, flags); |
|
|
5421 |
|
if(vle_keys_user_add(keys, mapping, mode, flags) != 0) |
|
5422 |
|
{ |
|
5423 |
|
show_error_msg("Mapping Error", "Unable to allocate enough memory"); |
|
5424 |
|
} |
5428 |
5425 |
} |
} |
5429 |
5426 |
else |
else |
5430 |
5427 |
{ |
{ |
|
... |
... |
do_map(const cmd_info_t *cmd_info, const char map_type[], int mode, |
5434 |
5431 |
free(mapping); |
free(mapping); |
5435 |
5432 |
free(keys); |
free(keys); |
5436 |
5433 |
|
|
5437 |
|
*raw_rhs = t; |
|
5438 |
|
|
|
5439 |
|
if(error) |
|
5440 |
|
show_error_msg("Mapping Error", "Unable to allocate enough memory"); |
|
5441 |
|
|
|
5442 |
5434 |
return 0; |
return 0; |
5443 |
5435 |
} |
} |
5444 |
5436 |
|
|