Coder Social home page Coder Social logo

Fuzzy highlighting? about code.pyret.org HOT 14 CLOSED

brownplt avatar brownplt commented on July 29, 2024
Fuzzy highlighting?

from code.pyret.org.

Comments (14)

jpolitz avatar jpolitz commented on July 29, 2024

(This is on horizon, not on CPO proper)

from code.pyret.org.

blerner avatar blerner commented on July 29, 2024

It's this: d220a2d#diff-5828ef0df6fd1cbf728e4103df9b1affR69. Turning off that one rule fixes the fuzziness, but also makes the lines appear separately highlighted. Problem is every single token is its own <span> with its own box shadow, and they overlap. This might be a partial solution: http://blog.dudak.me/2014/css-shadows-under-adjacent-elements/, but because CM sets a z-index on every row, this will only fix side-to-side overlap, not top-to-bottom overlap.

from code.pyret.org.

jpolitz avatar jpolitz commented on July 29, 2024

Also, changing the box-shadow to border: 1px solid hsl(220, 100%, 95%) seems to fill in the extra space between lines, if that's the goal.

from code.pyret.org.

jpolitz avatar jpolitz commented on July 29, 2024

The other issue I see is that it looks like there's supposed to be a box around fun and end, but no amount of z-index muckery makes it show up. Is this a feature-in-progress?

from code.pyret.org.

blerner avatar blerner commented on July 29, 2024

Using a full border works, but it mucks with the horizontal spacing. Using only border-top and border-bottom, though, works better. I think the partial boxes around fun and end are actually deliberate -- they're a top-left marker and a bottom-right marker, so they shouldn't be full boxes. Those look good to me.

from code.pyret.org.

jswrenn avatar jswrenn commented on July 29, 2024

Definitely a feature in progress. I needed to distinguish the block matching highlight from the error highlights. The fuzziness, as you guys figured out, was an attempt at dealing with the spaces between lines (although the fuzziness doesn't interact with text nearly as much on my machine; your screenshot looks awful).

I like the box-shadow edge-fuzziness as a distinguishing feature, but not if it wreaks havoc on the visibility of the code. border-bottom: 2px hsl(220, 100%, 95%); seems to work for me; can you guys confirm it doesn't much with spacing for you?

The pseudo-element solution to box-shadow overlapping adjacent siblings is a bit tricky to get right. I'll revisit it soon, but for now I suggest we just use border to fill the gaps.

from code.pyret.org.

jpolitz avatar jpolitz commented on July 29, 2024

1px of border bottom works in Chromium (OSX) for me. Do you need the 2px?

Thanks for pointing out border-bottom; just using border like I suggested clearly adds wacky spacing.

from code.pyret.org.

blerner avatar blerner commented on July 29, 2024

You should use both top and bottom, so that the first and last lines are symmetric. You should probably use 0.1em instead of ###px, so it scales when we resize fonts.

from code.pyret.org.

blerner avatar blerner commented on July 29, 2024

And you should use whatever border width is equal to the line spacing that CM uses. (Joe's probably getting it to work with 1px because two of them just touch, and having larger borders is ok because of CSS border collapsing.)

from code.pyret.org.

jpolitz avatar jpolitz commented on July 29, 2024

The partial boxes confused me because they appear to curve around the keyword, making it look like an incomplete rounded box (to my eye).

Doing it without a border-radius (so square edges) fixes this visual glitch for me.

from code.pyret.org.

blerner avatar blerner commented on July 29, 2024

You can add a border radius only to one corner, so that should help too...

from code.pyret.org.

jpolitz avatar jpolitz commented on July 29, 2024

Ah, good point. So border-top-left-radius and border-bottom-right-radius for the start and end, respectively.

from code.pyret.org.

jswrenn avatar jswrenn commented on July 29, 2024

@blerner changes fix the issue of code being obscured by the fuzziness but still succeeds in being visually distinct from highlights.

from code.pyret.org.

jpolitz avatar jpolitz commented on July 29, 2024

This looks awesome.

from code.pyret.org.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.