Fixed ctrl+space problem

Resolves: rhbz#1854822
This commit is contained in:
Jaroslav Škarvada 2020-07-08 15:25:59 +02:00
parent bcaaff6110
commit cb186d25d7
2 changed files with 48 additions and 2 deletions

View File

@ -0,0 +1,38 @@
From a0544571a80196e5b7705f56e6e2cbcdf7b4d80e Mon Sep 17 00:00:00 2001
From: ailin-nemui <ailin-nemui@users.noreply.github.com>
Date: Thu, 23 Apr 2020 21:45:15 +0200
Subject: [PATCH] manually handle NUL unicode in g_utf8_get_next_char_validated
A change in GLib 2.63 broke some assumptions in Irssi that the null-byte
NUL / U+0000 is a valid Unicode character. This would occur when the
user types Ctrl+Space. As a result, the input loop never manages to
process the NUL-byte (and any other user input that follows, ever).
This patch adds a manual check that properly advances the input loop if
GLib returns -2 (incomplete character) despite the length being positive
and a NUL is in first position.
Fixes #1180
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/967
https://gitlab.gnome.org/GNOME/glib/-/issues/2093
---
src/fe-text/term-terminfo.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c
index 5235f72d2..78496a64f 100644
--- a/src/fe-text/term-terminfo.c
+++ b/src/fe-text/term-terminfo.c
@@ -672,7 +672,11 @@ void term_stop(void)
static int input_utf8(const unsigned char *buffer, int size, unichar *result)
{
- unichar c = g_utf8_get_char_validated((char *)buffer, size);
+ unichar c = g_utf8_get_char_validated((char *) buffer, size);
+
+ /* GLib >= 2.63 do not accept Unicode NUL anymore */
+ if (c == (unichar) -2 && *buffer == 0 && size > 0)
+ c = 0;
switch (c) {
case (unichar)-1:

View File

@ -3,7 +3,7 @@
Summary: Modular text mode IRC client with Perl scripting Summary: Modular text mode IRC client with Perl scripting
Name: irssi Name: irssi
Version: 1.2.2 Version: 1.2.2
Release: 4%{?dist} Release: 5%{?dist}
License: GPLv2+ License: GPLv2+
URL: http://irssi.org/ URL: http://irssi.org/
@ -15,7 +15,9 @@ BuildRequires: autoconf automake libtool utf8proc-devel libotr-devel
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
# rhbz#1773190 # rhbz#1773190
Obsoletes: irc-otr Obsoletes: irc-otr
# https://github.com/irssi/irssi/pull/1183
Patch: irssi-1.2.2-ctrl-space-fix.patch
%package devel %package devel
Summary: Development package for irssi Summary: Development package for irssi
@ -36,6 +38,8 @@ being maintained.
%prep %prep
%setup -q %setup -q
%patch0 -p1 -b .ctrl-space-fix
%build %build
autoreconf -i autoreconf -i
@ -83,6 +87,10 @@ chmod -R u+w $RPM_BUILD_ROOT%{perl_vendorarch}
%changelog %changelog
* Wed Jul 8 2020 Jaroslav Škarvada <jskarvad@redhat.com> - 1.2.2-5
- Fixed ctrl+space problem
Resolves: rhbz#1854822
* Mon Jun 22 2020 Jitka Plesnikova <jplesnik@redhat.com> - 1.2.2-4 * Mon Jun 22 2020 Jitka Plesnikova <jplesnik@redhat.com> - 1.2.2-4
- Perl 5.32 rebuild - Perl 5.32 rebuild