From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: ynyaaa@gmail.com Newsgroups: gmane.emacs.bugs Subject: bug#46316: 27.1; wrong horizontal scroll with truncate-lines value t Date: Sat, 13 Feb 2021 00:41:18 +0900 Message-ID: <86wnvds38h.fsf@gmail.com> References: <86wnvnm79l.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28903"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 46316@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 12 16:44:17 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lAacD-0007Rj-JZ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Feb 2021 16:44:17 +0100 Original-Received: from localhost ([::1]:59970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAacC-00042W-I2 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Feb 2021 10:44:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAaa2-0008SF-GZ for bug-gnu-emacs@gnu.org; Fri, 12 Feb 2021 10:42:08 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49516) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lAaa2-0003ok-9C for bug-gnu-emacs@gnu.org; Fri, 12 Feb 2021 10:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lAaa2-0004Bd-68 for bug-gnu-emacs@gnu.org; Fri, 12 Feb 2021 10:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: ynyaaa@gmail.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Feb 2021 15:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46316 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 46316-submit@debbugs.gnu.org id=B46316.161314449416059 (code B ref 46316); Fri, 12 Feb 2021 15:42:02 +0000 Original-Received: (at 46316) by debbugs.gnu.org; 12 Feb 2021 15:41:34 +0000 Original-Received: from localhost ([127.0.0.1]:32829 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAaZa-0004Ax-3x for submit@debbugs.gnu.org; Fri, 12 Feb 2021 10:41:34 -0500 Original-Received: from mail-pj1-f49.google.com ([209.85.216.49]:34715) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAaZV-0004Ah-KA for 46316@debbugs.gnu.org; Fri, 12 Feb 2021 10:41:32 -0500 Original-Received: by mail-pj1-f49.google.com with SMTP id my11so503181pjb.1 for <46316@debbugs.gnu.org>; Fri, 12 Feb 2021 07:41:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:subject:in-reply-to:from:date:message-id:mime-version; bh=ahCdD4RfFQm5u9wEj2gUJRlPBquiXLy3nqEXalM+T/s=; b=vaOyJQR57Sbh+1TBrOC3DsN/1SolN3X2+XZ/rYeloq2Xe9Gn5x/p1XkVbgXQlbaWjF YPCdOqporGwqd49rBfEwkREfYumfG9zVKhTI+Kd+Up99FfMWZbrr5wYssJeI5M4IwwCG Oxmswu1oJ5OrMKzR071jj6yRfOyIWMDzMVjbHmlgbznZHU1XkGmdAAZAQVGtrkaD0a2N jM6gn4XWocsiahlHxVAFOMEpZDEwxSus9VswRsfFok9NnE3IFR8BpbKx3S1rC5wUQyGV O6zXJVDUIbq9FC/U5YFJ52JgR+iH8invyOWYGG8hGbM/4SliUNowxXukiKrFOsJofefN 4h+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:subject:in-reply-to:from:date:message-id :mime-version; bh=ahCdD4RfFQm5u9wEj2gUJRlPBquiXLy3nqEXalM+T/s=; b=RlJvvd4aLZDq/JCxZm3E85FKbX69NsjnWj2BgzkMyuGpCv4FJTxLoWxMdr2mPM97E5 l1EK9sy7nzqChuK6Zzg+uio8vd0MwDP7WarPtAUxbdD0btkocTneIzfKCKhB5/bRroCu UWXene6Zxf+fVX/+VV88rwt/yuBYV2aaBHF9LlBV3RPAwGqbG9pz6LNshpcsFVir4iWz j4tDoY/Gh2rez8Cjx1xLCx7IKc/tQ4+ih/vwyCiYkxeHrTpzaeqqWPCOylf+1U803ZHX p2EiQKRzCLSicoT0AcQ3rJKwSP4LD17Bh5v7hepi3XVCB8IxRxNOdph6C6WzqoyIXmx4 qWGQ== X-Gm-Message-State: AOAM532rGk80yCbp2tlPba1auFFRVnNEuiXgSnDz9yOtCbcrwvAd6t7J eG9z4Az3d8GwtMXKSPJwYKeIw0b2OVA= X-Google-Smtp-Source: ABdhPJyKjyBBU+eEcUDnzkmpXz0cCj+5uL2tx0/2oK2ajB2KkiuETp4DCt5GElxb2plJ7tAs+IdNLg== X-Received: by 2002:a17:902:cec3:b029:de:901b:d0be with SMTP id d3-20020a170902cec3b02900de901bd0bemr3397723plg.26.1613144483446; Fri, 12 Feb 2021 07:41:23 -0800 (PST) Original-Received: from HP (east42-p109.eaccess.hi-ho.ne.jp. [219.121.173.110]) by smtp.gmail.com with ESMTPSA id s126sm10133135pfs.81.2021.02.12.07.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 07:41:23 -0800 (PST) In-Reply-To: <835z33n17s.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 07 Feb 2021 21:10:15 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:199865 Archived-At: Eli Zaretskii writes: >> Cc: 46316@debbugs.gnu.org >> From: ynyaaa@gmail.com >> Date: Mon, 08 Feb 2021 03:54:32 +0900 >> >> I only want auto-hscroll-mode to scroll buffer automatically. > > It does, when you give it enough information that it should. When > your input focus is in another window (the mini-window in the case of > C-s), I think it would be strange for Emacs to auto-scroll some other > window. > >> If a searched string is not displayed in the window, I might think the >> searched string does not exist in the buffer. > > The searched string _is_ displayed, when you first find it. > >> If an image is hidden, I might think the image is a solid color same as >> the emacs background color. > > Just move the cursor and you will see it. > > Sorry, I see no problem here, certainly not something that would > justify complicated triggers for redisplaying a window. I investigated some more. #'isearch-update tries to control the hsrcoll using #'pos-visible-in-window-group-p. Under the folloing conditions, it returns coordinates as if the point is at the beginning of a virtual next line. (1) the point is the end of the buffer. (2) the buffer does not end with a newline. (3) the last line is displayed in the window. (4) the last line is truncated. So the calculation is wrong and the hscroll becomes inappropriate. With a different reason, if isearch started with a large hscroll and the last match is near the beginning of a line, the hscroll becomes inapropriate. For example, evaluate the form below, and type 'C-s a C-s', then the current point is hidden to the left of the window. This is because #'isearch-update only checks whether the point is to the right of the window and does not check whether the point is to the left of the window. (let ((buf (generate-new-buffer "tmp"))) (switch-to-buffer buf) (setq truncate-lines t) (insert-char ?x 100) (save-excursion (insert-char ?\n 100) (insert ?a))) Regarding image-mode, a simpler example of the bug is written as below. The hscroll does not change when the buffer is changed. Image display, window focus or message is not related. (let ((buf (generate-new-buffer "tmp"))) (switch-to-buffer buf) (setq truncate-lines t) (dotimes (i 200) (insert (format ":%03d" i)) (when (= 0 (% (1+ i) 100)) (insert ?\n))) (forward-char -1) (sit-for 1) (set-window-hscroll nil (window-hscroll)) (save-excursion (forward-char -100) (insert-char ?\n 10) ))