Created
February 13, 2015 03:54
-
-
Save karlseguin/2a52a19cfbfab2d6b27c to your computer and use it in GitHub Desktop.
Atom editor multiple wrap guides
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# place this in your init.coffee | |
atom.workspace.observeTextEditors (e) -> | |
editor = atom.views.getView(e) | |
clone = editor.querySelector('.wrap-guide').cloneNode() | |
clone.style.left = (editor.getDefaultCharacterWidth() * 120) + "px" | |
editor.querySelector('.underlayer').appendChild(clone) |
Many thanks! Using Atom v1.0.0 with Shadow DOM I had to change it a bit
# second wrap guide at 120
atom.workspace.observeTextEditors (e) ->
editor = atom.views.getView(e)
clone = editor.querySelector('* /deep/ .wrap-guide').cloneNode()
process.nextTick ->
clone.style.left = (editor.getDefaultCharacterWidth() * 120) + "px"
editor.querySelector('* /deep/ .lines').appendChild(clone)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this. In the latest versions, however, I did have to make a slight tweak because the line was being drawn before
editor.getDefaultCharacterWidth()
could determine exactly how many pixels wide something had to be. Here are my modifications: