Commit Graph

363 Commits

Author SHA1 Message Date
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
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
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
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
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
9ccfd3415c Remeasure gutter dimensions when a gutter changes its visibility 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
Antonio Scandurra
f7c55b9473 Honor the updateSynchronously parameter 2017-05-05 09:29:29 +02:00
Nathan Sobo
5b07334993 Assign bufferRow property to line number nodes
I wish we didn't need this, but it's currently relied on by several
packages including bookmarks.
2017-05-05 09:29:29 +02:00
Nathan Sobo
a536c5950a Add TextEditorElement.pixelPositionForScreen/BufferPosition
These methods require us to render off-screen lines in some
circumstances in order to measure them, so this commit extends the
rendering of the longest line to include arbitrary lines.
2017-05-05 09:29:29 +02:00
Nathan Sobo
bfa410b114 Add has-selection class to editors with non-empty selections 2017-05-05 09:29:29 +02:00
Nathan Sobo
f83ad6bb7c Give cursors at the end of lines the width of an 'x' character 2017-05-05 09:29:29 +02:00
Nathan Sobo
336aa0f521 Hide scrollbars in mini editors 2017-05-05 09:29:29 +02:00
Nathan Sobo
e602b5c466 Account for scrollbars and padding in autoHeight/Width mode 2017-05-05 09:29:29 +02:00
Nathan Sobo
9bf0ea83f4 Test clicking more locations outside of the lines 2017-05-05 09:29:29 +02:00
Antonio Scandurra
26b9273e00 Add data-encoding to editor element
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 09:29:29 +02:00
Antonio Scandurra
2a1ba7f05b Add data-grammar to editor element 2017-05-05 09:29:29 +02:00
Antonio Scandurra
8707cabe40 Don't count the dummy line in block decoration test 2017-05-05 09:29:29 +02:00
Nathan Sobo
99e3c62e69 Clear highlight nodes when recycling line tiles 2017-05-05 09:29:28 +02:00
Nathan Sobo
3fce3ebe17 Fix test 2017-05-05 09:29:28 +02:00
Nathan Sobo
6e6dce21ee Don't re-measure if editor has become invisible 2017-05-05 09:29:28 +02:00
Nathan Sobo
7aec696bb5 Remove stray logging 2017-05-05 09:29:28 +02:00
Nathan Sobo
95c8950004 Re-measure and update rendered content when editor styles change 2017-05-05 09:29:28 +02:00
Antonio Scandurra
054c133ed4 Remeasure block decorations when editor width changes
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 09:29:28 +02:00
Antonio Scandurra
8103bd687c Update line number gutter when invalidating a visible block decoration
When two or more decorations in the same tile were invalidated but the
sum of their height didn't change, we were previously failing to
recognize that the line numbers gutter needed to be re-rendered. With
this commit, whenever a block decoration is visible and gets
invalidated, we will force the line number gutter to always update.
2017-05-05 09:29:28 +02:00
Nathan Sobo
8aae3ab1ae Hide cursors with non-empty selection if showCursorsOnSelection is false
Also, remove some barely used public APIs around cursor visibility that
don't make much sense and are not ideal for performance. We don't want
to subscribe to the visibility of each cursor.
2017-05-05 09:29:28 +02:00
Antonio Scandurra
bc8b548d1a Add TextEditorElement.prototype.invalidateBlockDecorationDimensions 2017-05-05 09:29:28 +02:00
Antonio Scandurra
b264d4764a Align line number nodes with line nodes 2017-05-05 09:29:28 +02:00
Antonio Scandurra
7474b4b678 Integrate block decorations in the custom lines rendering routine 2017-05-05 09:29:28 +02:00
Antonio Scandurra
316df28bbd Splice LineTopIndex when a textual change occurs 2017-05-05 09:29:28 +02:00
Antonio Scandurra
4cd9a36594 Handle inserting and updating block decorations 2017-05-05 09:29:28 +02:00
Antonio Scandurra
015f196f2f Test scrolling down with block decorations 2017-05-05 09:29:28 +02:00
Antonio Scandurra
e289283205 Render block decorations between lines 2017-05-05 09:29:28 +02:00
Nathan Sobo
5a6935a01c Use LineTopIndex to convert from/to rows to/from pixel positions 2017-05-05 09:29:28 +02:00
Nathan Sobo
b32b760ee4 WIP: Start on block decorations 2017-05-05 09:29:28 +02:00
Nathan Sobo
eb588d4c7c Test and fix the center option to autoscroll 2017-05-05 09:29:28 +02:00