From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#59963: 29.0.50; 'window-max-chars-per-line' doesn't always work on GUI without fringe Date: Wed, 14 Dec 2022 17:21:33 +0200 Message-ID: <83o7s6m2o2.fsf@gnu.org> References: <87edt6dwgq.fsf@disroot.org> <83sfhmt30p.fsf@gnu.org> <87o7sac78t.fsf@disroot.org> <87h6y2c6fq.fsf@disroot.org> <83ilihudcr.fsf@gnu.org> <58cc3d32-65f9-d4ad-4668-732af0f3aa36@gmx.at> <83iligsr7r.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17477"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rudalics@gmx.at, 59963@debbugs.gnu.org To: akib@disroot.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 14 16:22:14 2022 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 1p5TaI-0004P4-6L for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Dec 2022 16:22:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5TaB-0006Tp-B9; Wed, 14 Dec 2022 10:22:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5Ta6-0006Qr-Em for bug-gnu-emacs@gnu.org; Wed, 14 Dec 2022 10:22:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p5Ta6-0006cx-65 for bug-gnu-emacs@gnu.org; Wed, 14 Dec 2022 10:22:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p5Ta5-0004Ef-Jd for bug-gnu-emacs@gnu.org; Wed, 14 Dec 2022 10:22:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Dec 2022 15:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59963 X-GNU-PR-Package: emacs Original-Received: via spool by 59963-submit@debbugs.gnu.org id=B59963.167103130816273 (code B ref 59963); Wed, 14 Dec 2022 15:22:01 +0000 Original-Received: (at 59963) by debbugs.gnu.org; 14 Dec 2022 15:21:48 +0000 Original-Received: from localhost ([127.0.0.1]:39868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5TZr-0004EP-JP for submit@debbugs.gnu.org; Wed, 14 Dec 2022 10:21:47 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38944) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p5TZm-0004EH-RW for 59963@debbugs.gnu.org; Wed, 14 Dec 2022 10:21:45 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5TZh-0006S9-Bw; Wed, 14 Dec 2022 10:21:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=M9gDUZ5yX3vqoSNbLoCtI7FQ2hz03YKYWJK1RQoLWpY=; b=hlQrt0Iy0eH5 WXQc3vMRyAWC55FLJlrhIXA2sJeNZxrr96LYKcgsRTDLZRidMZJUi065DyZ8gRPe0BPAqb74qcB2G EJDYiEpjidoJ/zYzrq7ow6cWpEbbRCYW3673sSMLThZqZe8n+Ptc0pwjPzHZvr65ehJf8hbGITLn0 0I0+gftGnIx86hd76bUlac+mf85qr5kd1mfohExvTGoaChy6MlxMbv5UlL6NVryi/CgjUw+lTH35t T6q3XWBHPwQJjkIpFEDX5kDHevX14VSH7wDDYdaQ7W6xGoRLXI37nGp18idpDvSlW67mq+d3lZhzt 5BxNgUfI8oYm+csO5wusKQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5TZg-0006ie-Sc; Wed, 14 Dec 2022 10:21:37 -0500 In-Reply-To: <83iligsr7r.fsf@gnu.org> (message from Eli Zaretskii on Mon, 12 Dec 2022 15:10:16 +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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:250957 Archived-At: Akib, please see if the patch below gives good results, including in the real-life use case which triggered this report: diff --git a/lisp/window.el b/lisp/window.el index 7d8ee48..a4a8421 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -2162,17 +2162,14 @@ window-max-chars-per-line (let* ((window-width (window-body-width window t)) (font-width (window-font-width window face)) (ncols (- (/ window-width font-width) - (ceiling (line-number-display-width 'columns))))) + (ceiling (line-number-display-width 'columns)))) + (fringes (window-fringes window)) + (lfringe (car fringes)) + (rfringe (nth 1 fringes))) (if (and (display-graphic-p) overflow-newline-into-fringe - (not - (or (eq left-fringe-width 0) - (and (null left-fringe-width) - (= (frame-parameter nil 'left-fringe) 0)))) - (not - (or (eq right-fringe-width 0) - (and (null right-fringe-width) - (= (frame-parameter nil 'right-fringe) 0))))) + (not (eq lfringe 0)) + (not (eq rfringe 0))) ncols ;; FIXME: This should remove 1 more column when there are no ;; fringes, lines are truncated, and the window is hscrolled,