Commit Graph

154 Commits

Author SHA1 Message Date
probablycorey
5e3d52927a Use cachedCharWidth instead of cachedVal 2013-10-21 11:10:44 -07:00
probablycorey
0bc470c6d9 💄 2013-10-21 11:10:17 -07:00
probablycorey
f6fee9d04f Optimize measuring long lines 2013-10-18 15:36:39 -07:00
probablycorey
eced0a3208 Don't cache entire line length on lines > 160 chars 2013-10-18 11:58:36 -07:00
Kevin Sawicki
069208975c Add proper invisibles in empty lines with indent guide
This fixes a regression where multiple end of line invisibles were
displayed on empty lines when the indent guide was also enabled.

The invisibles array used to be shifted and not it isn't but the
entire array was still being iterated over causing extra invisibles
to be added to the line.
2013-10-17 18:31:59 -07:00
Kevin Sawicki
9d51d1a143 Use jquery provided by space-pen 2013-10-16 13:34:41 -07:00
Kevin Sawicki
6a3638c7d3 Use setImmediate instead of process.nextTick 2013-10-15 13:50:16 -07:00
Kevin Sawicki
5b6e8a1b20 Use process.nextTick instead of MessageChannel 2013-10-15 13:50:16 -07:00
Kevin Sawicki
216a5e61fd Update underscore-extensions requires 2013-10-15 13:50:16 -07:00
Ben Ogle
b7e7b83bdf Remove bringHiddenInputIntoView call from editor focus() 2013-10-09 17:48:22 -07:00
Ben Ogle
5fc14e0c37 Turns out neither of them need the 'px' 2013-10-09 17:46:06 -07:00
Ben Ogle
6faef08592 Use scrollLeft so the editor is not scrolled to the left on focus in/out 2013-10-09 16:44:05 -07:00
Ben Ogle
017030fd60 Fix the tests
The test calls hiddenInput.focus(), but in reality, nothing external to
the editor can trigger this. I'd rather just have 
bringHiddenInputIntoView() called in one place, but this is insurance.
2013-10-09 16:43:26 -07:00
Ben Ogle
1b38118cc3 Place hidden input on the underlayer.
Also brings the input into view when the input is focused so we
dont scroll the scrollView and blank the editor
2013-10-09 16:18:34 -07:00
Ben Ogle
2c2661da11 Fix hiddenInput offset calculation
Regression from the speedup stuff
2013-10-09 16:18:34 -07:00
Ben Ogle
b17c8ced84 Fix selectAll on buffers longer than the rendered lines 2013-10-09 16:16:19 -07:00
Ben Ogle
3aae7bb77e 💄 2013-10-07 10:29:02 -07:00
Ben Ogle
8825be937e TextNodeFielter -> TextNodeFilter 2013-10-07 10:29:02 -07:00
Ben Ogle
b3324b49b0 Skinny arrows 💄 2013-10-07 10:29:02 -07:00
Ben Ogle
89b0e4d159 Fix issue when there are no client rects 2013-10-07 10:29:01 -07:00
Ben Ogle
4df546a19e Remove shoulds 2013-10-07 10:28:13 -07:00
Ben Ogle
04cdad680b Remove ability to pass clearDirtyRanges and fillDirtyRanges extra vars
We don't need them anymore in the gutter.
2013-10-07 10:28:12 -07:00
Ben Ogle
4f1bdee2d7 shift() multiple little arrays. Avoid. 2013-10-07 10:28:12 -07:00
Ben Ogle
5942f2997f Remove array joins in buildEmptyLineHtml 2013-10-07 10:28:12 -07:00
Ben Ogle
26a3a77fed Rename ALL_CAPS vars to CapCamelCase 2013-10-07 10:28:12 -07:00
Ben Ogle
f1cf8496f8 Fix test, use bufferRowsFOrScreenRowsProperly 2013-10-07 10:28:11 -07:00
Ben Ogle
d0be7fbf8e Add a character width cache based on scopes.
This is slower than the position cache in the best case, but faster
in the worst and average case. With this, you can search for a space
in find and replace, and still scroll the buffer.

In editor.coffee, there are 10,500 spaces. To highlight all of them, 
the previous cache method took 7 seconds, this takes 2 when the cache 
is empty, and about 10ms when the entire file is cached.
2013-10-07 10:28:11 -07:00
Ben Ogle
8463c759b5 Use global range. Faster! Less garbage! 2013-10-07 10:28:11 -07:00
Ben Ogle
5a772d7078 Move back to the node walker and Range()
This is slower than the span compute, but rendering lines without 
tons of spans is much faster than with
2013-10-07 10:28:11 -07:00
Ben Ogle
6eb72ac2a1 Use getElementsByClassName rather than jQuery 2013-10-07 10:28:10 -07:00
Ben Ogle
8cd04b5178 Override isHidden for the Editor
We know it's visible if it is on the dom and doesn't have
display == none set. This is an order of magnitude faster than the
default implementation which calls getComputedStyle()
2013-10-07 10:28:10 -07:00
Ben Ogle
d351938702 Speed up setting the hidden input at the same place as the cursor.
Order of magnitude speedup
2013-10-07 10:28:10 -07:00
Ben Ogle
6a494f65a5 💄 2013-10-07 10:28:09 -07:00
Ben Ogle
aa404a316d Don't allow NaNs 2013-10-07 10:28:09 -07:00
Ben Ogle
45d3fea3d0 Update only the changed line numbers 2013-10-07 10:28:09 -07:00
Ben Ogle
98a3bb475b Fix for non-extant lines 2013-10-07 10:28:09 -07:00
Ben Ogle
2394f25b92 Add the leftPixel cache back in 2013-10-07 10:28:09 -07:00
Ben Ogle
914288ab86 Wrap each char in a span; compute left position by measuring each span.
This is is faster and simpler than the old method. Running each function
20,000 times yielded these results:

Old: 3750ms
This method: 1523ms
By looking up each char's width in a dict: 29ms
2013-10-07 10:28:08 -07:00
Ben Ogle
aba5eb5b41 Add a cache to positionLeftForLineAndColumn()
This is the slowest function of all.
2013-10-07 10:28:08 -07:00
Ben Ogle
5c46bff4c1 Use isVisible() 2013-10-07 10:28:08 -07:00
Ben Ogle
8f68d62420 Only re render the cursors/selections when in rendered range 2013-10-07 10:28:08 -07:00
Kevin Sawicki
e2fb2fdae5 Set font size and family directly on editor element
Previously this was set via a style tag which ate up a lot of spec
time and seemed to be functionally equivalent to just setting the
style directly on the element instead of finding and adding/removing
style tags.
2013-10-03 09:38:42 -07:00
Kevin Sawicki
3189347899 Use window height to determine number of lines to render
This prevents the editor from displaying empty lines when a view is hidden
and the editor suddenly has more vertical space available to fill.
2013-10-01 15:35:08 -07:00
Ben Ogle
48337f3203 Just check for display != 'none' for visilbility 2013-09-27 13:44:10 -07:00
Kevin Sawicki
a6cd8e7c85 Only reposition hidden input when editor has focus 2013-09-27 08:17:29 -07:00
Kevin Sawicki
6581eb4db6 Update offset in existing focusout handler 2013-09-25 16:14:13 -07:00
Kevin Sawicki
bc3aec584b Inline hidden input offset updating 2013-09-25 16:07:59 -07:00
Kevin Sawicki
8199147fca Put input in top corner on blur
This allows it to not scroll on the next focus but still be reset
to the right location on the next cursor moved event
2013-09-25 16:07:59 -07:00
Kevin Sawicki
84efe44a5a Always keep hidden input position in visible area
Previously the input could be offscreen depend on the scroll
position of the editor and this would cause a scroll event to
occur when the input gained focused causing the editor rendering
to go out of sync.
2013-09-25 16:07:59 -07:00
Kevin Sawicki
5a9972b370 Update editor width is chars when soft wrap is toggled
Closes #858
2013-09-20 17:04:21 -07:00