brunosimon / keppler

Real time code sharing for your lectures and presentations.
MIT License
1.93k stars 101 forks source link

line numbers positioned wrong in Safari #31

Open Haroenv opened 6 years ago

Haroenv commented 6 years ago
screen shot 2018-01-03 at 15 02 17

line numbers are smaller than the lines itself. Would maybe be interesting to put them into the same line as the line of code itself to make it simpler.

It looks correct in Chrome.

brunosimon commented 6 years ago

Thanks for the report @Haroenv.

I can't reproduce the bug. What is your safari version? Are you using it on a Mac or a PC? The line-height is set directly on the parent div .viewer which include both the code and the lines.

Are you sure the problem come from the line-height? Maybe the lines you see are those from another file or the last ones are missing.

Haroenv commented 6 years ago

I found what the issue is: if a line wraps, the line numbers continue, while they should break like an editor does.

screen shot 2018-01-10 at 14 34 38 screen shot 2018-01-10 at 14 34 44

This is tested on Safari on Mac

In Chrome there's no line wrapping

brunosimon commented 6 years ago

Ok I see it. I'll fix it soon and I'll tell you :)

brunosimon commented 6 years ago

It seems that the problem come from Safari which doesn't recognize white-space: pre;

I'm using Highlight.js for the syntax coloration with vue-highlightjs. The library isn't very flexible and even if I could add one of the line numbers plugins, those are very poorly made and probably won't work in Keppler case.

I tried to add white-space: nowrap; in CSS but all the code get transform into one line.

If anyone has any suggestion that might help

Haroenv commented 6 years ago

Did you try a pure css solution with counters on every line of code? That way it should stay synchronised with the lines I think https://www.sylvaindurand.org/using-css-to-add-line-numbering/

brunosimon commented 6 years ago

Yes but there is two problems: