Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Persistent highlight is taller than transient highlight #3478

Closed
iwehrman opened this issue Apr 18, 2013 · 33 comments · Fixed by #3803
Closed

Persistent highlight is taller than transient highlight #3478

iwehrman opened this issue Apr 18, 2013 · 33 comments · Fixed by #3803

Comments

@iwehrman
Copy link
Contributor

Whoops

@peterflynn
Copy link
Member

This is UTR for me on WinXP and on my non-retina Mac. Could it be a retina-only issue?

@RaymondLim
Copy link
Contributor

I can reproduce it on my Mac.

@peterflynn
Copy link
Member

@RaymondLim is it retina or non-retina? Which version of OS X?

@RaymondLim
Copy link
Contributor

It's retina. OS 10.8.2.

Not sure it has to do with font or not since you won't see it with normal text size until you increase the font size multiple times.

@RaymondLim
Copy link
Contributor

Just confirmed that this can be reproduced on Windows with very large font size.

@TomMalbran
Copy link
Contributor

I was checking on Windows, and the problem is that the height of span elements inside the pre ones (the lines in CodeMirror) is bigger than the height of the actual pre elements when the the text-height is bigger than the default one. So then the search background that is applied over the span elements, is bigger than the selected search result highlight.

The problem is that the line-height is increased at the same rate as the font-size, when it shouldn't. I could fix it by specifying the original line-height as 1.25em with and removing the line-height adjustment in the font-adjustment code. I'll post a fix for this using this solution.

@ghost ghost assigned TomMalbran Apr 22, 2013
@njx
Copy link
Contributor

njx commented Apr 22, 2013

Reviewed. Low priority, to @TomMalbran since you've been looking into it already. Thanks!

@redmunds
Copy link
Contributor

redmunds commented May 8, 2013

Setting to Fixed But Not Closed (FBNC) and assigning back to @iwehrman . Ian, confirm that bug is fixed and then close.

@iwehrman
Copy link
Contributor Author

iwehrman commented May 8, 2013

Unfortunately I still see this problem at 2f2361e

hover

@iwehrman iwehrman reopened this May 8, 2013
@redmunds
Copy link
Contributor

redmunds commented May 8, 2013

@iwehrman What OS are you using? Is this Brackets or Edge Code?

@iwehrman
Copy link
Contributor Author

iwehrman commented May 8, 2013

Mac; Brackets.

about

@TomMalbran
Copy link
Contributor

I can't reproduce this on Windows anymore and I don't have a Mac to test it. Anyway, could it be a problem with having a line height in float values instead of integers for the pixel units?

@redmunds
Copy link
Contributor

redmunds commented May 8, 2013

Yeah, I thought of that. I'll try rounding down. I can repro on my Mac, so I'll take a look. It's a retina display so the 1 pixel line is so thin I couldn't see it at max font-size until I took a screen shot and zoomed in :)

@redmunds
Copy link
Contributor

redmunds commented May 8, 2013

@TomMalbran I'm seeing it with font-size: 72px; line-height: 90px; so it's not a rounding problem.

@TomMalbran
Copy link
Contributor

Maybe the line height needs to be bigger in Mac since the font is a bit bigger? Maybe adjusting the LINE_HEIGHT ratio constant could fix it?

@TomMalbran TomMalbran reopened this May 9, 2013
@TomMalbran
Copy link
Contributor

Wrong button, wanted to discard the comment since I saw @redmunds request that should fix it.

TomMalbran added a commit that referenced this issue May 9, 2013
@redmunds
Copy link
Contributor

FBNC back to @iwehrman (again)

@iwehrman
Copy link
Contributor Author

Sorry :(

sorry

@TomMalbran
Copy link
Contributor

I cant reproduce this anymore on Windows. I tried with the font at 72px and checked it zoomed to find the 1px line, but there isn't one anymore. I am actually starting to see spaces between consecutive background highlights, which is expected with a line height bigger than what it should be.

@redmunds
Copy link
Contributor

@iwehrman Does it happen for every text string, every time? If it only happens in certain cases, then please provide more details.

Also, it appears that you're on a non-retina system, correct? What version of Mac?

@iwehrman
Copy link
Contributor Author

It seems to happen every time. I am on a Retina Mac. (The screenshots are zoomed in.)
about

@iwehrman
Copy link
Contributor Author

I see the same problem on a non-Retina external monitor also, though.

non-retina

@redmunds
Copy link
Contributor

This was auto-closed. Re-open.

@redmunds
Copy link
Contributor

@iwehrman I can no longer reproduce this one. Are you still seeing it?

@iwehrman
Copy link
Contributor Author

I still see it on b6c5880. Retina and non-retina screenshots below, which show highlight overlap all over the place.

retina
non-retina

@redmunds
Copy link
Contributor

@iwehhrman I'm not seeing it on Win7 or Mac10.8 (both retina and non-retina). What OS are you on?

Does it happen at every zoom level, or only certain ones?

If you have any extensions installed, try disabling/uninstalling them.

@iwehrman
Copy link
Contributor Author

My system is 100% clean. I just rebuilt brackets-shell from master, disabled all my extensions, cleared cef_data and pulled again from master so I'm now at 3d4352a. I'm on the same computer and operating system I was on a week ago.

Note, however, that my font size has been bumped up one notch using View > Increase Font Size. Sorry I neglected to mention that earlier 😬

@redmunds
Copy link
Contributor

I can reproduce on both Mac and Windows with this recipe:

  1. With a file open, View > Restore Font Size to make sure you're at the default font size
  2. View > Increase Font Size (only once)
  3. Find something on page

Doesn't seem to matter which order steps 2 and 3 are done, but that's the only font size I have seen the problem at.

@TomMalbran
Copy link
Contributor

I found out that there is a rounding problem, but different from the one we initial thought of. CodeMirror seems to be doing the rounding, if you increase the font size and check both the line height and the value returned by editor.getTextHeight(), you can see that the CodeMirror API returns the integer part of the value (it truncates the float value).

So @redmunds original fix at #3757 should solve this problem. I did checked that it actually fixed it.

@redmunds
Copy link
Contributor

@TomMalbran That pull request used Math.ceil(). I pushed a fix that uses Math.round(), which should be more accurate and consistent with other rendering. Give #3849 a try and let me know how it works.

@TomMalbran
Copy link
Contributor

Well since we use 1.3 as the line height ratio, Math.round seems to work. I tested it and I couldn't see the background highlight when increasing the font size once.

@redmunds
Copy link
Contributor

FBNC to @iwehrman

@iwehrman
Copy link
Contributor Author

Yep, fixed. Closing. Nice work!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants