vile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A somewhat off-topic question about ncurses and wrapping long lines


From: Chris Green
Subject: Re: A somewhat off-topic question about ncurses and wrapping long lines
Date: Sun, 2 Oct 2022 09:22:03 +0100

On Sat, Oct 01, 2022 at 06:35:26PM -0400, Thomas Dickey wrote:
> On Sat, Oct 01, 2022 at 10:01:00AM +0100, Chris Green wrote:
> > Well it's not entirely off topic, it's about something that works as
> > I'd expect it to in vile (and less) but doesn't work right in mutt (my
> > E-Mail program of choice).
> > 
> > The issue is about how long chunks of text, with no spaces in them,
> > are wrapped when they are too long to fit in the terminal width.  The
> > typical case (and the one that is a particular problem in mutt) is
> > that of long URLs.  This *isn't* about how these programs manage
> > wrapping normal text made up of 'words' with spaces in between.
> > 
> > In less or vile when there is a long piece of text and you have told
> > less/vile to wrap long lines then the long URL (or whatever) is
> > displayed wrapped at the right margin but it is still a single string
> > and you can select it in the terminal by right clicking on it.
> > 
> > In mutt (in mutt's internal pager specifically) however, although the
> > URL is displayed the same (i.e. wrapped at the right margin) it's
> > actually broken into one or more lines and you *can't* select it by
> > right clicking on it, you just get the single line that you click on.
> > 
> > This has been discussed at length at various times on the mutt mailing
> > list and hasn't been solved.
> 
> I'm subscribed to mutt-dev (don't recall it there).
> Perhaps mutt-user...

Yes, it's mutt-users.

> 
> (none of the mutt development gets very deep into this stuff)
>  
> > Is there some specific way of using/calling ncurses which does what we
> > want?  ... and/or does ncurses default to breaking the string at the
> > page margin and need some option to prevent it doing this?
> 
> It's a special case of xterm (imitated by more than one terminal emulator,
> though probably not _all_).  xterm notices when a line is written and
> wraps.  Screen updates that simply write to the end of a line (including
> a previously "wrapped" line) make it forget about follow part of a line.
> 
I sort of understand. So you're saying that it's the xterm (or
similar) that is inserting the LF after mutt has output a long string
using ncurses.

> less and vile have an advantage over ncurses in deciding if a line is
> wrapped -- ncurses can't tell if an application writes text (using one
> of the wrapping calls such as waddch) intending to construct a long line.
> 
So vile and less manage the wrapping themselves whereas xterm does it
for mutt - is that the difference?

I thought vile used ncurses.

> Actually, long lines in mutt for me have a "+" marking the beginning
> of the following lines (which iirc is configurable).
>  
I have "set nomarkers" in my muttrc which turns the + off.  At least
one can then manually select the long URL and paste it into a browser
address bar (as long as the browser, correctly, inores the embedded
LF). However right-clicking the URL would be much handier.

> > I'm floundering a bit at understanding this as I'm not really sure
> > it's an ncurses issue but it does seem to be pretty much the same
> > regardless of other things.  I use /usr/bin/xfce4-terminal but the
> > same happens to lots of other people and I have tried other terminal
> > emulators and seen no change.
> > 
> > Can anyone throw any light on this?
> > 
> > -- 
> > Chris Green
> > 
> 
> -- 
> Thomas E. Dickey <dickey@invisible-island.net>
> https://invisible-island.net
> ftp://ftp.invisible-island.net



-- 
Chris Green



reply via email to

[Prev in Thread] Current Thread [Next in Thread]