This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Repository navigation
Support variable width fonts - #254
Merged
Merged
Conversation
Contributor
|
⛅ Awesome! Papyrus really does |
Contributor
Author
|
I'm never going back. |
Contributor
added 10 commits
February 12, 2013 17:07
When translating a logical screen position (columns/rows) to a pixel position, the editor now builds a temporary version of the line for the given row. It then uses the DOM range API to insert an empty range at the correct text node and offset for the given column and determines the left position based on its clientRect. Depending on the speed impact, we may want to optimize this by recycling the existing line node if it exists on screen rather than building a new one every time. We will still have to build one if the line we're moving to isn't on screen yet. We could also increase the chances of the line being on screen by autoscrolling to the vertical position first, and *then* calculating the horizontal position. Lots to explore here.
When the font size changes and the editor is detached, it schedules itself to be redrawn the next time we're reattached rather than updating the display in a detached state. Detached display updates worked in the past because we didn't need to be on the DOM to determine horizontal and vertical positions once we had calculated dimensions once. So it worked to temporarily attach the editor when calculating new dimensions, and then continue updates even when it was detached. That now breaks because we can't ask for pixel positions if we aren't on the DOM.
This prevents the editor from synchronously redrawing in specs with cursors in invalid locations. Markers are always updated under the hood before a change event is emitted from the Buffer or DisplayBuffer. We still wait to trigger marker observers, but if their position gets read, it is up to date.
Contributor
Author
Contributor
|
Oh snap! You guys rock! |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The new atom-light-syntax theme makes use of bold, and since not all fixed-width fonts have the same width for bold and non-bold characters, this really forces our hand to support this.