Commit Graph

31950 Commits

Author SHA1 Message Date
Nathan Sobo
0996d90be3 Add scrollbar classes in case any packages or themes target them 2017-05-05 09:29:30 +02:00
Nathan Sobo
207cd31054 Add highlights class for package compatibility 2017-05-05 09:29:30 +02:00
Antonio Scandurra
6ed7cd97cc Add highlight decoration classes to region elements as well
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 09:29:30 +02:00
Antonio Scandurra
4bcace1628 Don't remeasure scrollbars for mini editors
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 09:29:30 +02:00
Antonio Scandurra
efdb044ce6 Use cursor:text on atom-text-editor elements
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 09:29:30 +02:00
Antonio Scandurra
e1ae3749c0 Add a pixelPositionForMouseEvent method
This was a private method in the previous implementation that was used
by some packages.

Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 09:29:30 +02:00
Antonio Scandurra
59ae239a8c Provide an editorElement shim on TextEditor
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 09:29:30 +02:00
Antonio Scandurra
f45ff05306 Add {get,set}FirstVisibleScreen{Row,Column} to TextEditorElement 2017-05-05 09:29:30 +02:00
Antonio Scandurra
37b5d2eb4d Restore scrollbar positions correctly on reload 2017-05-05 09:29:30 +02:00
Antonio Scandurra
72d6316459 Fix shift-scroll on Windows and Linux 2017-05-05 09:29:29 +02:00
Antonio Scandurra
906b3b05d6 Update mock text editor in gutter-container-spec.coffee 2017-05-05 09:29:29 +02:00
Antonio Scandurra
8f5e4216dc Fix more lint errors 2017-05-05 09:29:29 +02:00
Antonio Scandurra
6a083e14a2 Schedule component updates directly from the model
The only event-based APIs we kept are for listening to changes in block
decoration markers.
2017-05-05 09:29:29 +02:00
Antonio Scandurra
a890528ec9 Use Math.round for positions that are at the end of a line 2017-05-05 09:29:29 +02:00
Nathan Sobo
c338227dab Drop floats 2017-05-05 09:29:29 +02:00
Nathan Sobo
77f04c47d9 Consolidate editor style sheets 2017-05-05 09:29:29 +02:00
Nathan Sobo
5bbbe1d790 Give line numbers the full width of the line number gutter 2017-05-05 09:29:29 +02:00
Nathan Sobo
1cc68e408e Add TextEditorComponent.screenPositionForPixelPositionSync
This method can be used to translate a pixel position to a screen
position even if the line is not currently rendered on screen.
2017-05-05 09:29:29 +02:00
Nathan Sobo
3d6921cca3 Add cursor decorations
These decorations allow the class and style of a cursor associated with
any marker to be customized.

/cc @t9md
2017-05-05 09:29:29 +02:00
Antonio Scandurra
3bca09bf27 Schedule update when setting scroll top row or scroll left column 2017-05-05 09:29:29 +02:00
Antonio Scandurra
e4659aad87 Add data-screen-row to line nodes 2017-05-05 09:29:29 +02:00
Antonio Scandurra
9d79b0189f Fix cursor positioning around fold markers 2017-05-05 09:29:29 +02:00
Antonio Scandurra
1e6a1c61e7 Add middle mouse pasting on Linux 2017-05-05 09:29:29 +02:00
Antonio Scandurra
2f356f85d3 Make process.platform easier to mock 2017-05-05 09:29:29 +02:00
Nathan Sobo
b242f034b4 Don't render decorations for invalidated markers 2017-05-05 09:29:29 +02:00
Nathan Sobo
dfe647d914 Fix lint error 2017-05-05 09:29:29 +02:00
Nathan Sobo
348d085880 Only enable cursor blink optimization when updateSync is using scheduler
This ensures that direct calls to updateSync from places like scroll
handlers never take this optimization path.
2017-05-05 09:29:29 +02:00
Antonio Scandurra
c38da710ae Don't remove non accented character from history, improve test coverage
Unfortunately Chromium does not trigger a `compositionstart` before
firing the text input event for the non accented character. Using `undo`
to remove such character from the history is risky because it could be
grouped with a previous change, thus making Atom undo too much.

With this commit we simply keep the behavior master exhibits as of
today. In the process of rewriting this code path, however, we fixed a
bug that occurred when opening the accented character menu while holding
another key, and improved test coverage as well by simulating the events
the browser triggers.
2017-05-05 09:29:29 +02:00
Nathan Sobo
24e03ee4e6 Fix pageUp/Down tests by using a real element 2017-05-05 09:29:29 +02:00
Nathan Sobo
f2070ef880 Restore editor scroll position across reloads
This commit introduces the concept of a scrollTopRow and
scrollLeftColumn which is used to query and update the logical scroll
position.
2017-05-05 09:29:29 +02:00
Antonio Scandurra
f9cb1f87a7 Implement TextEditor.prototype.getRowsPerPage 2017-05-05 09:29:29 +02:00
Antonio Scandurra
9ccfd3415c Remeasure gutter dimensions when a gutter changes its visibility 2017-05-05 09:29:29 +02:00
Antonio Scandurra
2a688db26b Add better test coverage for the mini and placeholder-text attributes 2017-05-05 09:29:29 +02:00
Antonio Scandurra
552fbf7915 Honor the gutter-hidden attribute correctly 2017-05-05 09:29:29 +02:00
Antonio Scandurra
3d29db49a4 Use position: relative for .line-number elements
...because packages like `.git-diff` are relying on this behavior to
position their decorations. This didn't seem to degrade layout times, so
it makes sense to just add it to keep package breakage to a minimum.
2017-05-05 09:29:29 +02:00
Nathan Sobo
4c8fd0cb75 Add tests for TextEditorElement.setScrollTop/Left 2017-05-05 09:29:29 +02:00
Nathan Sobo
996e0462b7 Don't update synchronously in text-editor-element-spec 2017-05-05 09:29:29 +02:00
Nathan Sobo
129749f2ff Set updatedSynchronously to false in text-editor-element-spec 2017-05-05 09:29:29 +02:00
Nathan Sobo
9da6e22487 Return false from isLineCommentedAtBufferRow if no line yet exists 2017-05-05 09:29:29 +02:00
Nathan Sobo
e232a868c5 Drop tests for set/getFirstVisibleScreenRow
These are now tested in text-editor-component-spec
2017-05-05 09:29:29 +02:00
Nathan Sobo
5ea4096464 Guard gitFirst/LastVisibleScreenRow
These methods are sometimes called by the model before the editor has
been attached to the DOM.
2017-05-05 09:29:29 +02:00
Nathan Sobo
eb7cdf2a34 Delegate get/setFirstVisibleScreenColumn from the model to the component 2017-05-05 09:29:29 +02:00
Nathan Sobo
4f52637518 Delegate setFirstVisibleScreenRow from the model to the component 2017-05-05 09:29:29 +02:00
Nathan Sobo
493b735740 Delegate getFirst/LastVisibleScreenRow from model to component 2017-05-05 09:29:29 +02:00
Nathan Sobo
19f5535d68 Add back the measureDimensions method since some packages rely on it
Ideally, packages would resize and then wait for an update. But we set
up an example of calling measureDimensions directly in find-and-replace
so the easiest thing for now is just to keep this method around.
2017-05-05 09:29:29 +02:00
Nathan Sobo
69a29b2c58 Delegate (get|set)(Height|Width) to element
Rather than storing these values on the editor model.
2017-05-05 09:29:29 +02:00
Nathan Sobo
4d8137a7f5 Add keys to gutterContainer and scrollContainer to avoid recycling issue
Previously, when the gutter container was removed due to the editor
becoming mini, the lack of keys caused the gutter to be updated with the
recycled cursors vnode. But then we tried to remove the cursors vnode
not realizing it had been moved and tore down all the references.

We probably need to revisit whether it makes sense to recycle vnodes.
2017-05-05 09:29:29 +02:00
Antonio Scandurra
240a472d3a Disable ResizeObserver temporarily in resize callback to avoid warning
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 09:29:29 +02:00
Antonio Scandurra
55950f9594 Assign placeholder text on the model only when the attribute is present
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 09:29:29 +02:00
Antonio Scandurra
6eed22aa90 Disconnect resize observers in overlay components on editor detach
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 09:29:29 +02:00