Commit Graph

194 Commits

Author SHA1 Message Date
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
Kevin Sawicki
41fc4f7fe6 Use relative require paths in src/ files 2013-09-20 10:02:20 -07:00
probablycorey
924bad6e53 Remove keybindings for commands that mini editors don't use 2013-09-19 14:44:12 -07:00
Cheng Zhao
486de96751 Make accented character suggestion work for multiple cursors. 2013-09-16 18:05:44 +08:00
Cheng Zhao
80244a1ae7 Work around of the accented character suggestion feature in OS X.
On OS X, press and hold `c` could show an accent menu to replace `c` with
accented ones like `ć`, there is no corresponding events in W3C, so we
detected it by checking whether the text in input box are selected (this
is how Chrome implemented this feature).

And also note that IME inputs were handled the same way in Chrome, the
compostion text would be marked as selected and got replaced with final
inputs. However the compostion text won't trigger textInput event, so
it's distinguished by checking whether the hiddenInput's value are
changed by Chrome.

Fixes atom/atom-shell#50.
2013-09-16 15:54:25 +08:00
Cheng Zhao
54e25677b6 Restore previous selected text after IME composition is done. 2013-09-16 10:44:15 +08:00
Cheng Zhao
f4e3f7a055 Skip the undo stack when changing composition text. 2013-09-16 10:43:34 +08:00
Cheng Zhao
dee9cce2e3 Select the text while inserting. 2013-09-14 20:20:45 +08:00
Cheng Zhao
a92a65929a Make hiddentInput bigger when inputing with IME.
Some IME's input bubble would have strange behavior when they thought
the target input box is small.
2013-09-14 20:10:36 +08:00
Cheng Zhao
c9d4c761bb Show IME's composition text on screen.
The composition text should only show on screen temporarily and gets
disappered when input is cancelled or done. We simply mark the
composition as selected, so it can not only indicate this is composition
text instead of normal text, but also updates the composition without
adding new interfaces.
2013-09-14 19:52:39 +08:00
Cheng Zhao
0c839f419a Move hidden input to the same position with cursor view.
This is required to make IME's input bubble follow the cursor.
2013-09-14 18:22:34 +08:00