fonsp / Pluto.jl

🎈 Simple reactive notebooks for Julia
https://plutojl.org/
MIT License
4.91k stars 284 forks source link

Use `ch` CSS unit to simplify awesome_line_wrapping CM plugin #2899

Closed fonsp closed 2 months ago

fonsp commented 2 months ago

The awesome_line_wrapping that wraps lines in a tab-aware currently works by counting tabs at the start of the line, calculates their width in pixels, and offsets the subsequent text by a negative amount.

image

It's quite complicated because the space width needs to be measured. This can be simplified by using the ch CSS unit, and taking 1ch as the space width.

I also removed some stale code

github-actions[bot] commented 2 months ago

Try this Pull Request!

Open Julia and type:

  julia> import Pkg
  julia> Pkg.activate(temp=true)
  julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="line-wrapper-plugin-ch")
  julia> using Pluto