New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Selecting long lines in a diff hunk in Emacs 25 highlights extra lines #2758
Comments
I can confirm.
This part happens in 24.5 as well. Both these issues are fixed using the |
PPS: I noticed that if you click once on a diff hunk in 25.1 then the line will automatically be highlighted, but in 24.5 it just positions the point like expected. I wonder what happened in 25.1 that broke this. |
I am trying to wrap my head around the changes in |
I have pushed the result to a new branch |
That has annoyed me for a while to but I did not realize it was a regression with 25.1.
Some code that used to be run when the mouse is dragged is now already run on Anyway, I fixed it. |
Hm, not quite, seems a bit more complicated. |
In v25.1 the region highlighting happens at a different time in the command loop than it used to. It now happens after |
I cannot reproduce these issues anymore with v25.1! If you can confirm that, then we should probably start using the new implementation at least for that Emacs version. |
We should squash the commits and the final commit message should explain each change. There should probably be a bullet point for each of the current commits. @npostavs could you please do that for your commits, I don't fully understand all the current commit messages. |
Oh, I got mixed up as to which thing is broken where, see #2293 (comment) for the correct details. The I do see the line rendering thing regardless, it might depend on the font. Here is a screenshot, notice the orange line crosses the
I'll try to squash things down into something more managable tomorrow. |
Or maybe we should just give up and use this instead: diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 9088e2f..f242193 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -2111,15 +2111,7 @@ (defun magit-diff-update-hunk-region (section)
(ov sbeg cbeg 'face 'magit-diff-lines-heading
'display (concat (magit-diff-hunk-region-header section) "\n"))
(ov cbeg rbeg 'face face 'priority 2)
- (when (and (window-system) magit-diff-show-lines-boundary)
- (ov rbeg (1+ rbeg) 'before-string
- (propertize (concat (propertize "\s" 'display '(space :height (1)))
- (propertize "\n" 'line-height t))
- 'face 'magit-diff-lines-boundary))
- (ov rend (1+ rend) 'after-string
- (propertize (concat (propertize "\s" 'display '(space :height (1)))
- (propertize "\n" 'line-height t))
- 'face 'magit-diff-lines-boundary)))
+ (ov rbeg (1+ rend) 'face 'bold)
(ov (1+ rend) send 'face face 'priority 2)))))
;;; Diff Extract |
Yeah, Stefan did suggest something like that in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21468#28 |
Was changing the header colour when the mouse is clicked down an intentional change? It's a bit distracting in my theme.
I don't think that is as easy to view as the previous behaviour. |
@npostavs' squashed iteration can be found in #2791. I have also pushed a new iteration which lets users pick their preferred variant: https://github.com/magit/magit/compare/hunk-region-styles?expand=1.
No, but I am not sure how easy it is to fix. |
My second commit seems to do the trick. |
I have pushed a fix for that part. |
Okay. Piu. I think I am done. I just merged my latest iteration of the hunk-region ordeal ;-) The new option |
@tarsius Feature-wise it looks fine, thanks for your and @npostavs's efforts. However, it hangs Emacs (25+) when selecting some lines past the window edge, forcing me to kill the process. Recipe: In the status buffer select a diff that goes past the window edge and go to the end of the line. |
Yikes. I can reproduce and have temporarily removed the |
Should the underline variant be temporarily removed from the default value of |
Yes. Done. |
The older version in ef91987 had the same issue, so its not something in my recent changes. "Stepping over the line" is what triggers the issue, when removing the bottom underline (or the top overline when moving backward), then the hang does not occur. Not very surprising, but confirmed. |
I was able to prevent the hang, which shows that for some reason (tm) The debug code with comments can be found at https://github.com/magit/magit/compare/debug-align-to?expand=1, in particular ce311cf. |
It seems that the amount it goes past the window edge matters too. I have a tiling window manager and with Emacs at full screen, the Hmm, and then the |
So basically we both have no idea what is going on? Those little cute lines seemed like such a good and simple idea at the time... Maybe it's time to admit that, like Eli says, we are indeed abusing the display engine. Should I just remove the leftover documentation about the "temporarily" removed function and we put this of for later again? At least we now have a variant which just makes the "region" bold and isn't affected by any of those glitches. I think our time would be better invested lobbying for negative overlay priority and maybe even overlay effects. (By overlay effect I mean that e.g. |
I've reported this as Emacs Bug#24633, but I expect it won't be fixed until Emacs 26 anyway. So unless there is some clever workaround, "temporarily" will be for quite a while. |
So it looks like the problem is that the decision to scroll the window doesn't take into account the https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24633#24
So yeah, probably we should just give up on this. |
Actually using something like |
This iteration does not suffer from the infinite hang of the previous version, but the lines it draws are sometimes to short. There is nothing we can do about it. For more information see #2758 ff.
I've reintroduced the underline variant with the suggested change. This time around the overlay variant is used as the default regardless of Emacs version. The "wonfix" on this issue means "we won't provide a variant that draws boundary lines and has no glitches". That just seems more and more impossible. Choose the glitches that bother you less or use the face (bold) variant. Those are the only options, I am afraid. |
emacs -Q
load magit and enter the status buffer for the repo.C-SPC
to select the line.Notice how it's normal in Emacs 24.5 but in 25.1 the lines above and below the line are highlighted as well, pushing the selected line and the one below it down 1/2 lines respectively.
PS: I noticed how if you have consecutive lines that go past the window edge and you try to use the mouse to click and drag a region, the selection will jump right to the bottom of the lines instead of going line by line as would happen when using the keyboard.
Magit 20160902.1451, Git 2.9.3, Emacs 25.1.1, gnu/linux
The text was updated successfully, but these errors were encountered: