From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: Patch to vertically center line content when using line-spacing variable Date: Mon, 30 Sep 2019 09:07:28 +0200 Message-ID: References: <83ftl85tbn.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="127627"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Eli Zaretskii , Stefan Kangas , emacs-devel@gnu.org To: Jesse Medeiros Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 30 09:08:12 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iEpn1-000X4C-8Q for ged-emacs-devel@m.gmane.org; Mon, 30 Sep 2019 09:08:11 +0200 Original-Received: from localhost ([::1]:46590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iEpn0-0003lQ-64 for ged-emacs-devel@m.gmane.org; Mon, 30 Sep 2019 03:08:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40838) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iEpmQ-0003fX-0B for emacs-devel@gnu.org; Mon, 30 Sep 2019 03:07:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iEpmO-000722-Qw for emacs-devel@gnu.org; Mon, 30 Sep 2019 03:07:33 -0400 Original-Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:38782) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iEpmO-00071R-Kd; Mon, 30 Sep 2019 03:07:32 -0400 Original-Received: by mail-ed1-x534.google.com with SMTP id l21so7599320edr.5; Mon, 30 Sep 2019 00:07:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=AqyZP++09FMANZq+3oYdkvwaS5fChdUa00hE37i+rP8=; b=LLHH2xFdewnYwxQhYJSGh1hIVvUrZaPEYBXhT1Dcx82uC/QZd2n8Zd3Qt3R7pW84zt OHP7iXcwRR8JTKdnXqXN2fEnvunoHGFdpLpdT6okMJ3FABIDyIQoL+sScD8YDo4UPS0H LRfXNUSE/tKnEm9XI0TsQdvgTmdqKSVFVNK/tpH4MUyUXOXd0xf4KRhN456yRII61Xrq nvd9LYzHDqGGD6TF19NkrEpwOdOiqcBNFPiHAyztcxLWZMV/xxPC3yqs94qD7wBYN1nx YlRly4UgVoHmTo95AKQkGc7mj8lT9HAOW0cLVbSO8Gzs2sKwGUOlajFkpsi05SOMsM+p 6NsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=AqyZP++09FMANZq+3oYdkvwaS5fChdUa00hE37i+rP8=; b=PE4mq0Q61/0p0b1xxiHqhasTF7DFi9ArevwHWHflzz7GrBrfl3DDSDDs/0qEI3Fj2p 9Ky8A6C9wJ+k+9H6kW5/0wezcizTblG2hLpVsTH6V33mcWP3ashQ3E/gQY8gDYU2Btr9 +o9BrFvSeTGv73L2Kcv+6VE8DIXpgWFDTofma1famwNGp9t9lsXPh96ByldD30Y3sMmQ Ae/0hGWIjEKXYFziZ8Qf3NgX089NclBOXehBp4FA5QN5MAkMyvlxl0AMXMt15vdHYcxv EXRbHn9XQjynddkWBgPRt51epVeS1JhiIPgk+j04BVI6O/PmByrIYet6TnwOBttP7Eeu Bnog== X-Gm-Message-State: APjAAAWRjSVwEXd/sMZZhd2kcVTWt0pa9g1+MfIUZEZbpK6G04ii/mbp WMAmoKK4rrXuylnmOxuPq/k= X-Google-Smtp-Source: APXvYqwKgOiJ7b7qbe2zyBV3elzbX8GuKZqVkcy8LHmbZfRlMCncf2S+yxylSulvJUDVmg2n7GB3Fw== X-Received: by 2002:a17:906:d154:: with SMTP id br20mr18362599ejb.79.1569827250949; Mon, 30 Sep 2019 00:07:30 -0700 (PDT) Original-Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id h38sm2274988edh.13.2019.09.30.00.07.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2019 00:07:29 -0700 (PDT) In-Reply-To: (Jesse Medeiros's message of "Sun, 29 Sep 2019 20:54:01 -0300") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::534 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240406 Archived-At: >>>>> On Sun, 29 Sep 2019 20:54:01 -0300, Jesse Medeiros said: Jesse> I've worked the on these issues you raised. Hopefully it's all o= k now. Nit-picking below, plus one question about the code. Jesse> From 9bc5cbb727e5dcac9f774028858e2608d1a23033 Mon Sep 17 00:00:0= 0 2001 Jesse> From: Jesse Nazario Jesse> Date: Sun, 8 Sep 2019 20:06:15 -0300 Jesse> Subject: [PATCH] Center lines vertically with line-spacing-verti= cal-center Jesse> When using line-spacing, the new variable line-spacing-vertical-= center Jesse> can be set to non-nil to center the line content Jesse> vertically. We use ChangeLog format commit messages, see CONTRIBUTE for details. One easy way to get the format right is: C-x v d ; runs vc-dir m ; mark the file(s) you=CA=BCre committing v ; runs vc-next-action, which pops up a commit buffer, ; where you can write the one-line commit summary, ; and then C-c C-w ; runs log-edit-generate-changelog-from-diff, which scrapes ; the file and function names from the diff ; fill in the details about the changes Jesse> --- Jesse> doc/lispref/display.texi | 5 +++++ Jesse> etc/NEWS | 4 ++++ Jesse> src/buffer.c | 14 ++++++++++++++ Jesse> src/buffer.h | 4 ++++ Jesse> src/xdisp.c | 10 +++++++++- Jesse> 5 files changed, 36 insertions(+), 1 deletion(-) Jesse> diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi Jesse> index fd6820897f..875c50c6ef 100644 Jesse> --- a/doc/lispref/display.texi Jesse> +++ b/doc/lispref/display.texi Jesse> @@ -2195,6 +2195,11 @@ Line Height Jesse> number of pixels put below lines. A floating-point number spec= ifies Jesse> the spacing relative to the frame's default line height. =20 Jesse> + The @code{line-spacing} parameter creates the space by puttin= g some Jesse> +margin only below the line. If you wish to center the line Jesse> vertically Two spaces after '.' Jesse> +instead, you can set the variable @code{line-spacing-vertical-c= enter} Jesse> +as non-nin. Jesse> + non-nil Jesse> diff --git a/src/xdisp.c b/src/xdisp.c Jesse> index 95895ec3ac..e2c7309f32 100644 Jesse> --- a/src/xdisp.c Jesse> +++ b/src/xdisp.c Jesse> @@ -29307,7 +29307,15 @@ gui_produce_glyphs (struct it *it) =20 Jesse> if (extra_line_spacing > 0) Jesse> { Jesse> - it->descent +=3D extra_line_spacing; Jesse> + if (! NILP (BVAR (XBUFFER (it->w->contents), Jesse> + line_spacing_vertical_center))) I think you've inverted the test here, should this not be if (NILP ....) ? Robert