Update to version 2.6

This commit is contained in:
Andreas Schneider 2018-01-26 19:06:15 +01:00
parent 8357d20ea2
commit 0cd5137691
6 changed files with 334 additions and 18 deletions

1
.gitignore vendored
View File

@ -12,3 +12,4 @@ tmux-1.3.tar.gz
/tmux-2.3.tar.gz
/tmux-2.4.tar.gz
/tmux-2.5.tar.gz
/tmux-2.6.tar.gz

View File

@ -1 +1 @@
SHA512 (tmux-2.5.tar.gz) = c0e8365a553d034e347f2f7a0d64f04e2be4307a75a9f72c8218fc56b72e531f3f37fe4a8f0e8d70801f5f62ee250ab7e9978abd6d101d273f76b4a1a92b08e0
SHA512 (tmux-2.6.tar.gz) = 20a1ae8b8494c5b42757902322f3877731c2cc330c9c00f097a317785d25252b7ebaa8bbab9fc17843299e80cb2914aaac0a664715a85c50f7ea489d23753832

View File

@ -0,0 +1,29 @@
From 6e5121be7e280914f1116189b04c9c7a4b5f1590 Mon Sep 17 00:00:00 2001
From: nicm <nicm>
Date: Wed, 11 Oct 2017 11:26:58 +0000
Subject: [PATCH] Clear to end of line properly with UTF-8 present.
---
mode-tree.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mode-tree.c b/mode-tree.c
index 7b3787950..349cda493 100644
--- a/mode-tree.c
+++ b/mode-tree.c
@@ -554,10 +554,12 @@ mode_tree_draw(struct mode_tree_data *mtd)
}
if (i != mtd->current) {
- screen_write_puts(&ctx, &gc0, "%.*s", w, text);
+ screen_write_nputs(&ctx, w, &gc0, "%s", text);
screen_write_clearendofline(&ctx, 8);
- } else
- screen_write_puts(&ctx, &gc, "%-*.*s", w, w, text);
+ } else {
+ screen_write_nputs(&ctx, w, &gc, "%s", text);
+ screen_write_clearendofline(&ctx, gc.bg);
+ }
free(text);
if (mti->tagged) {

View File

@ -0,0 +1,204 @@
From c03565611e41649ce9295012faec2f0eddb2a822 Mon Sep 17 00:00:00 2001
From: nicm <nicm>
Date: Fri, 12 Jan 2018 16:32:12 +0000
Subject: [PATCH] Simplify UTF-8 states down into one state.
---
input.c | 120 ++++++++++++----------------------------------------------------
1 file changed, 22 insertions(+), 98 deletions(-)
diff --git a/input.c b/input.c
index 42ff7f3b2..cce4df1f7 100644
--- a/input.c
+++ b/input.c
@@ -85,6 +85,7 @@ struct input_ctx {
u_int param_list_len;
struct utf8_data utf8data;
+ int utf8started;
int ch;
int last;
@@ -146,9 +147,7 @@ static void input_csi_dispatch_sgr_256(struct input_ctx *, int, u_int *);
static void input_csi_dispatch_sgr_rgb(struct input_ctx *, int, u_int *);
static void input_csi_dispatch_sgr(struct input_ctx *);
static int input_dcs_dispatch(struct input_ctx *);
-static int input_utf8_open(struct input_ctx *);
-static int input_utf8_add(struct input_ctx *);
-static int input_utf8_close(struct input_ctx *);
+static int input_top_bit_set(struct input_ctx *);
/* Command table comparison function. */
static int input_table_compare(const void *, const void *);
@@ -314,9 +313,6 @@ static const struct input_transition input_state_osc_string_table[];
static const struct input_transition input_state_apc_string_table[];
static const struct input_transition input_state_rename_string_table[];
static const struct input_transition input_state_consume_st_table[];
-static const struct input_transition input_state_utf8_three_table[];
-static const struct input_transition input_state_utf8_two_table[];
-static const struct input_transition input_state_utf8_one_table[];
/* ground state definition. */
static const struct input_state input_state_ground = {
@@ -437,27 +433,6 @@ static const struct input_state input_state_consume_st = {
input_state_consume_st_table
};
-/* utf8_three state definition. */
-static const struct input_state input_state_utf8_three = {
- "utf8_three",
- NULL, NULL,
- input_state_utf8_three_table
-};
-
-/* utf8_two state definition. */
-static const struct input_state input_state_utf8_two = {
- "utf8_two",
- NULL, NULL,
- input_state_utf8_two_table
-};
-
-/* utf8_one state definition. */
-static const struct input_state input_state_utf8_one = {
- "utf8_one",
- NULL, NULL,
- input_state_utf8_one_table
-};
-
/* ground state table. */
static const struct input_transition input_state_ground_table[] = {
INPUT_STATE_ANYWHERE,
@@ -467,11 +442,7 @@ static const struct input_transition input_state_ground_table[] = {
{ 0x1c, 0x1f, input_c0_dispatch, NULL },
{ 0x20, 0x7e, input_print, NULL },
{ 0x7f, 0x7f, NULL, NULL },
- { 0x80, 0xc1, NULL, NULL },
- { 0xc2, 0xdf, input_utf8_open, &input_state_utf8_one },
- { 0xe0, 0xef, input_utf8_open, &input_state_utf8_two },
- { 0xf0, 0xf4, input_utf8_open, &input_state_utf8_three },
- { 0xf5, 0xff, NULL, NULL },
+ { 0x80, 0xff, input_top_bit_set, NULL },
{ -1, -1, NULL, NULL }
};
@@ -717,39 +688,6 @@ static const struct input_transition input_state_consume_st_table[] = {
{ -1, -1, NULL, NULL }
};
-/* utf8_three state table. */
-static const struct input_transition input_state_utf8_three_table[] = {
- /* No INPUT_STATE_ANYWHERE */
-
- { 0x00, 0x7f, NULL, &input_state_ground },
- { 0x80, 0xbf, input_utf8_add, &input_state_utf8_two },
- { 0xc0, 0xff, NULL, &input_state_ground },
-
- { -1, -1, NULL, NULL }
-};
-
-/* utf8_two state table. */
-static const struct input_transition input_state_utf8_two_table[] = {
- /* No INPUT_STATE_ANYWHERE */
-
- { 0x00, 0x7f, NULL, &input_state_ground },
- { 0x80, 0xbf, input_utf8_add, &input_state_utf8_one },
- { 0xc0, 0xff, NULL, &input_state_ground },
-
- { -1, -1, NULL, NULL }
-};
-
-/* utf8_one state table. */
-static const struct input_transition input_state_utf8_one_table[] = {
- /* No INPUT_STATE_ANYWHERE */
-
- { 0x00, 0x7f, NULL, &input_state_ground },
- { 0x80, 0xbf, input_utf8_close, &input_state_ground },
- { 0xc0, 0xff, NULL, &input_state_ground },
-
- { -1, -1, NULL, NULL }
-};
-
/* Input table compare. */
static int
input_table_compare(const void *key, const void *value)
@@ -1059,6 +997,8 @@ input_print(struct input_ctx *ictx)
{
int set;
+ ictx->utf8started = 0; /* can't be valid UTF-8 */
+
set = ictx->cell.set == 0 ? ictx->cell.g0set : ictx->cell.g1set;
if (set == 1)
ictx->cell.cell.attr |= GRID_ATTR_CHARSET;
@@ -1132,6 +1072,8 @@ input_c0_dispatch(struct input_ctx *ictx)
struct window_pane *wp = ictx->wp;
struct screen *s = sctx->s;
+ ictx->utf8started = 0; /* can't be valid UTF-8 */
+
log_debug("%s: '%c'", __func__, ictx->ch);
switch (ictx->ch) {
@@ -2064,47 +2006,29 @@ input_exit_rename(struct input_ctx *ictx)
/* Open UTF-8 character. */
static int
-input_utf8_open(struct input_ctx *ictx)
+input_top_bit_set(struct input_ctx *ictx)
{
struct utf8_data *ud = &ictx->utf8data;
- if (utf8_open(ud, ictx->ch) != UTF8_MORE)
- fatalx("UTF-8 open invalid %#x", ictx->ch);
-
- log_debug("%s %hhu", __func__, ud->size);
ictx->last = -1;
- return (0);
-}
-
-/* Append to UTF-8 character. */
-static int
-input_utf8_add(struct input_ctx *ictx)
-{
- struct utf8_data *ud = &ictx->utf8data;
-
- if (utf8_append(ud, ictx->ch) != UTF8_MORE)
- fatalx("UTF-8 add invalid %#x", ictx->ch);
-
- log_debug("%s", __func__);
-
- return (0);
-}
-
-/* Close UTF-8 string. */
-static int
-input_utf8_close(struct input_ctx *ictx)
-{
- struct utf8_data *ud = &ictx->utf8data;
+ if (!ictx->utf8started) {
+ if (utf8_open(ud, ictx->ch) != UTF8_MORE)
+ return (0);
+ ictx->utf8started = 1;
+ return (0);
+ }
- if (utf8_append(ud, ictx->ch) != UTF8_DONE) {
- /*
- * An error here could be invalid UTF-8 or it could be a
- * nonprintable character for which we can't get the
- * width. Drop it.
- */
+ switch (utf8_append(ud, ictx->ch)) {
+ case UTF8_MORE:
+ return (0);
+ case UTF8_ERROR:
+ ictx->utf8started = 0;
return (0);
+ case UTF8_DONE:
+ break;
}
+ ictx->utf8started = 0;
log_debug("%s %hhu '%*s' (width %hhu)", __func__, ud->size,
(int)ud->size, ud->data, ud->width);

View File

@ -0,0 +1,85 @@
From aeda2e5808af7c4b629dce23d2b4331a77ecde83 Mon Sep 17 00:00:00 2001
From: nicm <nicm>
Date: Wed, 15 Nov 2017 19:18:57 +0000
Subject: [PATCH] If there is a double width character at the very end of the
line with not enough room to draw it, just leave it out.
---
tty.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/tty.c b/tty.c
index 90361e3fb..0dee5008e 100644
--- a/tty.c
+++ b/tty.c
@@ -882,6 +882,7 @@ void
tty_draw_line(struct tty *tty, const struct window_pane *wp,
struct screen *s, u_int py, u_int ox, u_int oy)
{
+ struct grid *gd = s->grid;
struct grid_cell gc, last;
u_int i, j, ux, sx, nx, width;
int flags, cleared = 0;
@@ -900,15 +901,15 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
* there may be empty background cells after it (from BCE).
*/
sx = screen_size_x(s);
- if (sx > s->grid->linedata[s->grid->hsize + py].cellsize)
- sx = s->grid->linedata[s->grid->hsize + py].cellsize;
+ if (sx > gd->linedata[gd->hsize + py].cellsize)
+ sx = gd->linedata[gd->hsize + py].cellsize;
if (sx > tty->sx)
sx = tty->sx;
ux = 0;
if (wp == NULL ||
py == 0 ||
- (~s->grid->linedata[s->grid->hsize + py - 1].flags & GRID_LINE_WRAPPED) ||
+ (~gd->linedata[gd->hsize + py - 1].flags & GRID_LINE_WRAPPED) ||
ox != 0 ||
tty->cx < tty->sx ||
screen_size_x(s) < tty->sx) {
@@ -932,7 +933,7 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
width = 0;
for (i = 0; i < sx; i++) {
- grid_view_get_cell(s->grid, i, py, &gc);
+ grid_view_get_cell(gd, i, py, &gc);
if (len != 0 &&
(((~tty->flags & TTY_UTF8) &&
(gc.data.size != 1 ||
@@ -943,6 +944,7 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
gc.attr != last.attr ||
gc.fg != last.fg ||
gc.bg != last.bg ||
+ ux + width + gc.data.width >= screen_size_x(s) ||
(sizeof buf) - len < gc.data.size)) {
tty_attributes(tty, &last, wp);
tty_putn(tty, buf, len, width);
@@ -956,7 +958,14 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
screen_select_cell(s, &last, &gc);
else
memcpy(&last, &gc, sizeof last);
- if (((~tty->flags & TTY_UTF8) &&
+ if (ux + gc.data.width > screen_size_x(s))
+ for (j = 0; j < gc.data.width; j++) {
+ if (ux + j > screen_size_x(s))
+ break;
+ tty_putc(tty, ' ');
+ ux++;
+ }
+ else if (((~tty->flags & TTY_UTF8) &&
(gc.data.size != 1 ||
*gc.data.data >= 0x7f ||
gc.data.width != 1)) ||
@@ -993,8 +1002,8 @@ tty_draw_line(struct tty *tty, const struct window_pane *wp,
}
}
- nx = screen_size_x(s) - ux;
- if (!cleared && ux < tty->sx && nx != 0) {
+ if (!cleared && ux < screen_size_x(s)) {
+ nx = screen_size_x(s) - ux;
tty_default_attributes(tty, wp, 8);
tty_clear_line(tty, wp, oy + py, ox + ux, nx, 8);
}

View File

@ -1,6 +1,8 @@
%global _hardened_build 1
Name: tmux
Version: 2.5
Release: 4%{?dist}
Version: 2.6
Release: 1%{?dist}
Summary: A terminal multiplexer
Group: Applications/System
@ -11,14 +13,10 @@ URL: https://tmux.github.io/
Source0: https://github.com/tmux/%{name}/releases/download/%{version}/%{name}-%{version}.tar.gz
# Examples has been removed - so include the bash_completion here
Source1: bash_completion_tmux.sh
# tmuxinator wouldn't start with tmux 2.5
# tmuxinator discussion: https://github.com/tmuxinator/tmuxinator/issues/536
# tmux discussion (states that the patch won't be backported to 2.5):
# https://github.com/tmux/tmux/issues/971
Patch0: tmux-2.5-fail-on-no-target.diff
#https://bugzilla.redhat.com/show_bug.cgi?id=1476851
#https://github.com/tmux/tmux/issues/1027#issuecomment-319088791
Patch1: tmux-2.5-bell-action-other-ignored.diff
Patch0: tmux-2.6-fix-line-clear-utf8.patch
Patch1: tmux-2.6-fix-wide-chars.patch
Patch2: tmux-2.6-fix-utf8-char-handling.patch
BuildRequires: ncurses-devel
BuildRequires: libevent-devel
@ -31,16 +29,11 @@ intended to be a simple, modern, BSD-licensed alternative to programs such
as GNU Screen.
%prep
#%setup -q
%autosetup
%build
CFLAGS="$RPM_OPT_FLAGS -fPIC -pie -Wl,-z,relro -Wl,-z,now"
CXXFLAGS="$RPM_OPT_FLAGS -fPIC -pie -Wl,-z,relro -Wl,-z,now"
export CFLAGS
export CXXFLAGS
%configure
make %{?_smp_mflags} LDFLAGS="%{optflags}"
make %{?_smp_mflags}
%install
@ -68,12 +61,16 @@ if [ "$1" = 0 ] && [ -f %{_sysconfdir}/shells ] ; then
fi
%files
%doc CHANGES FAQ TODO
%doc CHANGES TODO
%{_bindir}/tmux
%{_mandir}/man1/tmux.1.*
%{_datadir}/bash-completion/completions/tmux
%changelog
* Fri Jan 26 2018 Andreas Schneider <asn@redhat.com> - 2.6-1
- Update to version 2.6
- Use hardened build
* Sat Aug 05 2017 Filipe Rosset <rosset.filipe@gmail.com> - 2.5-4
- Fixes rhbz #1476851 tmux bell-action other not working
- Fixes rhbz #1476892 tmux update in F26 broke tmuxinator