From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: `window-hscroll' does not report correct value when `text-scale-mode' is on Date: Thu, 18 May 2017 18:10:32 +0300 Message-ID: <83y3tu42vr.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1495120251 32096 195.159.176.226 (18 May 2017 15:10:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 18 May 2017 15:10:51 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?utf-8?B?6Lev5a6i?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 18 17:10:45 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBN4f-0008C3-94 for ged-emacs-devel@m.gmane.org; Thu, 18 May 2017 17:10:45 +0200 Original-Received: from localhost ([::1]:54302 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBN4k-0004Ux-QS for ged-emacs-devel@m.gmane.org; Thu, 18 May 2017 11:10:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42041) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBN4c-0004Th-MH for emacs-devel@gnu.org; Thu, 18 May 2017 11:10:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBN4Z-00016Z-Gq for emacs-devel@gnu.org; Thu, 18 May 2017 11:10:42 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53237) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBN4Z-00016U-Dw; Thu, 18 May 2017 11:10:39 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2283 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dBN4Y-0002Gf-E2; Thu, 18 May 2017 11:10:38 -0400 In-reply-to: (message from =?utf-8?B?6Lev5a6i?= on Thu, 18 May 2017 15:38:47 +0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:214941 Archived-At: > From: 路客 > Date: Thu, 18 May 2017 15:38:47 +0800 > > I found `window-hscroll' function does not report a correct value > if `text-scale-mode' is on. A simple test is to enable `ruler-mode' > and edit something like the following "text-ruler": > > .........1.........2.........3.........4.........5.........6... > 123456789012345678901234567890123456789012345678901234567890... > > Now we add a next line with 500 characters and put the cursor at > the end of it; then we use to decrease the font > size *twice* (with text wrapping disabled and ruler-mode enabled > to observe current `window-hscroll' value). We can now easily see > the `window-hscroll' value is incorrect, by comparing against the > above "text-ruler". This is not a bug: window-hscroll reports its value in units of canonical frame columns, so the value should indeed change when you change the font size. > Is there any way to get the "exact" hscroll value? Say, with pixel-wise > measurement? The value you get now is already exact, and is exactly equivalent to the corresponding number of pixels. If you really need that in pixel units, simply multiply by the value returned by frame-char-width.