mirror of
git://git.sv.gnu.org/nano.git
synced 2024-12-25 11:57:05 +03:00
Allow backspace to be bound to keys in .nanorc
Allow kdel to be rebound Add note about rebinding kdel to backspace for those using OSX or PuTTY to connect to remote Linux machines in nanorc.sample.in When undoing text deletes, move current_x to proper location git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4281 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
70859f4a5b
commit
fa406949ec
@ -222,6 +222,9 @@
|
|||||||
# bind M-A casesens search
|
# bind M-A casesens search
|
||||||
# bind ^S research main
|
# bind ^S research main
|
||||||
|
|
||||||
|
## Set this if your backspace key sends delete most of the time (2.1.3+)
|
||||||
|
# bind kdel backspace all
|
||||||
|
|
||||||
|
|
||||||
## Nanorc files
|
## Nanorc files
|
||||||
# include "@PKGDATADIR@/nanorc.nanorc"
|
# include "@PKGDATADIR@/nanorc.nanorc"
|
||||||
|
@ -1446,6 +1446,8 @@ sc *strtosc(int menu, char *input)
|
|||||||
s->scfunc = do_enter;
|
s->scfunc = do_enter;
|
||||||
else if (!strcasecmp(input, "delete"))
|
else if (!strcasecmp(input, "delete"))
|
||||||
s->scfunc = do_delete;
|
s->scfunc = do_delete;
|
||||||
|
else if (!strcasecmp(input, "backspace"))
|
||||||
|
s->scfunc = do_backspace;
|
||||||
else if (!strcasecmp(input, "refresh"))
|
else if (!strcasecmp(input, "refresh"))
|
||||||
s->scfunc = total_refresh;
|
s->scfunc = total_refresh;
|
||||||
else if (!strcasecmp(input, "casesens")) {
|
else if (!strcasecmp(input, "casesens")) {
|
||||||
|
@ -380,7 +380,7 @@ void parse_keybinding(char *ptr)
|
|||||||
for (i = 0; i < strlen(keycopy); i++)
|
for (i = 0; i < strlen(keycopy); i++)
|
||||||
keycopy[i] = toupper(keycopy[i]);
|
keycopy[i] = toupper(keycopy[i]);
|
||||||
|
|
||||||
if (keycopy[0] != 'M' && keycopy[0] != '^' && keycopy[0] != 'F') {
|
if (keycopy[0] != 'M' && keycopy[0] != '^' && keycopy[0] != 'F' && keycopy[0] != 'K') {
|
||||||
rcfile_error(
|
rcfile_error(
|
||||||
N_("keybindings must begin with \"^\", \"M\", or \"F\"\n"));
|
N_("keybindings must begin with \"^\", \"M\", or \"F\"\n"));
|
||||||
return;
|
return;
|
||||||
|
@ -393,6 +393,7 @@ void do_undo(void)
|
|||||||
fprintf(stderr, "Undo running for type %d\n", u->type);
|
fprintf(stderr, "Undo running for type %d\n", u->type);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
openfile->current_x = u->begin;
|
||||||
switch(u->type) {
|
switch(u->type) {
|
||||||
case ADD:
|
case ADD:
|
||||||
action = _("text add");
|
action = _("text add");
|
||||||
@ -413,6 +414,7 @@ void do_undo(void)
|
|||||||
strcpy(&data[u->begin + strlen(u->strdata)], &f->data[u->begin]);
|
strcpy(&data[u->begin + strlen(u->strdata)], &f->data[u->begin]);
|
||||||
free(f->data);
|
free(f->data);
|
||||||
f->data = data;
|
f->data = data;
|
||||||
|
openfile->current_x += strlen(u->strdata);
|
||||||
break;
|
break;
|
||||||
case SPLIT:
|
case SPLIT:
|
||||||
action = _("line split");
|
action = _("line split");
|
||||||
@ -442,7 +444,6 @@ void do_undo(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
openfile->current = f;
|
openfile->current = f;
|
||||||
openfile->current_x = u->begin;
|
|
||||||
edit_refresh();
|
edit_refresh();
|
||||||
statusbar(_("Undid action (%s)"), action);
|
statusbar(_("Undid action (%s)"), action);
|
||||||
openfile->current_undo = openfile->current_undo->next;
|
openfile->current_undo = openfile->current_undo->next;
|
||||||
|
Loading…
Reference in New Issue
Block a user