unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Gallagher - NOAA Affiliate via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 50506@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#50506: 28.0.50; display-line-numbers equivalent for linum-format?
Date: Wed, 15 Sep 2021 10:45:01 -0600	[thread overview]
Message-ID: <CA+e+kb07O0yBq_-J==DyeVNBnh8-RK8AOkX4r96y5KSO16OxTw@mail.gmail.com> (raw)
In-Reply-To: <83ee9pby9t.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 3860 bytes --]

So, in concept then, as the display-line-numbers code operates now adding a
separator character that respects direction isn't possible because when
maybe_produce_line_number is called the code doesn't yet know the direction
of the text. The correct fix is to somehow have the function call for
generating the line number glyphs after the buffer glyphs are computed...
or to generate both L2R and R2L line numbers and then let the code decide
what to display once reversed_p is decided.

This is verified by the fact that if I make a check on paragraph_direction
instead of embedding, the first line number displays incorrectly because
this flag has yet to be set.

Either way, I hate to admit it, but any solution to that problem is way
beyond my skillset and you'd have to spend a lot of time checking/fixing
any my work if I did make the attempt.

On Wed, Sep 15, 2021 at 10:26 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Michael Gallagher - NOAA Affiliate <michael.r.gallagher@noaa.gov>
> > Date: Wed, 15 Sep 2021 10:08:49 -0600
> > Cc: Lars Ingebrigtsen <larsi@gnus.org>, 50506@debbugs.gnu.org
> >
> >
> > [1:text/plain Show]
> >
> >
> > [2:text/html Hide Save:noname (5kB)]
> >
> > The code as it stands displays correctly with TUTORIAL.he.
>
> What is the value of bidi-paragraph-direction in the buffer where you
> visit TUTORIAL.he for testing this feature?  It should be nil.
>
> Your code does this:
>
>   +  if (FIXNATP (Vdisplay_line_numbers_separator_character)
>   +      && it->paragraph_embedding != L2R)
>   +    {
>   +      tem_it.c = tem_it.char_to_display = XFIXNAT
> (Vdisplay_line_numbers_separator_character);
>
> That is, it treats any value of it->paragraph_embedding that is not
> L2R as if it were R2L.  But that is incorrect, because the usual value
> of it->paragraph_embedding is NEUTRAL_DIR, which corresponds to the
> nil value of bidi-paragraph-direction, the default.  That nil value
> means to determine the actual paragraph direction dynamically from the
> contents of the paragraph.  It is this nil value that presents the
> problem.  Your code treats that value as meaning right-to-left, but
> that is wrong.
>
> For example, all of the paragraphs on TUTORIAL.he are displayed
> right-to-left (because they include right-to-left text), but the last
> paragraph, the one which shows the file-local variables, is displayed
> left-to-right.  Try turning on this feature and look at that last part
> of the buffer to see if your code works correctly.
>
> > I was confused about the relationship between paragraph_embedding and
> bidi-paragraph_direction.
>
> bidi-paragraph-direction determines the value of it->paragraph_embedding.
> However, the default value of bidi-paragraph-direction is nil, and
> that is translated into NEUTRAL_DIR value of it->paragraph_embedding.
>
> > I'm
> > assuming you're saying there needs to be an additional check on the
> value of para_direction in the if
> > statements?
>
> I don't think you can base this on it->paragraph_embedding, because it
> doesn't reflect the actual paragraph direction on display when
> bidi-paragraph-direction is nil, the default.  The display code
> computes the actual direction of each screen line dynamically in that
> case, and stores it in the reversed_p flag of the glyph row.  The
> problem is that when the code generates the line number of the first
> screen line it needs to produce, that flag is not yet computed, it
> will only be computed when the first character on the screen line, the
> one after the line number, will be laid out.  And by that time, the
> line number was already generated.  This is the problem that needs
> fixing for this to work reliably with all scripts.
>
> Thanks.
>


-- 
Michael Gallagher, PhD
CIRES Research Scientist
Polar Observations and Processes Team (ESRL/NOAA/PSD)
325 Broadway, Boulder, Colorado 80305

[-- Attachment #2: Type: text/html, Size: 5167 bytes --]

  reply	other threads:[~2021-09-15 16:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10  7:40 bug#50506: 28.0.50; display-line-numbers equivalent for linum-format? Michael Gallagher (CIRES/NOAA) via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-10 12:30 ` Eli Zaretskii
2021-09-10 16:00   ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-11 11:53     ` Eli Zaretskii
2021-09-11 12:03     ` Lars Ingebrigtsen
2021-09-13 17:54       ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-13 18:05         ` Eli Zaretskii
2021-09-13 18:17           ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-13 18:27             ` Eli Zaretskii
2021-09-14 16:17               ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-14 17:24                 ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-14 17:35                 ` Eli Zaretskii
2021-09-15 15:22                   ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-15 15:49                     ` Eli Zaretskii
2021-09-15 16:08                       ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-15 16:26                         ` Eli Zaretskii
2021-09-15 16:45                           ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-09-15 16:53                             ` Eli Zaretskii
2021-09-15 17:32                               ` Michael Gallagher - NOAA Affiliate via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-15 18:10                                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+e+kb07O0yBq_-J==DyeVNBnh8-RK8AOkX4r96y5KSO16OxTw@mail.gmail.com' \
    --to=bug-gnu-emacs@gnu.org \
    --cc=50506@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    --cc=michael.r.gallagher@noaa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).