[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Line wrap reconsidered
From: |
Eli Zaretskii |
Subject: |
Re: Line wrap reconsidered |
Date: |
Fri, 29 May 2020 09:56:34 +0300 |
> From: Yuan Fu <casouri@gmail.com>
> Date: Thu, 28 May 2020 15:34:28 -0400
> Cc: larsi@gnus.org,
> emacs-devel@gnu.org
>
> In the current code IT_DISPLAYING_WHITESPACE can check for can_wrap_before
> and can_wrap_after in the same time, but in my new code, we have to perform
> two checks in the same iteration, because some char can wrap before but now
> after, and some can wrap after but not before, etc.
Then you'll need to augment the test
else if (may_wrap)
with a test that the current character can be at BOL. Maybe you
should also make may_wrap a tristate instead of just a boolean YES/NO.
> > Which "continue" are you alluding to here? Do you mean "lines are
> > continued"? because if lines are not being wrapped, we have only one
> > choice: go back to the last wrap point we found, end the screen line
> > (a.k.a. "break the line") there, and continue with the text on the
> > next screen line.
>
> I think there is another option where we wrap at current point. On line 23356:
>
> /* If line-wrap is on, check if a
> previous wrap point was found. */
> else if (wrap_row_used > 0
> /* Even if there is a previous wrap
> point, continue the line here as
> usual, if (i) the previous character
> was a space or tab AND (ii) the
> current character is not. */
> && (!may_wrap
> || IT_DISPLAYING_WHITESPACE (it)))
> goto back_to_wrap;
>
> I was alluding to this “continue”: “continue the line here as usual”. What
> does it mean? Does it mean we insert a line break here? I think your response
> below confirms my guess.
Yes, "continue the line" here means we break the line here instead of
going back to the wrap point. This code handles the case when there's
a previous wrap point, but the current character fits exactly on the
line, and that current character is a TAB or SPC.
> > I mean the indentation: the original code used TABs and spaces, but
> > your code uses only spaces.
>
> How do I fix it? Any guideline file?
Just make sure indent-tabs-mode is non-nil when you edit C files.
> >> and the redisplay iterator will still go through them LTR
> >
> > Not sure what you mean by "go through them LTR". The iterator can
> > move forward or backward, or even jump to a far-away place. You
> > cannot assume that the next character examined will be the next
> > character in the buffer.
>
> Essentially I want to ask “if may_wrap == true, what does that mean? (In bidi
> context)” Did the character to the left of me (on glass) set it or the
> character to the right of me set it?
The one to the left. But it is not necessarily the "previous"
character in buffer position order.
> Actually, I just tried again and the code works for bidi. Maybe last time I
> didn’t turned on word-wrap while thinking I did.
You need to try both with bidi-paragraph-direction set to
left-to-right and right-to-left. If both work, then the code is OK.
- Re: Line wrap reconsidered, (continued)
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/26
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/26
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/26
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/26
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/27
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/28
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/28
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/28
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/28
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/29
- Re: Line wrap reconsidered,
Eli Zaretskii <=
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/29
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/30
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/31
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/31
- Re: Line wrap reconsidered, Yuan Fu, 2020/05/31
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/31
- Re: Line wrap reconsidered, Eli Zaretskii, 2020/05/27
Re: Line wrap reconsidered, martin rudalics, 2020/05/26