Re: The way mutt handles long lines, seems odd/wrong to me

2022-10-02 Thread Chris Green
On Sun, Oct 02, 2022 at 09:43:47AM +1100, Cameron Simpson wrote:
> On 01Oct2022 09:33, Chris Green  wrote:
> >As I said though it seems odd that only mutt suffers from the problem
> >(on my xubuntu systems anyway).  Presumably both 'less' and my editor
> >'vile' use ncurses too and they just wrap long lines if you tell them
> >to do so.
> 
> I'm pretty sure that less does not use curses (of whatever 
> implementation).  Termcap/terminfo, sure.  But not curses, which 
> maintains a model of the whole screen.
> 
Maybe not but my editor vile certainly does and it wraps the way I
want/expect.

> I have a (vague) recollection that some terminals keep track of whether 
> a line was terminates with a newline or not, and that it affects how 
> copy/paste was done, in that a newline causes a break in the string. But 
> the memory is vague.
> 
> 1) is your long string using the full width of the terminal? i.e. is 
> there a character in the rightmost column?
> 
A long line wrapped in the mutt pager looks exactly the same as a long
line wrapped in less or vile.  I.e. there are no added spaces or other
characters.  In fact if a browser address bar works correctly you can
select the multiple lines and paste them into the browser address bar
as the NLs are ignored.  However it's still messier than if the NLs
weren't there as you have to manually select the whole URL rather than
just right clicking on it.


> 2) if the text does go to the rightmost column, but you have a break in 
> the copied text, what's in that break? eg if you paste into an editor, 
> what gets inserted there?
> 
As noted above, I'm pretty sure it's a NL (i.e. a linefeed), I'll check.

Yes, it's a linefeed.  I.e. if you select the two halves of a 'broken'
line displayed in mutt's pager and paste them somewhere else there's a
0x0a character in the middle.

> Just curious, not sure this information would lead to a fix/workaround.
> 
As I said I'm discussing this with the maintainer of ncurses, if
anything comes of this I'll report back here.

-- 
Chris Green


Re: The way mutt handles long lines, seems odd/wrong to me

2022-10-01 Thread Cameron Simpson

On 01Oct2022 09:33, Chris Green  wrote:

As I said though it seems odd that only mutt suffers from the problem
(on my xubuntu systems anyway).  Presumably both 'less' and my editor
'vile' use ncurses too and they just wrap long lines if you tell them
to do so.


I'm pretty sure that less does not use curses (of whatever 
implementation).  Termcap/terminfo, sure.  But not curses, which 
maintains a model of the whole screen.


I have a (vague) recollection that some terminals keep track of whether 
a line was terminates with a newline or not, and that it affects how 
copy/paste was done, in that a newline causes a break in the string. But 
the memory is vague.


1) is your long string using the full width of the terminal? i.e. is 
there a character in the rightmost column?


2) if the text does go to the rightmost column, but you have a break in 
the copied text, what's in that break? eg if you paste into an editor, 
what gets inserted there?


Just curious, not sure this information would lead to a fix/workaround.

Cheers,
Cameron Simpson 


Re: The way mutt handles long lines, seems odd/wrong to me

2022-10-01 Thread Chris Green
On Sat, Oct 01, 2022 at 01:11:10PM +, Sam Kuper wrote:
> On Sat, Oct 01, 2022 at 09:33:16AM +0100, Chris Green wrote:
> > On Sat, Oct 01, 2022 at 01:24:37PM +0800, Kevin J. McCarthy wrote:
> >> In [the] past, I've tried a few things to see if it has an effect on
> >> the output of long lines, but haven't found anything that makes a
> >> difference.  In the end, I believe it's a side effect of how ncurses
> >> works.
> >
> > Yes, I realise this issue has been looked into before, and no solution
> > found. [...] I'll have a talk with Tom Dickey who is the maintainer of
> > both vile and ncurses, he may be able to throw some light on this.
> 
> Workaround: while viewing an affected email in Mutt, press the vertical
> bar key (`|`) and then type `less`.  This will pipe the email to Less -
> which, as you've noted, is unaffected by the issue.  You can then select
> URLs or other long whitespace-free text strings per your terminal's
> normal behaviour.
> 
> (You probably already knew this!  But I'm mentioning it in case not, or
> in case helpful for anyone else reading this thread.)
> 
I actually have a macro implemented to do this, single key ('l') pipes
the message into less.  It's a reasonable workaround but one does have
to hit 'q' twice to get back out of less.

-- 
Chris Green


Re: The way mutt handles long lines, seems odd/wrong to me

2022-10-01 Thread Sam Kuper
On Sat, Oct 01, 2022 at 09:33:16AM +0100, Chris Green wrote:
> On Sat, Oct 01, 2022 at 01:24:37PM +0800, Kevin J. McCarthy wrote:
>> In [the] past, I've tried a few things to see if it has an effect on
>> the output of long lines, but haven't found anything that makes a
>> difference.  In the end, I believe it's a side effect of how ncurses
>> works.
>
> Yes, I realise this issue has been looked into before, and no solution
> found. [...] I'll have a talk with Tom Dickey who is the maintainer of
> both vile and ncurses, he may be able to throw some light on this.

Workaround: while viewing an affected email in Mutt, press the vertical
bar key (`|`) and then type `less`.  This will pipe the email to Less -
which, as you've noted, is unaffected by the issue.  You can then select
URLs or other long whitespace-free text strings per your terminal's
normal behaviour.

(You probably already knew this!  But I'm mentioning it in case not, or
in case helpful for anyone else reading this thread.)

Cheers!

Sam


Re: The way mutt handles long lines, seems odd/wrong to me

2022-10-01 Thread Chris Green
On Sat, Oct 01, 2022 at 01:24:37PM +0800, Kevin J. McCarthy wrote:
> On Fri, Sep 30, 2022 at 02:42:09PM +0100, Chris Green wrote:
> >I'm am also pretty sure that it's the mutt pager doing this as other 
> >programs (i.e. less) wrap long lines in a terminal window but don't 
> >chop them into pieces like mutt's pager.
> 
> Mutt uses ncurses to draw on the screen, which is a layer of 
> indirection.  Mutt is telling ncurses where to put things, but when Mutt 
> refreshes the screen, ncurses actually sends the needed commands and 
> contents to the terminal.
> 
> In that past, I've tried a few things to see if it has an effect on the 
> output of long lines, but haven't found anything that makes a 
> difference.  In the end, I believe it's a side effect of how ncurses 
> works.
> 
Yes, I realise this issue has been looked into before, and no solution
found.

As I said though it seems odd that only mutt suffers from the problem
(on my xubuntu systems anyway).  Presumably both 'less' and my editor
'vile' use ncurses too and they just wrap long lines if you tell them
to do so.

I'll have a talk with Tom Dickey who is the maintainer of both vile
and ncurses, he may be able to throw some light on this.

-- 
Chris Green


Re: The way mutt handles long lines, seems odd/wrong to me

2022-09-30 Thread Kevin J. McCarthy

On Fri, Sep 30, 2022 at 02:42:09PM +0100, Chris Green wrote:
I'm am also pretty sure that it's the mutt pager doing this as other 
programs (i.e. less) wrap long lines in a terminal window but don't 
chop them into pieces like mutt's pager.


Mutt uses ncurses to draw on the screen, which is a layer of 
indirection.  Mutt is telling ncurses where to put things, but when Mutt 
refreshes the screen, ncurses actually sends the needed commands and 
contents to the terminal.


In that past, I've tried a few things to see if it has an effect on the 
output of long lines, but haven't found anything that makes a 
difference.  In the end, I believe it's a side effect of how ncurses 
works.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: The way mutt handles long lines, seems odd/wrong to me

2022-09-30 Thread Chris Green
On Fri, Sep 30, 2022 at 08:55:28PM +0200, Marcus C. Gottwald wrote:
> 
> Chris Green wrote (Fri 2022-Sep-30 14:42:09 +0100):
> 
> > So, when there is a long string of text in a message that is longer
> > than the width of the terminal and has no spaces in it mutt *always*
> > breaks the line at the RHS of the terminal window and displays the
> > rest of the line on separate continuation lines.
> ..
> > Have I missed a setting somwhere that affects this or is it just a
> > bug/feature?  Can I ask if it might be fixed because it's one of the
> > few things i find really annoying about mutt - not being able to
> > easily select and use long URLs.
> 
> Is the configuration variable called "markers" what you're looking
> for? Quoting from the manual:
> 
>markers
>Type: boolean
>Default: yes
> 
>Controls the display of wrapped lines in the internal pager.
>If set, a “+” marker is displayed at the beginning of wrapped
>lines.
> 
I don't think this is it, I get no "+" marker but the lines are still
broken at the screen width.  (I have "set nomarkers" in muttrc)

-- 
Chris Green


Re: The way mutt handles long lines, seems odd/wrong to me

2022-09-30 Thread Marcus C. Gottwald


Chris Green wrote (Fri 2022-Sep-30 14:42:09 +0100):

> So, when there is a long string of text in a message that is longer
> than the width of the terminal and has no spaces in it mutt *always*
> breaks the line at the RHS of the terminal window and displays the
> rest of the line on separate continuation lines.
..
> Have I missed a setting somwhere that affects this or is it just a
> bug/feature?  Can I ask if it might be fixed because it's one of the
> few things i find really annoying about mutt - not being able to
> easily select and use long URLs.

Is the configuration variable called "markers" what you're looking
for? Quoting from the manual:

   markers
   Type: boolean
   Default: yes

   Controls the display of wrapped lines in the internal pager.
   If set, a “+” marker is displayed at the beginning of wrapped
   lines.

Cheers, Marcus

-- 
   Marcus C. Gottwald  ··  @mcg:cheers.de



The way mutt handles long lines, seems odd/wrong to me

2022-09-30 Thread Chris Green
I have been playing with the various mutt settings which affect how
long lines are managed (in the pager in particular).

By 'long lines' I mean strings of text which have no spaces in them
and which are longer than the width of the terminal window.  The
handling of text made up of words with spaces between them seems
perfectly OK.

So, when there is a long string of text in a message that is longer
than the width of the terminal and has no spaces in it mutt *always*
breaks the line at the RHS of the terminal window and displays the
rest of the line on separate continuation lines.

This seems wrong to me, a very long string of text should be left
intact and simply wrapped onto multiple lines.  

I have tried all the sensible combinations of $wrap, $reflow_wrap and
$reflow_text that I can think of and, though they do exactly what
they're supposed to do with 'words' separated by spaces, they never
change the truncation of long strings of text at the right margin.

I'm am also pretty sure that it's the mutt pager doing this as other
programs (i.e. less) wrap long lines in a terminal window but don't
chop them into pieces like mutt's pager.

Have I missed a setting somwhere that affects this or is it just a
bug/feature?  Can I ask if it might be fixed because it's one of the
few things i find really annoying about mutt - not being able to
easily select and use long URLs.

-- 
Chris Green