when Ctrl+Shift+Delete has no key code, do not fall back to KEY_BACKSPACE

This commit is contained in:
Kamil Dudka 2018-09-14 13:02:21 +02:00
parent d3120b88c0
commit 313f3bcbce
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,49 @@
From 027140f9b5b7db5c0832363034dd159b34eb3a03 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 12 Sep 2018 13:18:17 +0200
Subject: [PATCH] bindings: when Ctrl+Shift+Delete has no keycode, don't use
KEY_BSP
When curses gives no code for Ctrl+Shift+Delete, do not fall back
to KEY_BACKSPACE, because then ^H and/or <Backspace> get bound to
'cutwordleft'.
This fixes https://savannah.gnu.org/bugs/?54642.
Bug was introduced with version 3.0, commit e6429e78.
Upstream-commit: 09ab2e3d0eeb33bc4d0702623404ba01b1f8fa9a
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/nano.c | 2 +-
src/nano.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/nano.c b/src/nano.c
index c7e0ca2d..74e12439 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2580,7 +2580,7 @@ int main(int argc, char **argv)
controlhome = get_keycode("kHOM5", CONTROL_HOME);
controlend = get_keycode("kEND5", CONTROL_END);
controldelete = get_keycode("kDC5", CONTROL_DELETE);
- controlshiftdelete = get_keycode("kDC6", KEY_BACKSPACE);
+ controlshiftdelete = get_keycode("kDC6", CONTROL_SHIFT_DELETE);
#ifndef NANO_TINY
/* Ask for the codes for Shift+Control+Left/Right/Up/Down. */
shiftcontrolleft = get_keycode("kLFT6", SHIFT_CONTROL_LEFT);
diff --git a/src/nano.h b/src/nano.h
index e1042759..7de34bf3 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -588,6 +588,7 @@ enum
#define SHIFT_CONTROL_DOWN 0x414
#define SHIFT_CONTROL_HOME 0x415
#define SHIFT_CONTROL_END 0x416
+#define CONTROL_SHIFT_DELETE 0x417
#define ALT_LEFT 0x421
#define ALT_RIGHT 0x422
#define ALT_UP 0x423
--
2.17.1

View File

@ -1,7 +1,7 @@
Summary: A small text editor
Name: nano
Version: 3.0
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv3+
URL: https://www.nano-editor.org
Source: https://www.nano-editor.org/dist/latest/%{name}-%{version}.tar.xz
@ -19,6 +19,9 @@ Conflicts: filesystem < 3
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info
# when Ctrl+Shift+Delete has no key code, do not fall back to KEY_BACKSPACE
Patch1: 0001-nano-3.0-key-bsp.patch
%description
GNU nano is a small and friendly text editor.
@ -80,6 +83,9 @@ exit 0
%{_datadir}/nano
%changelog
* Fri Sep 14 2018 Kamil Dudka <kdudka@redhat.com> - 3.0-2
- when Ctrl+Shift+Delete has no key code, do not fall back to KEY_BACKSPACE
* Mon Sep 10 2018 Kamil Dudka <kdudka@redhat.com> - 3.0-1
- new upstream release