From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuwei Tian Newsgroups: gmane.emacs.bugs Subject: bug#59547: 28.2; The bottom border is not displayed when setting the pixel height of a child frame smaller than 1 line Date: Mon, 28 Nov 2022 22:01:57 +0800 Message-ID: References: <57b46e7e-e1fd-774b-f39c-e55e9782398b@gmx.at> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23633"; mail-complaints-to="usenet@ciao.gmane.io" To: martin rudalics , 59547@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 28 15:12:55 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 1ozesQ-0005vE-4A for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Nov 2022 15:12:54 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ozere-0006Xr-KM; Mon, 28 Nov 2022 09:12:06 -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 1ozerc-0006Ww-BU for bug-gnu-emacs@gnu.org; Mon, 28 Nov 2022 09:12:04 -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 1ozerb-0004OJ-R4 for bug-gnu-emacs@gnu.org; Mon, 28 Nov 2022 09:12:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ozeir-0004fQ-Vn for bug-gnu-emacs@gnu.org; Mon, 28 Nov 2022 09:03:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuwei Tian Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Nov 2022 14:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59547 X-GNU-PR-Package: emacs Original-Received: via spool by 59547-submit@debbugs.gnu.org id=B59547.166964414917929 (code B ref 59547); Mon, 28 Nov 2022 14:03:01 +0000 Original-Received: (at 59547) by debbugs.gnu.org; 28 Nov 2022 14:02:29 +0000 Original-Received: from localhost ([127.0.0.1]:48796 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozeiL-0004f7-0j for submit@debbugs.gnu.org; Mon, 28 Nov 2022 09:02:29 -0500 Original-Received: from mail-lf1-f46.google.com ([209.85.167.46]:39690) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozeiJ-0004f1-9D for 59547@debbugs.gnu.org; Mon, 28 Nov 2022 09:02:27 -0500 Original-Received: by mail-lf1-f46.google.com with SMTP id f13so17477283lfa.6 for <59547@debbugs.gnu.org>; Mon, 28 Nov 2022 06:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=7ObIbpf9X0HPVvKu7/M7Nw9n2k311unBdLChbMHlKW8=; b=o4UkNuTSjYg8yYRVOqCXM/2xs9Eyk1nLMyd8ujakOodd1rOA75jo26qSLddhHSKq+g QN3eNHQDMHJC6Z9uikpoct9h+rscvoWJFMCrBNB6fcOvwdL4y+5kQ/YdHe9bHfxD5yt+ 0C4Kfb5buqyOIOjG1fkKr5hX7mH0dK4MQwuwTzrYCtM4BCubCY6aIiqiO26LFvpAnAki xnOVZ5uA4LFHAL+q6UURHlpPN1XruQWFgDxRD7wEh8CqwiWs8JjhiGleD8aS/5I4WlCk EfvvSDDvybHXIKg9l6EKsTqOnY0RTXC8aDknSDUD6BEelmzUswz4o28kKClLlKBTgQwV TDCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7ObIbpf9X0HPVvKu7/M7Nw9n2k311unBdLChbMHlKW8=; b=Yoz1u46UbhPWX9SsmT/sPLMQXsbtQCOLXx2YoPZqx58lxL3qhew8+buBgH4K9zmLRW q7M53ryPoRoomO52QXyHkGkysTKpo7nnzyx9VYYy2eyFI6pU/EePdwXtPnVo957fcudD Msz9xX1jerBokUmjyccWhELEyAGDqkfk+VIGluiZC2JpNhenzUy9H6aptuM1GRoy4RJ/ wx25Y0e55XDAFMufPiihYZc0tM0F8jUC6Yl2Ui2TI/oYZRz8g70kBSiuqBNYm9cDJeSB cmiETsbsJaGdl/G5Jg/KmGPql77oCW2z7kAKVtdyueCiapuVhhKkmc6zuUztnwQBCJjB NA1A== X-Gm-Message-State: ANoB5plPsJJCpNGPLnLI5/Wv4aRh+PwezINmLdwus1skzLBeTE0752Iz tz4MBjcf7Be4qUb323ZGJAVltlo8O6Ufj58l9zw= X-Google-Smtp-Source: AA0mqf7GaCFM2ubVQN3vwFN4u4fC/6+H1LS3OEdMc7DzvsTMUvit4E30T4Imb75OkCfh3I0OlcyfiOqSNuqWZkrc9TI= X-Received: by 2002:ac2:4bc8:0:b0:4b3:9fcb:df92 with SMTP id o8-20020ac24bc8000000b004b39fcbdf92mr16402908lfq.607.1669644136890; Mon, 28 Nov 2022 06:02:16 -0800 (PST) In-Reply-To: <57b46e7e-e1fd-774b-f39c-e55e9782398b@gmx.at> 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:249305 Archived-At: The problem reproduction code I gave is indeed problematic, and it is indeed wrong to adjust 'window-safe-min-height' to 0. The use case is to create a child frame with a height smaller than the default line height, because the character size in the child frame is set smaller than the default. How can this be achieved? Thanks. On Mon, Nov 28, 2022 at 6:27 PM martin rudalics wrote: > > > Start Emacs from 'Emacs -Q' and make a child frame with the following > > code: > > > > (let ((window-min-height 1) > > (window-min-width 1)) > > The last line is problematic since 'window-safe-min-width' being 2 > will override it. > > > (fit-frame-to-buffer my-child-frame) > > (let ((window-min-height 0) > > (window-safe-min-height 0)) > > (set-frame-size my-child-frame > > (frame-pixel-width my-child-frame) > > (floor (* 0.5 (frame-pixel-height my-child-frame))) > > t))) > > This is overly complicated. > > (let ((window-min-height 0) > (window-safe-min-height 0)) > (set-frame-size my-child-frame 50 8 t))) > > suffices to show the problem here. In either case, you do two things > which most people would classify as pilot errors. > > - You bind 'window-safe-min-height' which is defined as a constant > variable and according to the doc-string of 'defconst' "neither > programs nor users should ever change the value". > > - You temporarily bind 'window-min-height' around the 'set-frame-size' > call which means that it may not affect future resize operations on > 'my-child-frame' or its windows. In particular, it may not affect the > frame size adjustment triggered by 'set-frame-size' itself if that > happens asynchronously (not within the scope of 'set-frame-size'). > > > The bottom border of the child frame is not displayed. Try to resize the > > child frame again: > > > > (let ((window-min-height 0) > > (window-safe-min-height 0)) > > (set-frame-size my-child-frame 50 8 t)) > > > > And select other window, then the bottom border of the child frame appears. > > Here clicking into the child frame with the mouse suffices to make the > bottom border appear. > > > This behavior seems to be platform dependent, but it is indeed > > problematic. It also seems to have problems on Emacs 28, Linux/X11. > > The immediate cause of the problem are these two lines in window.c's > resize_frame_windows code: > > new_pixel_size = max (horflag ? size : size - mini_height, unit); > new_size = new_pixel_size / unit; > > where unit is defined as > > int unit = horflag ? FRAME_COLUMN_WIDTH (f) : FRAME_LINE_HEIGHT (f); > > As a consequence, 'compute_line_metrics' in xdisp.c will calculate > > max_y = WINDOW_BOX_HEIGHT_NO_MODE_LINE (it->w); > > if (row->y + row->height > max_y) > row->visible_height -= row->y + row->height - max_y; > > from the value of 'unit' above, the text is not clipped and whether you > see the lower border or the lower part of the buffer text reduces to the > question of who succeeds in drawing later into that area - the code > displaying the buffer text or the one filling the border rectangle. > > If you replace these two lines with say > > new_pixel_size = max (horflag ? size : size - mini_height, 1); > new_size = max (new_pixel_size / unit, unit); > > you should get the bottom border immediately. Whether applying such a > "fix" is safe, is a question I cannot answer though. Here I'm living > happily with fixes for this and many related problems but have no hope > that they will ever see the light of master. > > martin