[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27427: 26.0.50; Native line numbers lead to display error in company
From: |
Dmitry Gutov |
Subject: |
bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup |
Date: |
Fri, 23 Jun 2017 02:17:24 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Thunderbird/54.0 |
On 6/22/17 5:55 PM, Eli Zaretskii wrote:
Yep! And there are zero outstanding bug reports related to this.
Well, except this one ;-)
But it's not about line-prefix, it's about a new feature in Emacs that
was just introduced in a way that's different from those that came before.
I'm saying it's not easy, and I'm not brimming with ideas.
Is it not easy because the assumption about column-zero is hard-coded
in many places? Or for some other reason?
Because if we're not allowed to use column-zero, the first line of the
popup and the rest are behaving differently. And, depending on which
feature is causing the first character of the visual line to be on a
non-zero column, the popup lines are offset in different directions.
Keeping the numbers out of the margins was my explicit design goal,
because some packages want the margins, and we don't have a good
solution for "sharing" margins.
It's not without problems, though, as it introduces a new, different
type of margin, doesn't it? Why not put it outside of the window bounds
next to the "actual" margins? That's one option.
So from my POV putting the numbers in
the margins would be a step backward. It will probably also create
major havoc for the few packages that do display in the margins,
Not any more havoc than linum or nlinum which many people install and
use, and are apparently fine with them taking up one of the margins.
because Emacs facilities for layout of text and other stuff there are
exceedingly limited.
But of course, it would be ideal if you could also introduce a facility
that would allow sharing of margins (and hopefully also fringes) between
different modes.
Not sure what you mean by "chromeless" here, but if I understand you
correctly, Martin's work is already on master.
I think so, yes.
1. The first visual line containing the popup has the line number at its
beginning. And as such, the popup line is shifted to the right.
That's the "BOL at non-zero column" issue, right?
Yes, but also the lack of ability to disable the line numbering on a
line-by-line basis (which could be one solution for this problem).
The lack of numbers is a "feature", I think: only "physical" lines in
buffer text are counted, newlines in overlay and display strings do
not count.
It is indeed a feature from your standpoint, but it's a bug from the
point of view of the popup's rendering.
Imagine of the line numbers were displayed using line-prefix (I'm not
really suggesting that, but...). Then the popup could pick them up and
include in the overlay's `display' property text. The user wouldn't see
any difference.
Can you artificially offset the beginning of the overlay to account
for the line numbers, and see if that alone solves the problem of the
first lines, and doesn't cause problems in the subsequent lines?
Offset the beginning by how much? By
(- (car (posn-col-row (posn-at-point (point))))
(car (posn-col-row (posn-at-point (beginning-of-visual-line)))))
? Let's call the value of this expression X.
Let's try a thought experiment.
Suppose X is non-zero because of line numbering. Then adding an offset
of X to the position of the first popup line should fix it.
What if X is non-zero because of line-prefix, though? If it's because of
line-prefix variable, okay, we don't support it.
What if X is non-zero because of the line-prefix text property? We'd get
an "array out of bounds" error somewhere, because the first popup line
is currently positioned correctly.
So when should we add an X offset to the first popup line's position?
Suppose X is non-nil because of line numbering and the line-prefix text
property both? Org uses the line-prefix text property in certain
configurations, so it's a real possibility.
One idea would be to first create an overlay on the first visual line
which overrides the line-prefix property to zero, *then* measure
(car (posn-col-row (posn-at-point (beginning-of-visual-line))))
, then delete the said overlay and proceed. Doesn't that sound like a
mess already?
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, (continued)
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Dmitry Gutov, 2017/06/19
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Eli Zaretskii, 2017/06/20
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Dmitry Gutov, 2017/06/20
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Eli Zaretskii, 2017/06/20
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Dmitry Gutov, 2017/06/21
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Alexander Miller, 2017/06/21
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Eli Zaretskii, 2017/06/21
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Dmitry Gutov, 2017/06/21
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Eli Zaretskii, 2017/06/22
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup,
Dmitry Gutov <=
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Eli Zaretskii, 2017/06/23
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Dmitry Gutov, 2017/06/23
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Eli Zaretskii, 2017/06/24
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Eli Zaretskii, 2017/06/24
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Dmitry Gutov, 2017/06/24
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Dmitry Gutov, 2017/06/25
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Eli Zaretskii, 2017/06/25
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Dmitry Gutov, 2017/06/25
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Eli Zaretskii, 2017/06/25
- bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup, Dmitry Gutov, 2017/06/25