From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oHTrGPSkjmAT5gAAgWs5BA (envelope-from ) for ; Sun, 02 May 2021 15:11:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id yF1mFPSkjmBPHgAAbx9fmQ (envelope-from ) for ; Sun, 02 May 2021 13:11:16 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CF3FE24B0C for ; Sun, 2 May 2021 15:11:15 +0200 (CEST) Received: from localhost ([::1]:57616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldBsR-0003LG-0I for larch@yhetil.org; Sun, 02 May 2021 09:11:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldAMM-0005AI-3N for emacs-orgmode@gnu.org; Sun, 02 May 2021 07:34:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59005) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldAML-0004Fc-SW for emacs-orgmode@gnu.org; Sun, 02 May 2021 07:34:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ldAML-0006EG-Ml for emacs-orgmode@gnu.org; Sun, 02 May 2021 07:34:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#48148: 27.2; ox-ascii breaks TITLE line wrongly when 2 width char is used Resent-From: Shingo Tanaka Original-Sender: "Debbugs-submit" Resent-CC: emacs-orgmode@gnu.org Resent-Date: Sun, 02 May 2021 11:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48148 X-GNU-PR-Package: org-mode X-GNU-PR-Keywords: To: Eli Zaretskii Received: via spool by 48148-submit@debbugs.gnu.org id=B48148.161995521823936 (code B ref 48148); Sun, 02 May 2021 11:34:01 +0000 Received: (at 48148) by debbugs.gnu.org; 2 May 2021 11:33:38 +0000 Received: from localhost ([127.0.0.1]:42316 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldALy-0006E0-12 for submit@debbugs.gnu.org; Sun, 02 May 2021 07:33:38 -0400 Received: from mail-pj1-f47.google.com ([209.85.216.47]:44757) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldALt-0006Dt-FQ for 48148@debbugs.gnu.org; Sun, 02 May 2021 07:33:36 -0400 Received: by mail-pj1-f47.google.com with SMTP id m6-20020a17090a8586b02901507e1acf0fso1736594pjn.3 for <48148@debbugs.gnu.org>; Sun, 02 May 2021 04:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:from:to:cc:subject:in-reply-to:references :user-agent:mime-version; bh=4ApH+q2Zp2obokxxuo0jKg+l+Jo0XHaISOIIPtjMLyo=; b=vcuyVvW5x+lQThwTnJsdclsym9V1z8t/3oc35uvhp7wuXcfNISXr+mT+cDcTTXYDUD PhA4GIcxgamTlXbgo/sHg84Je0w48mvo4klmYxeBIBJVKtG2KlA6ibRHZdmkpEFiBJRx bvPLE4HdzaKfX/PqUcbZBWqNOInY8PFP4RmfRXT4S33mzQfNAPMzn/cYYu/L++hVyLBs e/Gp2U5+kLn3Iw1Zm9B5JGiO/HCcd0wMgRp6XLApk9E9VoYX/Cs5L62CUk137mnGBL1J HiINTY0JWD5IBkUDHCH819KPY1v8f9WoPqDNipaTTuAUFxsdfiFvoTY/508F+ii8rijp TQng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:from:to:cc:subject:in-reply-to :references:user-agent:mime-version; bh=4ApH+q2Zp2obokxxuo0jKg+l+Jo0XHaISOIIPtjMLyo=; b=U8JnBNgIOz23gzWtd6+H/Zz9ROt+BBpEGAY2/HKZ0zm976ksMN+MYUcfoQXtb36zRj 2nmYqsjJHtFi4YBk2XCneoPSq/Khda7cc9XSi+AwAvVIJ4bnG9XQg/nujAovOx1xb2so HXBC5b4iE/rts5mmP8woeiP9ha70vBK5uZZHGUULaiTAqD+asV1H8LEyhSslAHGvxwLx 7J6TTd4xwxl829zuybWpErVQUgfxYjLDK0FpOyF+kdouBo5yLwJ0QLdPQYHDKt0JMevx TypMEPF1hCQMbk5EiaIqxnrdcKER/I09JbZ/SzUHi29HjveqX6hyxbZGr1Y2Y717cXMR 7AKw== X-Gm-Message-State: AOAM5313DMG+S6TorsVLG4adpFTtQGfhBmzRRIjG5Oj1XzxPEViHdoCG dGZcSlM+Y291bUenMMIBBf8= X-Google-Smtp-Source: ABdhPJwcPSgn+3+LQdkplZmWvMw8wzwp1UQRFhVaEmvYUs9ge/yq2MsSOSwqWu+vjZBZFDLiZN6TPw== X-Received: by 2002:a17:902:c38b:b029:ed:442a:276e with SMTP id g11-20020a170902c38bb02900ed442a276emr15172936plg.51.1619955207686; Sun, 02 May 2021 04:33:27 -0700 (PDT) Received: from shingo-desktop.gmail.com ([240d:1a:6f4:6b00:5514:ce7d:f5f9:375b]) by smtp.gmail.com with ESMTPSA id j7sm6382731pfd.129.2021.05.02.04.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 May 2021 04:33:27 -0700 (PDT) Date: Sun, 02 May 2021 20:33:23 +0900 Message-ID: <87pmy9pdz0.wl-shingo.fg8@gmail.com> From: Shingo Tanaka In-Reply-To: <8335v58ppu.fsf@gnu.org> References: <87h7jm2es2.wl-shingo.fg8@gmail.com> <83bl9t8vnb.fsf@gnu.org> <87h7jla6ih.fsf@nicolasgoaziou.fr> <8335v58ppu.fsf@gnu.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.2 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Sun, 02 May 2021 09:08:51 -0400 X-BeenThere: emacs-orgmode@gnu.org List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shingo.fg8@gmail.com, Nicolas Goaziou , 48148@debbugs.gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1619961075; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=4ApH+q2Zp2obokxxuo0jKg+l+Jo0XHaISOIIPtjMLyo=; b=SRPpXowgGV20OUQYiJvrxKRFUqQEKhb/lc0daodBHXO9hKKLL/tsGbzi5jGMz2OyX2SaqA jyE+104AL4TgITjDefxFtGO7oPvzPfBW5sNd31qsIDtDGx01c2+g44bM9geDrMSi9cYdmi EgRSXH0pbNEf02RdcCmD8h6D9IJiQck/A6XMKA40sGGLzJKcJ3gQiW8G19sRfOjB+1XypW BWy46/eqgI9BtSkTUSXmNJMFEdkpwDiylD57BPzriwedNNgH6xwOaaZdyl2nMb2JKQj+FJ dmVAad3ZL+L7wP4VSXzsWQk2QODEilxn7q0EC4jNjXJZxZ0zEYD6K/0Jpg1Mww== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619961075; a=rsa-sha256; cv=none; b=MBUywvAFjw3TlRwbC4GG1uOuTZHfmdubXWwbWjuApG5PrI0MPJi5tTi5Gs4eLHEPqf55aS PDK+MTfJQ3w+Og9GWpA/S/sz+7qey+8M8ACzxO2UJ9XHUDWGXERZIe7xvdWbp251RR8AI/ +3SP3pX7bFG0pLoB7AQtb2YheQr7q9n6eaNde0/xG4eK5r31aYEIgo6kSFWpcMggbqWSXa 9jbnEY/kTeRpCdg+xziIapBRT5zYZBtlnC8CWL6kQGLxQZV8846i70AF8ra/1n4km3JLwi gVU6HcQJ30J0EYmR2cpFtISZCRyWIPnJE/Dcl7AH1kuyzdohLfFhFsMfpR7WDA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=vcuyVvW5; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: 1.64 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=vcuyVvW5; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: CF3FE24B0C X-Spam-Score: 1.64 X-Migadu-Scanner: scn0.migadu.com X-TUID: dGlVUCKC4bGI Thank you for the advice. I see that `window-text-pixel-size' returns true displayed width but I think that's TRT for only the other bug I reported (bug#48149). These two bugs looks similar but the root causes are completed different. This bug (bug#48148) is actually caused by the difference of the width detection methods between line 1036 in ox-ascii.el (`length') and `fill-region'. This is because `org-ascii-template--document-title' first detects the title width by `length' and then tries to fill it by `org-ascii--fill-string' which does the action by `fill-region' inside. And since the filling point in `fill-region' is based on `move-to-column' and it looks like giving the same result as `string-width', I think `string-width' is TRT for this bug. In other words, specific to this bug, only the same width detection method as `fill-region' is required, even if it doesn't give you the precise width displayed. Please correct me if I am wrong. --- Shingo Tanaka On Sun, 02 May 2021 18:11:41 +0900, Eli Zaretskii wrote: > > > From: Nicolas Goaziou > > Cc: Shingo Tanaka , 48148@debbugs.gnu.org > > Date: Sun, 02 May 2021 10:23:34 +0200 > > > > > The accurate method of lining up in these cases is to use > > > window-text-pixel-size instead. That function will return the exact > > > width of a string as it will displayed, in pixels, because it uses the > > > same code as the display engine. > > > > Would you mind giving an example about `window-text-pixel-size' usage in > > this situation? > > I'm not sure what kind of example is necessary. How about if you ask > specific questions about the arguments of that function which you > don't understand clearly how to use? > > > AFAIU, `window-text-pixel-size' returns the size of the window > > No, it returns the size of _text_ when displayed in a window. > > > Note that `text-width' in the code above is not related to the width > > of the window, but is a maximum number of allowed characters on a > > line. > > I didn't mean text-width, I meant the use of string-width: it should > be replaced by a call to window-text-pixel-size.