* bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting
@ 2013-12-19 11:38 Jarosław Rzeszótko
2013-12-19 14:02 ` Stefan Monnier
2013-12-19 16:38 ` Drew Adams
0 siblings, 2 replies; 12+ messages in thread
From: Jarosław Rzeszótko @ 2013-12-19 11:38 UTC (permalink / raw)
To: 16192
[-- Attachment #1: Type: text/plain, Size: 1669 bytes --]
I use a current emacs build from VCS. When you use hl-line-mode with the
default settings, the highlighting of the current line takes precedence
over the region highlighting. In my opinion this is bad usability, since
you no longer see where the region is, and in this particular situation
where the current line is would be obvious without the highlighting (the
user is in the middle of selecting the region so he knows where he is in
the file I guess). Would a hl-line-range function of this kind not be a
better default:
(setq hl-line-range-function
(lambda ()
(if (region-active-p)
nil
(cons (line-beginning-position) (line-beginning-position 2)))))
Or one that keeps the current line highlighting only where it does not
interfere with the region highlighting:
(setq hl-line-range-function
(lambda ()
(let ((line-beg-pos (line-beginning-position))
(line-end-pos (line-beginning-position 2)))
(if (region-active-p)
(if (= (point) (region-end))
(cons (point) line-end-pos)
(cons line-beg-pos (point)))
(cons line-beg-pos line-end-pos)))))
The last function is better but since hl-line-range-function returns a
single range, it is impossible to highlight the line on both sides of a
region that is part of a single line. In general I appreciate that this is
customizable and one can overwrite it, but it takes quite some time to fix
it yourself, and I think most users want to see one of those two behaviours
(as evidenced by what most editors do in this respect).
Cheers,
Jarosław Rzeszótko
[-- Attachment #2: Type: text/html, Size: 1746 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting
2013-12-19 11:38 bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting Jarosław Rzeszótko
@ 2013-12-19 14:02 ` Stefan Monnier
2013-12-19 14:19 ` Jarosław Rzeszótko
2013-12-19 16:43 ` Drew Adams
2013-12-19 16:38 ` Drew Adams
1 sibling, 2 replies; 12+ messages in thread
From: Stefan Monnier @ 2013-12-19 14:02 UTC (permalink / raw)
To: Jarosław Rzeszótko; +Cc: 16192
> I use a current emacs build from VCS. When you use hl-line-mode with the
> default settings, the highlighting of the current line takes precedence
> over the region highlighting.
Actually, that depends on the relative position/size of the two.
I've just installed a patch which lowers the priority of the hl-line
highlighting, which seems like a good thing to do in general and which
should resolve this problem (unless you use the same attributes for the
region and the hl-line faces).
Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting
2013-12-19 14:02 ` Stefan Monnier
@ 2013-12-19 14:19 ` Jarosław Rzeszótko
2013-12-19 16:43 ` Drew Adams
1 sibling, 0 replies; 12+ messages in thread
From: Jarosław Rzeszótko @ 2013-12-19 14:19 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 16192
[-- Attachment #1: Type: text/plain, Size: 923 bytes --]
Hi,
There is now a little quirk if the window has a margin, see here:
http://imgur.com/pkxRmhf
The first column on the left is the margin (as in left-margin-width), and
the bright yellow rectangle is the cursor block. When the margin is
disabled, it does fix the issue for me.
Cheers,
Jarosław Rzeszótko
2013/12/19 Stefan Monnier <monnier@iro.umontreal.ca>
> > I use a current emacs build from VCS. When you use hl-line-mode with the
> > default settings, the highlighting of the current line takes precedence
> > over the region highlighting.
>
> Actually, that depends on the relative position/size of the two.
> I've just installed a patch which lowers the priority of the hl-line
> highlighting, which seems like a good thing to do in general and which
> should resolve this problem (unless you use the same attributes for the
> region and the hl-line faces).
>
>
> Stefan
>
[-- Attachment #2: Type: text/html, Size: 1388 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting
2013-12-19 14:02 ` Stefan Monnier
2013-12-19 14:19 ` Jarosław Rzeszótko
@ 2013-12-19 16:43 ` Drew Adams
2013-12-19 17:41 ` Jarosław Rzeszótko
2013-12-19 18:02 ` Stefan Monnier
1 sibling, 2 replies; 12+ messages in thread
From: Drew Adams @ 2013-12-19 16:43 UTC (permalink / raw)
To: Stefan Monnier, Jaros?aw Rzeszótko; +Cc: 16192
> I've just installed a patch which lowers the priority of the hl-line
> highlighting, which seems like a good thing to do in general and which
> should resolve this problem (unless you use the same attributes for the
> region and the hl-line faces).
It's not about the priority of the hl-line highlighting. (And other code
might well expect the priority that was there before.)
It's about the priority of the region highlighting. Raise that,
instead of lowering other priorities case by case (and possibly breaking
other code). It is the region overlay that is new. It is its priority
that needs fixing.
But didn't you say that you didn't want to be fiddling with priorities,
to deal with the problems introduced by this change?
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting
2013-12-19 16:43 ` Drew Adams
@ 2013-12-19 17:41 ` Jarosław Rzeszótko
2013-12-19 19:27 ` Eli Zaretskii
2013-12-19 18:02 ` Stefan Monnier
1 sibling, 1 reply; 12+ messages in thread
From: Jarosław Rzeszótko @ 2013-12-19 17:41 UTC (permalink / raw)
To: Drew Adams; +Cc: 16192
[-- Attachment #1: Type: text/plain, Size: 1145 bytes --]
Correction from my side, the last problem seems to actually be independent
of the fix, I reproduced it with vanilla emacs from vcs, no hl-line-mode,
emacs ran with --no-init, without any .Xresources etc., just:
(setq-default left-margin-width 1)
open a new buffer, select a few lines, and you get this:
http://imgur.com/M1LFjeF
2013/12/19 Drew Adams <drew.adams@oracle.com>
> > I've just installed a patch which lowers the priority of the hl-line
> > highlighting, which seems like a good thing to do in general and which
> > should resolve this problem (unless you use the same attributes for the
> > region and the hl-line faces).
>
> It's not about the priority of the hl-line highlighting. (And other code
> might well expect the priority that was there before.)
>
> It's about the priority of the region highlighting. Raise that,
> instead of lowering other priorities case by case (and possibly breaking
> other code). It is the region overlay that is new. It is its priority
> that needs fixing.
>
> But didn't you say that you didn't want to be fiddling with priorities,
> to deal with the problems introduced by this change?
>
[-- Attachment #2: Type: text/html, Size: 1644 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting
2013-12-19 17:41 ` Jarosław Rzeszótko
@ 2013-12-19 19:27 ` Eli Zaretskii
2013-12-19 19:47 ` Jarosław Rzeszótko
0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2013-12-19 19:27 UTC (permalink / raw)
To: Jarosław Rzeszótko; +Cc: 16192
> Date: Thu, 19 Dec 2013 18:41:51 +0100
> From: Jarosław Rzeszótko <sztywny@gmail.com>
> Cc: 16192@debbugs.gnu.org
>
> Correction from my side, the last problem seems to actually be independent
> of the fix, I reproduced it with vanilla emacs from vcs, no hl-line-mode,
> emacs ran with --no-init, without any .Xresources etc., just:
>
> (setq-default left-margin-width 1)
>
> open a new buffer, select a few lines, and you get this:
>
> http://imgur.com/M1LFjeF
My bad, now fixed in trunk revision 115615.
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting
2013-12-19 19:27 ` Eli Zaretskii
@ 2013-12-19 19:47 ` Jarosław Rzeszótko
2013-12-19 20:31 ` Stefan Monnier
0 siblings, 1 reply; 12+ messages in thread
From: Jarosław Rzeszótko @ 2013-12-19 19:47 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 16192
[-- Attachment #1: Type: text/plain, Size: 663 bytes --]
Thanks, it's perfect now!
Cheers,
Jarosław Rzeszótko
2013/12/19 Eli Zaretskii <eliz@gnu.org>
> > Date: Thu, 19 Dec 2013 18:41:51 +0100
> > From: Jarosław Rzeszótko <sztywny@gmail.com>
> > Cc: 16192@debbugs.gnu.org
> >
> > Correction from my side, the last problem seems to actually be
> independent
> > of the fix, I reproduced it with vanilla emacs from vcs, no hl-line-mode,
> > emacs ran with --no-init, without any .Xresources etc., just:
> >
> > (setq-default left-margin-width 1)
> >
> > open a new buffer, select a few lines, and you get this:
> >
> > http://imgur.com/M1LFjeF
>
> My bad, now fixed in trunk revision 115615.
>
[-- Attachment #2: Type: text/html, Size: 1204 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting
2013-12-19 16:43 ` Drew Adams
2013-12-19 17:41 ` Jarosław Rzeszótko
@ 2013-12-19 18:02 ` Stefan Monnier
[not found] ` <bcaf51ae-dec7-4ac3-87f8-0142ababbc9c@default>
1 sibling, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2013-12-19 18:02 UTC (permalink / raw)
To: Drew Adams; +Cc: Jaros?aw Rzeszótko, 16192
> It is the region overlay that is new. It is its priority that
> needs fixing.
This narrow-minded "if a bug appear it must be in the new code" point of
view leads to unmaintainable messes of hacks upon hacks.
hl-line's overlay is a "background" highlight (not in the "background
color" sense, but in a "background noise" sense), so it makes a lot of
sense to give it a low priority.
Stefan
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting
2013-12-19 11:38 bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting Jarosław Rzeszótko
2013-12-19 14:02 ` Stefan Monnier
@ 2013-12-19 16:38 ` Drew Adams
1 sibling, 0 replies; 12+ messages in thread
From: Drew Adams @ 2013-12-19 16:38 UTC (permalink / raw)
To: Jaros?aw Rzeszótko, 16192
[-- Attachment #1: Type: text/plain, Size: 792 bytes --]
IMO, this is a duplicate of bug (regression) #15899.
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15899
Now, region highlighting can take a back seat to other highlighting. Not good.
As I said in that thread, "Selection highlighting should, at the very least by default, visibly cover the entire selection."
I use a current emacs build from VCS. When you use hl-line-mode with the default settings, the highlighting of the current line takes precedence over the region highlighting. In my opinion this is bad usability, since you no longer see where the region is, and in this particular situation where the current line is would be obvious without the highlighting (the user is in the middle of selecting the region so he knows where he is in the file I guess).
[-- Attachment #2: Type: text/html, Size: 4159 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-06-17 15:07 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-19 11:38 bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting Jarosław Rzeszótko
2013-12-19 14:02 ` Stefan Monnier
2013-12-19 14:19 ` Jarosław Rzeszótko
2013-12-19 16:43 ` Drew Adams
2013-12-19 17:41 ` Jarosław Rzeszótko
2013-12-19 19:27 ` Eli Zaretskii
2013-12-19 19:47 ` Jarosław Rzeszótko
2013-12-19 20:31 ` Stefan Monnier
2013-12-19 18:02 ` Stefan Monnier
[not found] ` <bcaf51ae-dec7-4ac3-87f8-0142ababbc9c@default>
2014-06-17 14:30 ` Drew Adams
2014-06-17 15:07 ` Stefan Monnier
2013-12-19 16:38 ` Drew Adams
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).