Closed exalted closed 9 years ago
More input here: at first I thought it could be due an another alias
of mine, that is alias diff='colourify diff'
(installed via brew install grc
), but even when I unalias diff
, it didn't change a thing... :confused:
@exalted: I am not sure what's going on there, but apparently .gitconfig
won't recognize bash aliases. As a result less
will run without -R
.
Appending less -R
to your git alias should solve the issue :sparkles:
Just tried with ! git --no-pager log --color --pretty=format:'%C(yellow)%h%C(reset)%C(bold red)%d%C(reset) %s %C(black)— %an (%ad)%C(reset)' --relative-date | emojify | less -R
git alias as well, but not I have this:
@exalted: what's the result of the following command?
$ echo ":art:" | emojify
P.S.: this gem is the hardest :shit: to report issues to... Haha!
Without less
(or less -R
for that matter), I can see emojis just fine (but without pager).
@exalted: what's the output of the following command?
$ locale
Oh, nice try!
LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
@as-cii what's yours?
This is mine:
LANG=
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
Try exporting these variables in your bash configuration:
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
This should work like a charm :fire:
I export
ed all that for a minute, like so:
export LANG=
export LC_COLLATE="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
The output is still missing :smiley: s.
So :cry: ...
@exalted: holy crap! Sorry if this is causing headaches to you :disappointed:
What version of less
are you using? Mine is 471
Haha, no problem. I should investigate better my setup rather than complaning in the first place, but here you go:
less 418
Copyright (C) 1984-2007 Mark Nudelman
less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less
:open_mouth:
Apparently you have a system version of the utility. What happens if you update less
via the following command?
brew install less
@as-cii Did you install via brew install homebrew/dupes/less
or somewhere else? Because homebrew duped version is:
less 458 (POSIX regular expressions)
Copyright (C) 1984-2012 Mark Nudelman
less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less
@exalted Yes, I did. brew info
outputs:
less: stable 458
http://www.greenwoodsoftware.com/less/index.html
/usr/local/Cellar/less/458 (11 files, 356K)
Built from source
/usr/local/Cellar/less/471 (11 files, 360K) *
Poured from bottle
From: https://github.com/homebrew/homebrew-dupes/blob/master/less.rb
==> Dependencies
Optional: pcre ✔
==> Options
--with-pcre
Build with pcre support
Apparently I updated before they reverted this commit https://github.com/Homebrew/homebrew-dupes/commit/7999a6293307ddee66a3e0710842b0260325b1fc. Whatever.
Does updating to 458
solve anything?
Nope. Same :hankey: . What's Poured from bottle
? I only have:
less: stable 458
http://www.greenwoodsoftware.com/less/index.html
/usr/local/Cellar/less/458 (11 files, 352K) *
Built from source
From: https://github.com/homebrew/homebrew-dupes/blob/master/less.rb
==> Dependencies
Optional: pcre ✔
==> Options
--with-pcre
Build with pcre support
Maybe you installed from another source? What's your brew tap
says? Mine:
homebrew/dupes
thoughtbot/formulae
@exalted: sorry, I updated the comment so you probably didn't notice. Basically, I had a beta version which homebrew people released but reverted afterwards.
Reverting to 458
shows the exact behavior you're reporting here :scream:
I'll update the README.md now, but using less -r
instead of less -R
solves the issue. From the docs:
-r or --raw-control-chars
Causes "raw" control characters to be displayed. The default is to display control characters using the caret notation;
for example, a control-A (octal 001) is displayed as "^A". Warning: when the -r option is used, less cannot keep track
of the actual appearance of the screen (since this depends on how the screen responds to each type of control character).
Thus, various display problems may result, such as long lines being split in the wrong place.
-R or --RAW-CONTROL-CHARS
Like -r, but only ANSI "color" escape sequences are output in "raw" form. Unlike -r, the screen appearance is maintained
correctly in most cases. ANSI "color" escape sequences are sequences of the form:
ESC [ ... m
where the "..." is zero or more color specification characters For the purpose of keeping track of screen appearance,
ANSI color escape sequences are assumed to not move the cursor. You can make less think that characters other than "m"
can end ANSI color escape sequences by setting the environment variable LESSANSIENDCHARS to the list of characters which
can end a color escape sequence. And you can make less think that characters other than the standard ones may appear
between the ESC and the m by setting the environment variable LESSANSIMIDCHARS to the list of characters which can
appear.
Thank you @exalted
Wtf?! -r
?!?! That’s so boring. Haha. Thank you!
I will try asap, bit I am sure it will work.
I hereby confirm that -r
is the :hankey: Works like :fireworks:
Thanks and :hand: :five:
Side note: system less
works just fine.
@exalted: yeah, I suspected that. However, I'll keep the notice in README.md
to avoid any kind of issue related to an old version.
Thanks for pointing that out, though. Your help was very precious :gem:
Just a quick feedback here: When less
is used with -r
(that is --raw-control-chars
and note it’s lowercase!) you will hit an issue with the way less
calculates line lengths, therefore if a single line of log is longer than your $COLUMNS
it will “wrap” it to the next line.
Most of the time it should be enough to pass --chop-long-lines
to less
to “chop” whatever exceeds $COLUMNS
length, but as per http://greenwoodsoftware.com/less/faq.html#dashr essentially “disables"
--chop-long-lines`, so here we are back to having lines wrapping.
Also, if the first ever line of your logs is longer than your terminal’s length, then less
will fail to show its first line, unless you don’t scroll down/up to read it.
Anyhow, I wrote to Mark Nudelman (author of less
), but I am not sure if this is something he’s willing to “fix”, or whatever.
In the meantime I came across to most
:
If
less
is more thanmore
,most
is more thanless
.
And that’s quite literally fu**ed up. Nevertheless, most
works beautifully with emojis, with proper line wrapping and what not.
If, ever, anyone will be headed here in future, they will now! :punch:
Also, apparently the "problem" with less
is that latest version available on homebrew, as of today, doesn't include most of the emoji codes, therefore using --RAW-CONTROL-CHARS
will show them similar to <U+719827>
.
I talked to Mark, and upon his request compiled the beta version less-471
(it's in beta since 14 Dec 2014 :scream:), to find that --RAW-CONTROL-CHARS
works beautifully!
So, to wrap this thing up: you really shouldn't use --raw-control-chars
flag, because it is not reliable :art:-wise, instead you might want to use --RAW-CONTROL-CHARS
with the beta version of less
, OR try most
, as suggested earlier.
thx
Check out this quick screencast I recorded: http://quick.as/yYxXiQ4qO