Subject: Re: bug#17303: On tty or -nw, (window-body-width) is one column too big.

From: Eli Zaretskii <[email-masked]>
Date: Sun, 20 Apr 2014 23:05:46 +0300

> Date: Sun, 20 Apr 2014 22:35:24 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> > Date: Sun, 20 Apr 2014 17:03:43 +0000
> > From: Alan Mackenzie <[email-masked]>
> > 
> > I'm doing something at the moment involving scrolling of windows, and I
> > need to know at what "visual" column point is in.  So, naturally, I do
> > 
> >     (% (current-column) (window-body-width))
> > 
> > .  At the start of the first continuation line, this formula (correctly)
> > returns 0 on a GUI, but (e.g.) 79 on a tty or in emacs -nw.
> 
> You mean, it says 80 in a GUI session, not 0, right?

Wait, perhaps I misunderstood your complain.

Is the problem with window-body-width, rather than with
current-column?  (You seemed to ask about current-column, not
window-body-width.)

If so, then you should know that the continuation character does not
have to take one column, it can be customized via the buffer display
table.  So the effective window width on a TTY is not always 1 column
less than on GUI frames.  Also, if there's a truncation glyph at the
left, you'd probably want us to subtract its length as well, right?

Moreover, when there are no fringes on a GUI frame, we also use "\"
there to indicate a continued line, but we still return from
window-body-width a value that counts the continuation character.

So this is not an easy thing to change.  And the question is of
course: why do it?  What is the use case where you bumped into this
issue, and why window-body-width was important to you?