From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#17303: On tty or -nw, (window-body-width) is one column too big. Date: Sun, 20 Apr 2014 22:35:24 +0300 Message-ID: <83ha5neqv7.fsf@gnu.org> References: <20140420170343.GA4058@acm.acm> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1398022585 13100 80.91.229.3 (20 Apr 2014 19:36:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Apr 2014 19:36:25 +0000 (UTC) Cc: 17303@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 20 21:36:18 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WbxXF-0001IS-G8 for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Apr 2014 21:36:17 +0200 Original-Received: from localhost ([::1]:46491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbxXF-0007zh-2U for geb-bug-gnu-emacs@m.gmane.org; Sun, 20 Apr 2014 15:36:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbxX6-0007Z6-Rz for bug-gnu-emacs@gnu.org; Sun, 20 Apr 2014 15:36:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WbxX1-0001Y6-37 for bug-gnu-emacs@gnu.org; Sun, 20 Apr 2014 15:36:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WbxX0-0001Y2-Ve for bug-gnu-emacs@gnu.org; Sun, 20 Apr 2014 15:36:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WbxX0-00060a-Fy for bug-gnu-emacs@gnu.org; Sun, 20 Apr 2014 15:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Apr 2014 19:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17303 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17303-submit@debbugs.gnu.org id=B17303.139802254123057 (code B ref 17303); Sun, 20 Apr 2014 19:36:02 +0000 Original-Received: (at 17303) by debbugs.gnu.org; 20 Apr 2014 19:35:41 +0000 Original-Received: from localhost ([127.0.0.1]:53546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WbxWe-0005zo-SF for submit@debbugs.gnu.org; Sun, 20 Apr 2014 15:35:41 -0400 Original-Received: from mtaout27.012.net.il ([80.179.55.183]:49146) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WbxWa-0005zb-QD for 17303@debbugs.gnu.org; Sun, 20 Apr 2014 15:35:38 -0400 Original-Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0N4C00H00GDO8I00@mtaout27.012.net.il> for 17303@debbugs.gnu.org; Sun, 20 Apr 2014 22:32:06 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N4C00A3ZGXINY80@mtaout27.012.net.il>; Sun, 20 Apr 2014 22:32:06 +0300 (IDT) In-reply-to: <20140420170343.GA4058@acm.acm> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:88170 Archived-At: > Date: Sun, 20 Apr 2014 17:03:43 +0000 > From: Alan Mackenzie > > 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? > This is caused by emacs counting the "\" character in the right margin as > part of the body-width. No, it's because the last character in the continued like is in column 78 on a TTY, but in column 79 in a GUI session. Emacs counts columns in continuation lines starting from the last column in the previous line, as you'd expect. IOW, the continued line is treated as one long line, and all its columns counted contiguously. It is true that the "\" character on a TTY takes up one column, and thus leaves only 79 columns for text, but what else can Emacs do? > This seems like a bad idea. I think it's also a bug. What would you like Emacs to do instead, given what I just explained? > So, is there a better method of determining the "visual" column point is > in? current-column is it. Please tell why it doesn't fit your needs.