Discussion:
[tmux:tickets] #162 Tmux adds a space between leftmost sections
firedev
2014-10-26 02:33:42 UTC
Permalink
---

** [tickets:#162] Tmux adds a space between leftmost sections**

**Status:** open
**Labels:** interface
**Created:** Sun Oct 26, 2014 02:33 AM UTC by firedev
**Last Updated:** Sun Oct 26, 2014 02:33 AM UTC
**Owner:** nobody

Hi, I made a minimal theme for tmux with the help of Tmuxline:

![](Loading Image...)

But I can't get rid of an ugly space separating the hostname and tabs. Tmuxline author suggested that it is added by tmux: https://github.com/edkolev/tmuxline.vim/issues/28

Please consider addind a way to get rid of it, thanks. In fact why it is even needed?


---

Sent from sourceforge.net because tmux-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/tmux/tickets/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/tmux/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Balazs Kezes
2014-10-30 22:56:08 UTC
Permalink
Don't force adding spaces after/before the window list. This can rather be
achieved by changing the status-left/status-right options. In fact when
status-justify is right meaning we place the window list to the right, we will
see two separating spaces by default: one for window-status-separator and one
for the forced space. This patch also fixes that.
---
The OP's issue should be quite simply fixable if you move the extra space into
the status-left option form which it can be easily removed by the users.

options-table.c | 2 +-
status.c | 12 +++++-------
tmux.1 | 4 +++-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/options-table.c b/options-table.c
index 8d680b3..3dfa004 100644
--- a/options-table.c
+++ b/options-table.c
@@ -389,7 +389,7 @@ const struct options_table_entry session_options_table[] = {

{ .name = "status-left",
.type = OPTIONS_TABLE_STRING,
- .default_str = "[#S]"
+ .default_str = "[#S] "
},

{ .name = "status-left-attr",
diff --git a/status.c b/status.c
index 19b0ec8..d2a18da 100644
--- a/status.c
+++ b/status.c
@@ -193,9 +193,9 @@ status_redraw(struct client *c)
*/
needed = 0;
if (llen != 0)
- needed += llen + 1;
+ needed += llen;
if (rlen != 0)
- needed += rlen + 1;
+ needed += rlen;
if (c->tty.sx == 0 || c->tty.sx <= needed)
goto out;
wlavailable = c->tty.sx - needed;
@@ -302,7 +302,6 @@ draw:
screen_write_cursormove(&ctx, 0, 0);
if (llen != 0) {
screen_write_cnputs(&ctx, llen, &lgc, utf8flag, "%s", left);
- screen_write_putc(&ctx, &stdgc, ' ');
}
if (larrow != 0) {
memcpy(&gc, &stdgc, sizeof gc);
@@ -313,21 +312,20 @@ draw:

/* Draw the right string and arrow. */
if (rarrow != 0) {
- screen_write_cursormove(&ctx, c->tty.sx - rlen - 2, 0);
+ screen_write_cursormove(&ctx, c->tty.sx - rlen - 1, 0);
memcpy(&gc, &stdgc, sizeof gc);
if (rarrow == -1)
gc.attr ^= GRID_ATTR_REVERSE;
screen_write_putc(&ctx, &gc, '>');
} else
- screen_write_cursormove(&ctx, c->tty.sx - rlen - 1, 0);
+ screen_write_cursormove(&ctx, c->tty.sx - rlen, 0);
if (rlen != 0) {
- screen_write_putc(&ctx, &stdgc, ' ');
screen_write_cnputs(&ctx, rlen, &rgc, utf8flag, "%s", right);
}

/* Figure out the offset for the window list. */
if (llen != 0)
- wloffset = llen + 1;
+ wloffset = llen;
else
wloffset = 0;
if (wlwidth < wlavailable) {
diff --git a/tmux.1 b/tmux.1
index 273bcdc..c4bc954 100644
--- a/tmux.1
+++ b/tmux.1
@@ -2584,7 +2584,9 @@ By default, UTF-8 in
.Ar string
is not interpreted, to enable UTF-8, use the
.Ic status-utf8
-option.
+option. The default is
+.Ql [#S]\
+which is the session's name in square brackets.
.It Ic status-left-length Ar length
Set the maximum
.Ar length
--
2.1.3


------------------------------------------------------------------------------
Nicholas Marriott
2014-11-05 23:15:28 UTC
Permalink
Applied, thanks.
Post by Balazs Kezes
Don't force adding spaces after/before the window list. This can rather be
achieved by changing the status-left/status-right options. In fact when
status-justify is right meaning we place the window list to the right, we will
see two separating spaces by default: one for window-status-separator and one
for the forced space. This patch also fixes that.
---
The OP's issue should be quite simply fixable if you move the extra space into
the status-left option form which it can be easily removed by the users.
options-table.c | 2 +-
status.c | 12 +++++-------
tmux.1 | 4 +++-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/options-table.c b/options-table.c
index 8d680b3..3dfa004 100644
--- a/options-table.c
+++ b/options-table.c
@@ -389,7 +389,7 @@ const struct options_table_entry session_options_table[] = {
{ .name = "status-left",
.type = OPTIONS_TABLE_STRING,
- .default_str = "[#S]"
+ .default_str = "[#S] "
},
{ .name = "status-left-attr",
diff --git a/status.c b/status.c
index 19b0ec8..d2a18da 100644
--- a/status.c
+++ b/status.c
@@ -193,9 +193,9 @@ status_redraw(struct client *c)
*/
needed = 0;
if (llen != 0)
- needed += llen + 1;
+ needed += llen;
if (rlen != 0)
- needed += rlen + 1;
+ needed += rlen;
if (c->tty.sx == 0 || c->tty.sx <= needed)
goto out;
wlavailable = c->tty.sx - needed;
screen_write_cursormove(&ctx, 0, 0);
if (llen != 0) {
screen_write_cnputs(&ctx, llen, &lgc, utf8flag, "%s", left);
- screen_write_putc(&ctx, &stdgc, ' ');
}
if (larrow != 0) {
memcpy(&gc, &stdgc, sizeof gc);
/* Draw the right string and arrow. */
if (rarrow != 0) {
- screen_write_cursormove(&ctx, c->tty.sx - rlen - 2, 0);
+ screen_write_cursormove(&ctx, c->tty.sx - rlen - 1, 0);
memcpy(&gc, &stdgc, sizeof gc);
if (rarrow == -1)
gc.attr ^= GRID_ATTR_REVERSE;
screen_write_putc(&ctx, &gc, '>');
} else
- screen_write_cursormove(&ctx, c->tty.sx - rlen - 1, 0);
+ screen_write_cursormove(&ctx, c->tty.sx - rlen, 0);
if (rlen != 0) {
- screen_write_putc(&ctx, &stdgc, ' ');
screen_write_cnputs(&ctx, rlen, &rgc, utf8flag, "%s", right);
}
/* Figure out the offset for the window list. */
if (llen != 0)
- wloffset = llen + 1;
+ wloffset = llen;
else
wloffset = 0;
if (wlwidth < wlavailable) {
diff --git a/tmux.1 b/tmux.1
index 273bcdc..c4bc954 100644
--- a/tmux.1
+++ b/tmux.1
@@ -2584,7 +2584,9 @@ By default, UTF-8 in
.Ar string
is not interpreted, to enable UTF-8, use the
.Ic status-utf8
-option.
+option. The default is
+.Ql [#S]\
+which is the session's name in square brackets.
.It Ic status-left-length Ar length
Set the maximum
.Ar length
--
2.1.3
------------------------------------------------------------------------------
_______________________________________________
tmux-users mailing list
https://lists.sourceforge.net/lists/listinfo/tmux-users
------------------------------------------------------------------------------
Loading...