Update to version 0.20

Merges: https://src.fedoraproject.org/rpms/libtermkey/pull-request/1
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
This commit is contained in:
Andreas Schneider 2017-11-08 09:47:41 +01:00 committed by Igor Gnatenko
parent 8f7027640d
commit 30c1fcba5a
7 changed files with 9 additions and 167 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/libtermkey-0.18.tar.gz
/libtermkey-0.20.tar.gz

View File

@ -1,60 +0,0 @@
From 416adba8c000bd2a70efc881283249d03a56553b Mon Sep 17 00:00:00 2001
From: Paul LeoNerd Evans <leonerd@leonerd.org.uk>
Date: Tue, 29 Dec 2015 12:37:19 +0000
Subject: [PATCH 1/7] Correct handling of ASCII NUL to imply Ctrl-Space
---
t/02getkey.c | 10 +++++++++-
termkey.c | 8 +++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/t/02getkey.c b/t/02getkey.c
index 279a598..258c2e3 100644
--- a/t/02getkey.c
+++ b/t/02getkey.c
@@ -6,7 +6,7 @@ int main(int argc, char *argv[])
TermKey *tk;
TermKeyKey key;
- plan_tests(31);
+ plan_tests(35);
tk = termkey_new_abstract("vt100", 0);
@@ -69,6 +69,14 @@ int main(int argc, char *argv[])
is_int(key.code.sym, TERMKEY_SYM_ESCAPE, "key.code.sym after Ctrl-Escape");
is_int(key.modifiers, TERMKEY_KEYMOD_CTRL, "key.modifiers after Ctrl-Escape");
+ termkey_push_bytes(tk, "\0", 1);
+
+ is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY after Ctrl-Space");
+
+ is_int(key.type, TERMKEY_TYPE_UNICODE, "key.type after Ctrl-Space");
+ is_int(key.code.codepoint, ' ', "key.code.codepoint after Ctrl-Space");
+ is_int(key.modifiers, TERMKEY_KEYMOD_CTRL, "key.modifiers after Ctrl-Space");
+
termkey_destroy(tk);
return exit_status();
diff --git a/termkey.c b/termkey.c
index 448df86..a88e6c2 100644
--- a/termkey.c
+++ b/termkey.c
@@ -729,7 +729,13 @@ static TermKeyResult parse_utf8(const unsigned char *bytes, size_t len, long *cp
static void emit_codepoint(TermKey *tk, long codepoint, TermKeyKey *key)
{
- if(codepoint < 0x20) {
+ if(codepoint == 0) {
+ // ASCII NUL = Ctrl-Space
+ key->type = TERMKEY_TYPE_KEYSYM;
+ key->code.sym = TERMKEY_SYM_SPACE;
+ key->modifiers = TERMKEY_KEYMOD_CTRL;
+ }
+ else if(codepoint < 0x20) {
// C0 range
key->code.codepoint = 0;
key->modifiers = 0;
--
2.11.0

View File

@ -1,38 +0,0 @@
From e044a1603ec1d30e7b8cc765598c3160c857c367 Mon Sep 17 00:00:00 2001
From: Paul LeoNerd Evans <leonerd@leonerd.org.uk>
Date: Tue, 27 Sep 2016 23:18:20 +0100
Subject: [PATCH 2/7] =?UTF-8?q?Bugfix=20for=20keypad=20mode=20switching=20?=
=?UTF-8?q?unibilium/TI=20driver=20(thanks=20P=C5=99emysl=20Janouch)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
driver-ti.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/driver-ti.c b/driver-ti.c
index d827bdf..d678c12 100644
--- a/driver-ti.c
+++ b/driver-ti.c
@@ -239,7 +239,7 @@ static int load_terminfo(TermKeyTI *ti, const char *term)
* time we want to use it
*/
#ifdef HAVE_UNIBILIUM
- const char *keypad_xmit = unibi_get_str(unibi, unibi_pkey_xmit);
+ const char *keypad_xmit = unibi_get_str(unibi, unibi_keypad_xmit);
#endif
if(keypad_xmit)
@@ -248,7 +248,7 @@ static int load_terminfo(TermKeyTI *ti, const char *term)
ti->start_string = NULL;
#ifdef HAVE_UNIBILIUM
- const char *keypad_local = unibi_get_str(unibi, unibi_pkey_local);
+ const char *keypad_local = unibi_get_str(unibi, unibi_keypad_local);
#endif
if(keypad_local)
--
2.11.0

View File

@ -1,35 +0,0 @@
From fa0a5ea3996a09487924f072afa148d81bf6c53f Mon Sep 17 00:00:00 2001
From: Paul LeoNerd Evans <leonerd@leonerd.org.uk>
Date: Tue, 11 Oct 2016 21:30:36 +0100
Subject: [PATCH 3/7] Endian fix for unicode keys (thanks jamessan)
---
termkey.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/termkey.c b/termkey.c
index a88e6c2..b520b73 100644
--- a/termkey.c
+++ b/termkey.c
@@ -799,15 +799,15 @@ void termkey_canonicalise(TermKey *tk, TermKeyKey *key)
int flags = tk->canonflags;
if(flags & TERMKEY_CANON_SPACESYMBOL) {
- if(key->type == TERMKEY_TYPE_UNICODE && key->code.number == 0x20) {
+ if(key->type == TERMKEY_TYPE_UNICODE && key->code.codepoint == 0x20) {
key->type = TERMKEY_TYPE_KEYSYM;
key->code.sym = TERMKEY_SYM_SPACE;
}
}
else {
if(key->type == TERMKEY_TYPE_KEYSYM && key->code.sym == TERMKEY_SYM_SPACE) {
- key->type = TERMKEY_TYPE_UNICODE;
- key->code.number = 0x20;
+ key->type = TERMKEY_TYPE_UNICODE;
+ key->code.codepoint = 0x20;
fill_utf8(key);
}
}
--
2.11.0

View File

@ -1,23 +0,0 @@
From 34058046142167cb44260341c500af8988eff618 Mon Sep 17 00:00:00 2001
From: Paul LeoNerd Evans <leonerd@leonerd.org.uk>
Date: Tue, 11 Oct 2016 21:38:16 +0100
Subject: [PATCH 4/7] Include <unistd.h> for write+pipe (thanks jamessan)
---
t/05read.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/t/05read.c b/t/05read.c
index a76cd0a..073c43d 100644
--- a/t/05read.c
+++ b/t/05read.c
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <errno.h>
+#include <unistd.h>
#include "../termkey.h"
#include "taplib.h"
--
2.11.0

View File

@ -4,23 +4,17 @@
%bcond_without unibilium
Name: lib%{libname}
Version: 0.18
Release: 5%{?dist}
Version: 0.20
Release: 1%{?dist}
Summary: Library for easy processing of keyboard entry from terminal-based programs
License: MIT
URL: http://www.leonerd.org.uk/code/libtermkey/
Source0: %{url}/%{name}-%{version}.tar.gz
# All patches are taken from https://github.com/neovim/libtermkey
Patch0001: 0001-Correct-handling-of-ASCII-NUL-to-imply-Ctrl-Space.patch
Patch0002: 0002-Bugfix-for-keypad-mode-switching-unibilium-TI-driver.patch
Patch0003: 0003-Endian-fix-for-unicode-keys-thanks-jamessan.patch
Patch0004: 0004-Include-unistd.h-for-write-pipe-thanks-jamessan.patch
# Non-upstream patches
Patch10: 0001-build-take-into-account-CFLAGS-LDFLAGS-for-tests.patch
Patch11: 0002-include-stdlib.h-for-putenv.patch
Patch0: 0001-build-take-into-account-CFLAGS-LDFLAGS-for-tests.patch
Patch1: 0002-include-stdlib.h-for-putenv.patch
BuildRequires: gcc
BuildRequires: make
@ -75,6 +69,9 @@ CFLAGS="%{__global_cflags} -D_XOPEN_SOURCE" LDFLAGS="%{__global_ldflags}" make t
%{_mandir}/man7/%{libname}.7*
%changelog
* Wed Nov 08 2017 Andreas Schneider <asn@redhat.com> - 0.20-1
- Update to version 0.20
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.18-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

View File

@ -1 +1 @@
3be2e3e5a851a49cc5e8567ac108b520 libtermkey-0.18.tar.gz
SHA512 (libtermkey-0.20.tar.gz) = 81a4bc5917c60ca692ec3065ac0252ae5dc1adccc2832be1c83c82318c97473d883900ab88a8a0ee08ab3f831ff07f3a4827ee3d8e936a3a42c4708ee58f6301