From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?B?6Lev5a6i?= Newsgroups: gmane.emacs.devel Subject: `window-hscroll' does not report correct value when `text-scale-mode' is on Date: Thu, 18 May 2017 15:38:47 +0800 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a113969184561d5054fc781bc" X-Trace: blaine.gmane.org 1495093182 3407 195.159.176.226 (18 May 2017 07:39:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 18 May 2017 07:39:42 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 18 09:39:37 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 1dBG23-0000dV-3w for ged-emacs-devel@m.gmane.org; Thu, 18 May 2017 09:39:35 +0200 Original-Received: from localhost ([::1]:52141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBG25-0000dy-Rs for ged-emacs-devel@m.gmane.org; Thu, 18 May 2017 03:39:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBG1z-0000dd-Q5 for emacs-devel@gnu.org; Thu, 18 May 2017 03:39:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBG1y-000881-RS for emacs-devel@gnu.org; Thu, 18 May 2017 03:39:31 -0400 Original-Received: from mail-qt0-x235.google.com ([2607:f8b0:400d:c0d::235]:36758) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dBG1y-00087i-LP for emacs-devel@gnu.org; Thu, 18 May 2017 03:39:30 -0400 Original-Received: by mail-qt0-x235.google.com with SMTP id f55so27787744qta.3 for ; Thu, 18 May 2017 00:39:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=GvpOdyvcwgVkilJPqKwHmYhMZTUdO2D5y1M5XaopTrI=; b=gAVpXypDEA5K06mcOctLn0MxjRPo+g6MujOkV+geMSSJAqyWyfmIXUOCYnG3KvqrSC rHT8urcjnqlvdJhYC0OPu+wSAgXfRiCOdvGwI++blSyZLYSoQP9+EoO1RIzM6aBkEYCW YOG6O6ZIBvqrtnJ9BIi7PRD+bz4wUUaX9RtIX0XUYyNrf8mdcMu7sH8fFi1yv6lMgCi0 lim+J5V3KJ49cQ8sOXSo7435T+9WZYrIs9escchKRDW/NMpCwtyP6vXvPklohz0/E8uT xgAxjiw+FIztXN4GVsGRon0Rhy1/p5F5BYslr3DhZYGRtfZz3ombg8SJHD2Trvc7Kn6e RTFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=GvpOdyvcwgVkilJPqKwHmYhMZTUdO2D5y1M5XaopTrI=; b=QXeSjeyISLJWyq0NOwUUPjoLgsoGQefWWMmpLlhMpr306k3V43Gz8QS8pm9zL33f/c TKVz+nD4EHEus2Cft+XUmV5l76TIST4Ea1SLybH0clyaslcPZDUk0GMqsaiPPBUenkr/ sT/0CJzGb9dMBbI25aUlG9J9FLAD+fhlVfTBISYRNu5TvOPP99uTHbnSa5V+JsY7TnRr 4szEqC7YcM9+ByCb+XeE4kDY+EpnjmjLlO3x1TBRKKz74GAqQJggSY9IB6YzyAHuln6d ckheVLDbRHakntwLS0DpL2XfJNcIJZydIuLXUs/lWXLmh0q4XQJerV/d/qt8QzKwdPhi EYGQ== X-Gm-Message-State: AODbwcAzoGlBDgIvLzcibU925c+p0XHhRy6JDPBZyv/E6cFBiEvPdftu b74bjSRRljibK2GCzA1B9UORoiPecXFc X-Received: by 10.200.38.251 with SMTP id 56mr2785150qtp.244.1495093169445; Thu, 18 May 2017 00:39:29 -0700 (PDT) Original-Received: by 10.140.83.5 with HTTP; Thu, 18 May 2017 00:38:47 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::235 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:214937 Archived-At: --001a113969184561d5054fc781bc Content-Type: text/plain; charset="UTF-8" Hi all, 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". After some experiments I derived the following function that help a bit but still not a complete answer: (defun my-hscroll () (round (/ (window-hscroll) (or (and (boundp 'text-scale-mode-remapping) (caddr text-scale-mode-remapping)) 1)))) `my-hscroll' function can report a value that is closer to the correct hscroll value. But the error of `my-hscroll' becomes larger if we again decrease the font size, or purposely edit a line with 2000 characters. Is there any way to get the "exact" hscroll value? Say, with pixel-wise measurement? Thanks a lot. -- Best regards, Luke Lee --001a113969184561d5054fc781bc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all,

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...
12345678= 9012345678901234567890123456789012345678901234567890...

Now we add a nex= t line with 500 characters and put the cursor at
the end of it; then we
use <shift-left_mouse> to decrea= se the font
size *twice* (with text wrapping disabled and ruler-mode enabled
to observe current `window-hsc= roll' value). We can now easily
see
the `window-hscroll' value is incorrect, by com= paring against the

above "= text-ruler".

After some experiments= I derived the following function that help a
bit but still not a compl= ete answer:

(defun my-hscroll ()
=C2=A0 (round (/ (window-hscroll= )
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (or= (and (boundp 'text-scale-mode-remapping)
=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (caddr text-scale-mode-remapping))
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= 1))))

`my-hscroll' function can report a value that is c= loser to the correct
hscroll value. But the error of `my-hscroll' be= comes larger if we again
decrease the font size, or purposely edit a li= ne with 2000 characters.

Is there any way to get the "exact" hscroll value?= Say, with pixel-wise
measurement?
<= div>

Thanks a lot.
<= /span>

--
Best regards,
Luke Lee

--001a113969184561d5054fc781bc--