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#43405: Tool bar item doesn't align to the right edge Date: Mon, 21 Sep 2020 22:04:36 +0300 Message-ID: <83a6xjx86z.fsf@gnu.org> References: <83pn6shjni.fsf@gnu.org> <20200911074445.GB5194@tuxteam.de> <87zh5uqdqm.fsf@mail.linkov.net> <834ko1da33.fsf@gnu.org> <87sgbloe5z.fsf@mail.linkov.net> <83een5bkja.fsf@gnu.org> <87v9ghlc5c.fsf@mail.linkov.net> <83d02pbhny.fsf@gnu.org> <87een4qi9i.fsf_-_@mail.linkov.net> <837dsw9mpu.fsf@gnu.org> <87r1r3ncwq.fsf@mail.linkov.net> <83a6xq995x.fsf@gnu.org> <831rj07c0j.fsf@gnu.org> <83v9gc5u94.fsf@gnu.org> <83sgbg5sg2.fsf@gnu.org> <83v9gb4g2a.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23058"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 43405@debbugs.gnu.org, juri@linkov.net To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 21 21:05:32 2020 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 1kKR80-0005pk-8H for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Sep 2020 21:05:32 +0200 Original-Received: from localhost ([::1]:59222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKR7y-0002Hp-Kz for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 21 Sep 2020 15:05:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKR7W-0002HL-OB for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2020 15:05:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44670) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kKR7V-0002Hb-P6 for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2020 15:05:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kKR7V-0007ej-KT for bug-gnu-emacs@gnu.org; Mon, 21 Sep 2020 15:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Sep 2020 19:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43405 X-GNU-PR-Package: emacs Original-Received: via spool by 43405-submit@debbugs.gnu.org id=B43405.160071508529403 (code B ref 43405); Mon, 21 Sep 2020 19:05:01 +0000 Original-Received: (at 43405) by debbugs.gnu.org; 21 Sep 2020 19:04:45 +0000 Original-Received: from localhost ([127.0.0.1]:56216 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKR7F-0007eA-A1 for submit@debbugs.gnu.org; Mon, 21 Sep 2020 15:04:45 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58452) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKR7A-0007dv-CJ for 43405@debbugs.gnu.org; Mon, 21 Sep 2020 15:04:43 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34618) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKR74-0002Fp-Mz; Mon, 21 Sep 2020 15:04:34 -0400 Original-Received: from [176.228.60.248] (port=1290 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kKR73-0000vi-Tf; Mon, 21 Sep 2020 15:04:34 -0400 In-Reply-To: (message from Robert Pluim on Mon, 21 Sep 2020 20:30:53 +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:188636 Archived-At: > From: Robert Pluim > Cc: 43405@debbugs.gnu.org, juri@linkov.net > Date: Mon, 21 Sep 2020 20:30:53 +0200 > > So let's assume we do this by exending the display spec to allow > > '(:right-justify t) > > which would mean to move everything on this line as far to the right > in the window as possible. > > At some point weʼd end up in 'gui_produce_glyphs' with a 'struct > iter' pointing at the char with that property set. Then: > > remember it->current_x > loop over the iters until we hit eol or max_x, calling PRODUCE_GLPYHS > The final it->current_x minus the remembered one is the width of the remaining > glyphs on the line. > Now set it->current_x to the window right edge minus the width. > > Does that sound like it would work? Is there a more direct way of > calculating that width? (I got lost in all the various move_to > functions). I'd first try to repeat what we do for :align-to support: insert a stretch glyph of a suitable width, computed using it->last_visible_x and the width of the image for the button that has to be right-justified. See produce_stretch_glyph (except that most of it is not relevant, since :align-to supports a lot of functionalities).