On 23Oct2012 17:39, Alex Efros <power...@powerman.name> wrote:
| I'm currently using mutt in xterm, and I finally got tired of copy&paste
| long urls (wrapped in multiple lines) from mutt to browser. Ideally, I'd
| like to be able to open urls by clicking them.
| 
| It looks like xterm doesn't support clicking on urls, so I'm ready to
| switch to any other terminal emulator which will support this feature.

I'm using iTerm2 on a Mac, but on X11 setups I use rxvt-unicode
(command name "urxvt").

Both support URL clicking.

| Right now I'm experimenting with Konsole, but it's just a random choice.

I went with gnome-terminal ahead of Konsole last time I was without
rxvt-unicode, but that was some years ago and was entirely because
Konsole refused to treat Shift-Return as Return, a common typing error
of mine at the ends of certain lines :-(

|     Side note about 'markers': I'd like them, but had to switch them off
|     to avoid junk inside urls. Ideally, I'd like to be able to have
|     markers in all wrapped lines except inside urls - is that possible?

Aside: what are "markers"?

| Problem is, konsole doesn't detect wrapped urls as single line. While
| investigating this issue I noticed line selection (using triple-click) also
| doesn't detect lines wrapped by mutt as single line (but it does work for
| lines wrapped by other apps like less or bash, both in xterm and konsole).

I tend to use double-click (word selection) for URLs. Most things
actually; I find triple click too prone ton grabbing more than I want.

Regarding the apps, these all write lines in different ways.

Bash and cat and so forth will be writing URLs straight to the terminal,
and if they overflow the end of the line then the terminal knows the
cursor overflowed onto the next line without a line break because that's
exactly what happened.

AFAIR, less works a little that way - it knows the terminal width but
just writes plain text most of the time except when scrolling backwards.
It is not a "full screen" application using the curses library. So
again, long URLs have just written straight over the end of the terminal
edge onto the next line, and so the terminal knows there's no line break
there.

vi, vim and mutt are all full screen curses applications. Internally the
apps control a logical screen, and say "write stuff here and there". The
curses library translates that into screen display actions consisting of
cursor motion escape sequences and text strings. As a consequence, text
lines are not physically written off the edge of the terminal; a
long string will get the text up to the end of the line written there on
line 12, and then a cursor motion escape to line 13 and the following
text written there; not even necessarily in that order either - a curses
app generally says "make these changes to the logical screen, then call
the sync operation" and then the curses library updates the screen in an
efficient fashion.

So the terminal (xterm) does not see the string run off the end of the line,
and does not know there is no line break.

This effect on line endings may not be easy to change.

Although I seem to feel that modern vim has better line wrapping
behaviour in cut/paste than vi used to many years ago, so perhaps it
is addressable. I'm pretty sure I can cut/paste (short) line of text
from a vim display into a text file pretty happily while doing it from
mutt often gets a lot of annoying trailing spaces on the lines; need
to experiment to check this though. Of course, vi (and probably vim)
had some funky behaviours to accomodate fairly dumb terminals so they
may not be as "pure" a curses app as mutt probably is.

| So, looks like something is broken in mutt.
| Maybe this issue is already known: http://dev.mutt.org/trac/ticket/3453

Looks like this effect.

BUT:

rxvt-unicode at least recognises URLs with a regexp. So it doesn't care
about the line break so much, more about the physical appearance on the
screen. So long URLs may well work in it. But... that is for its
click-the-URL facility, not necessarily cut/paste. Of course, you want
click-the-URL so you may be good here.

So try out rxvt-unicode. I have these:

  URxvt*perl-ext:                 default,tabbed,mark-urls,matcher
  Urxvt.perl-ext-common:          default,tabbed,mark-urls,matcher
  URxvt.urlLauncher:              urlshow

in my X11 settings to make it work; "mark-urls" is the required item for
your needs. The "urlLauncher" is the name of the external command used
to pop up the URL.

I've also got this:

  URxvt*cutchars:                 '"`&()*,;<=>?@[]{|}/-:

which I found useful to tune the double-click behaviour.

| I don't like to use url shorteners because of several reasons:
| - I wanna see real url before opening it
| - private urls unintentionally made public
| - changing content of incoming emails may break things (like pgp signatures)
| - probably won't work for outgoing emails
| and first reason is most important.

Me too.

| I know about urlview, but it both doesn't show long urls well and more
| complicated to use than just copy&paste (with disabled markers).
| 
| Can anyone recommend any other solutions? How you open long urls?

I also have a copy/paste arrangement in addition to the urxvt click-url
feature, though it will of course cuffer from the long URL issue...

For long but broken up URLs I dispatch them from the command line:

  urlshow 'long-url-here'

This lets me assemble the URL piecemeal before kicking it off, and can
be less flashy thatn jumping between the terminal and a browser's
location bar multiple times to assemble the URL. urlshow is just a
wrapper for the platform specific (and person specific:-) "pop up this
URL" task.

  https://bitbucket.org/cameron_simpson/css/src/tip/bin/urlshow?at=default

and I usually invoke it via a shorter alias "us".

Further, I also usually fetch and install the "xclip" command, which can
query (and set IIRC) the X11 buffers. So I have a keystroke bound to
"open the URL in the X11 cut/paste buffer" too, not that that is any use
for a long broken up URL.

Hope this gives you some options. Happy to discuss anything in further
detail.

Cheers,
-- 
Cameron Simpson <c...@zip.com.au>

"If you could have any amount of money... How much would you want?"
"All of it."    - Cerebus the Aardvark

Reply via email to