Re: Italics in tmux

2011-04-15 Thread Ben Boeckel
Tiago Resende  wrote:
> I'm gonna take a guess here. I think urxvt is reporting to support sitm
> when it actually doesn't, then screen-256color does its switch between
> sitm and smso, then less requests standout but gets italics instead,
> which urxvt simply refuses to render. I just reproduced it with xterm
> exporting TERM=rxvt-unicode-256color.

Fun.

> Can you run
> 
> $ echo '\e[3mitalics\e[m' '\e[7mstandout\e[m'
> 
> in and out of tmux? Both should come out as reverse in tmux , but I'm
> guessing italics will come out as regular text (that is, unrendered
> italics). If this also happens outside of tmux, then your urxvt really
> can't render italics, so if it's repoting \e[3m for sitm in its
> terminfo, that would be the actual culprit here.

Both do normal "italics" and reverse "standout".

> So, could you also attach output of
> 
> $ infocmp $TERM | grep sitm
> 
> ran on urxvt outside of tmux (or just replacing $TERM for what your
> urxvt normally uses)? If your urxvt really does not support italics, you
> should either get nothing or \e[7m instead.

% infocmp rxvt-unicode-256color | grep sitm
sgr0=\E[m\E(B, sitm=\E[3m, smacs=\E(0, smam=\E[?7h,

--Ben


--
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: Italics in tmux

2011-04-15 Thread Tiago Resende
On Friday, 2011-04-15, at 12:30:21 +, Ben Boeckel wrote:
> Tiago Resende  wrote:
> > I'm gonna take a guess here. I think urxvt is reporting to support sitm
> > when it actually doesn't, then screen-256color does its switch between
> > sitm and smso, then less requests standout but gets italics instead,
> > which urxvt simply refuses to render. I just reproduced it with xterm
> > exporting TERM=rxvt-unicode-256color.
> 
> Fun.

This is really screen's fault. If they wanted standout instead of
italics, all they'd have to do is set sitm to \e[7m, there's no reason
to then set smso to \e[3m. No reason at all. (Actually, there probably
_is_ some weird reason behind this, but I have no idea what it might
be).

I'm trying to come up with a way to test for this in tmux's code.
Testing for TERM=screen(-256color) to disable italics even if the
original $TERM supports it sounds pretty awkward. Well, I'll give it
some more thought.

Meanwhile, here's how you can workaround:

a) if you want to have tmux behaving exactly like urxvt, compile a custom
terminfo and tell tmux to use, as discussed previously in this thread:

$ mkdir -p $HOME/.terminfo/
$ infocmp screen-256color | sed \
-e 's/^screen[^|]*|[^,]*,/screen-it|screen with italics support,/' \
-e 's/smso=[^,]*,/smso=\\E[7m,/' \
-e 's/rmso=[^,]*,/rmso=\\E[27m,/' \
-e '$s/$/ sitm=\\E[3m, ritm=\\E[23m,/' > /tmp/terminfo
$ tic /tmp/terminfo
$ echo "set -g default-terminal 'screen-it'" >> ~/.tmux.conf

b) if you want tmux to render italics as reverse, unlike urxvt, then do
the same thing, but get rid of sitm if it exists:

$ mkdir -p $HOME/.terminfo/
$ infocmp screen-256color | sed \
-e 's/^screen[^|]*|[^,]*,/screen-noit|screen with proper standout,/' \
-e 's/smso=[^,]*,/smso=\\E[7m,/' \
-e 's/rmso=[^,]*,/rmso=\\E[27m,/' \
-e 's/ \?sitm=[^,]*,//' \
-e 's/ \?ritm=[^,]*,//' > /tmp/terminfo
$ tic /tmp/terminfo
$ echo "set -g default-terminal 'screen-noit'" >> ~/.tmux.conf

c) if you want tmux _and_ urxvt to render italics as reverse, do the
same as above, but also make your own terminfo for urxvt:

$ infocmp rxvt-unicode-256color | sed \
-e 's/^rxvt[^|]*|[^,]*,/rxvt-unicode-256color-noit|urxvt with no 
italics/' \
-e 's/ \?sitm=[^,]*,//' \
-e 's/ \?ritm=[^,]*,//' >> /tmp/terminfo
$ tic /tmp/terminfo

Then add 'export TERM=rxvt-unicode-256color-noit' to your ~/.zshrc,
~/.bashrc, etc.

BTW, it might be a good idea to check /tmp/terminfo before running tic,
given my past sed performance. ;)

> > $ echo '\e[3mitalics\e[m' '\e[7mstandout\e[m'
> 
> Both do normal "italics" and reverse "standout".

I was thinking, urxvt has always (I think) supported italics, so unless
your build was specifically patched to remove it (not disable it during
/configure, because if that was the case, urxvt _would_ render italics
as reverse), maybe you are just missing a font with italics?

urxvt's faq recommends Bitstream Vera; I personally use Dina. You can
use anything that is installed in your system and has italics.

You can try it with

$ urxvt -fi "xft:Bitstream Vera Sans Mono:italic:autohint=true"

for example. Then, echo '\e[3mitalics\e[m' should render italics. To
store it permanentely, add

urxvt.italicFont: xft:Bitstream Vera Sans Mono:italic:autohint=true

to ~/.Xdefaults

Also, could you let us know if this is the case? If so, it might be a
good idea to mention it in the faq.


--
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: feature request: have mode-keys alter block selection behavior

2011-04-15 Thread Tiago Resende
On Friday, 2011-04-15, at 08:31:26 +0200, Hannes von Haugwitz wrote:
> > Since there is already a means of altering a user's key binding
> > preference using the mode-keys option, I thought it would be a nice if
> > tmux would adjust the selection behavior based on that value as well.
> 
> I second this feature request.

Possible patch attached. As far as I tested, it only behaves differently
from vim when ending the selection at a line break (tmux will consume
that last break, vim will not). I didn't want to mess with
window_copy_copy_line() just to correct that small detail, though.

Could you guys test this and see if it's correct? Could you also test it
in emacs mode, if it isn't too much trouble?
diff -Ndur tmux-orig//window-copy.c tmux/window-copy.c
--- tmux-orig//window-copy.c2011-04-06 19:18:56.0 -0300
+++ tmux/window-copy.c  2011-04-15 10:46:48.199849693 -0300
@@ -1218,6 +1218,7 @@
size_t   off;
u_inti, xx, yy, sx, sy, ex, ey, limit;
u_intfirstsx, lastex, restex, restsx;
+   int  keys;
 
if (!s->sel.flag)
return;
@@ -1254,6 +1255,13 @@
 * end (restex) of all other lines.
 */
xx = screen_size_x(s);
+   /*
+* Behave according to mode-keys. If it is emacs, copy like emacs,
+* keeping the top-left-most character, and dropping the
+* bottom-right-most, regardless of copy direction. If it is vi, also
+* keep bottom-right-most character.
+*/
+   keys = options_get_number(&wp->window->options, "mode-keys");
if (data->rectflag) {
/*
 * Need to ignore the column with the cursor in it, which for
@@ -1261,8 +1269,14 @@
 */
if (data->selx < data->cx) {
/* Selection start is on the left. */
-   lastex = data->cx;
-   restex = data->cx;
+   if (keys == MODEKEY_EMACS) {
+   lastex = data->cx;
+   restex = data->cx;
+   }
+   else {
+   lastex = data->cx + 1;
+   restex = data->cx + 1;
+   }
firstsx = data->selx;
restsx = data->selx;
} else {
@@ -1273,11 +1287,10 @@
restsx = data->cx;
}
} else {
-   /*
-* Like emacs, keep the top-left-most character, and drop the
-* bottom-right-most, regardless of copy direction.
-*/
-   lastex = ex;
+   if (keys == MODEKEY_EMACS)
+   lastex = ex;
+   else
+   lastex = ex + 1;
restex = xx;
firstsx = sx;
restsx = 0;
--
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: shift+pageup/pagedown

2011-04-15 Thread Tomas Cech

On Thu, Feb 24, 2011 at 06:57:30PM +, Nicholas Marriott wrote:

sure. let me know when you've got it working


Konsole patch is now applied in upstream and should be released in KDE
4.7. Then it is possible to create such behaviour by configuration
only since alternate screen buffer status can be used as 'key
modifier'. But it may be too complicated approach.

I'm just thinking about this more and it would be probably better idea
to create such behaviour independent on alternate screen. Probably
introduce some new set of escape sequences to set/indicate that
application/terminal is capable of this behaviour.

So, application which would like to take care of scrollback buffer by
itself should first try if terminal has this capability and then
request it by some special escape sequence. Then terminal can send
'scrolling requests' events for line, page or even position of
scrollbar. This could be also useful for apps like less (scrollbar
scrolls text shown by less), mutt (e-mail list or e-mail message
scrolling) etc. I would like to create RFC for that and help will be
appreciated.

Best regards,

Sleep_Walker



pgpYoROlS0lkS.pgp
Description: PGP signature
--
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: feature request: have mode-keys alter block selection behavior

2011-04-15 Thread Tiago Resende
On Friday, 2011-04-15, at 10:44:08 -0700, Aaron Bull Schaefer wrote:
> Yes, this WORKS! I tested both emacs and vi modes and this is exactly
> what I was looking for. Thanks for such a quick patch!

My pleasure. :)

I hope you don't mind that I cc this to the list, just to let the record
show.


--
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: [SOLVED; PEBKAC] Re: tmux refusing to do utf8

2011-04-15 Thread Karl Ferdinand Ebert
Hi,


On Friday 15 of April 2011 01:19:10 Tiago Resende wrote:
> I also figured out why it wasn't working for me without -u. My LC_ALL,
> instead of being unset, was set to an empty string. So, tmux was
> assuming I was utf8-less instead of going on to check LC_CTYPE and LANG.
> In conclusion, please disregard all I said above.

it seems to me that the proposed patch would solve an empty (but not unset) 
LC_ALL in this bug report:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=622772

Best regards,

Ferdinand

--
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: [SOLVED; PEBKAC] Re: tmux refusing to do utf8

2011-04-15 Thread Nicholas Marriott
Hi

I don't know about this because an empty variable is not the same as
being unset and I think it is confusing to treat them the same. But
maybe I'm just being pedantic, I can't really think of a case where
having an empty LC_ALL or LC_CTYPE would be useful...


On Fri, Apr 15, 2011 at 10:57:30PM +0200, Karl Ferdinand Ebert wrote:
> Hi,
> 
> 
> On Friday 15 of April 2011 01:19:10 Tiago Resende wrote:
> > I also figured out why it wasn't working for me without -u. My LC_ALL,
> > instead of being unset, was set to an empty string. So, tmux was
> > assuming I was utf8-less instead of going on to check LC_CTYPE and LANG.
> > In conclusion, please disregard all I said above.
> 
> it seems to me that the proposed patch would solve an empty (but not unset) 
> LC_ALL in this bug report:
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=622772
> 
> Best regards,
> 
> Ferdinand
> 
> --
> Benefiting from Server Virtualization: Beyond Initial Workload 
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve 
> application availability and disaster protection. Learn more about boosting 
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> ___
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

--
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users


Re: Italics in tmux

2011-04-15 Thread Ben Boeckel
Tiago Resende  wrote:
> I was thinking, urxvt has always (I think) supported italics, so unless
> your build was specifically patched to remove it (not disable it during
> /configure, because if that was the case, urxvt _would_ render italics
> as reverse), maybe you are just missing a font with italics?

Indeed. I'm using terminus which doesn't have italics built-in.

> urxvt's faq recommends Bitstream Vera; I personally use Dina. You can
> use anything that is installed in your system and has italics.
> 
> You can try it with
> 
> $ urxvt -fi "xft:Bitstream Vera Sans Mono:italic:autohint=true"
> 
> for example. Then, echo '\e[3mitalics\e[m' should render italics. To
> store it permanentely, add
> 
> urxvt.italicFont: xft:Bitstream Vera Sans Mono:italic:autohint=true
> 
> to ~/.Xdefaults
> 
> Also, could you let us know if this is the case? If so, it might be a
> good idea to mention it in the faq.

Thanks, this works :) . The FAQ sounds like a good place for it.

--Ben


--
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
___
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users