Commit Graph

7807 Commits

Author SHA1 Message Date
Antonio Scandurra
be2aaa0b22 Use explicit state to recycle tiles instead of modulo scheme
This avoids updating tiles unnecessarily when changing the number of
rendered tiles.

Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-09 17:46:29 +02:00
Max Brunsfeld
1c8847cb4f 🐎 Ensure rendered tile count is stable when scrolling
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-08 15:50:16 -07:00
Nathan Sobo
f76e850aa5 Fix rendering artifacts when resizing with soft wraps
Previously, we were accidentally depending on the state of the display
layer when forcing it to update its index. This caused us to not index
enough content to cover the visibile area, which meant we weren't
querying enough lines to fill the screen in some situations.
2017-05-08 10:58:33 -06:00
Antonio Scandurra
df4116d4aa Fix clicking past the content height
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 19:55:14 +02:00
Antonio Scandurra
15f25a745a Update width of content when approximate longest screen row changes 2017-05-05 11:29:57 -06:00
Antonio Scandurra
2855e01289 Don't create empty nodes when a text decoration ends next to a text tag
This was causing problems in measurements because in that code path we
assume that text nodes are never empty. This commit also adds a test
verifying this invariant when a text decoration ending right after a
text tag is added.
2017-05-05 11:22:01 +02:00
Antonio Scandurra
f7b79b477a Update class list even when the editor is not attached 2017-05-05 09:30:08 +02:00
Antonio Scandurra
c541d3941c Fix remaining test failures in core 2017-05-05 09:30:08 +02:00
Nathan Sobo
bc34344d90 Maintain the scroll position when changing font size 2017-05-05 09:30:08 +02:00
Nathan Sobo
c5c48094ba Avoid requesting horizontal measurement when auto-scrolling vertically
This was leaving a measurement request in the map that was getting
picked up on the next frame. In some cases, the requested measurement
row was not present, causing an exception.
2017-05-05 09:30:08 +02:00
Nathan Sobo
1b1973db15 Rename method to match old implementation 2017-05-05 09:30:08 +02:00
Nathan Sobo
c00ad62a0e Pass mini attribute when creating new TextEditor from TextEditorElement
This avoids content being shifted over due to rendering and measuring
the gutter on element creation and then subsequently hiding it.
2017-05-05 09:30:08 +02:00
Nathan Sobo
42bb02c8a8 Account for vertical scrollbar width when soft-wrapping lines 2017-05-05 09:30:08 +02:00
Nathan Sobo
fe13279531 Update DOM in screenPositionForPixelPosition if needed
Some packages are interacting with this method assuming this behavior,
so this commit eliminates `screenPositionForPixelPositionSync` and
instead just performs the DOM update in `screenPositionForPixelPosition`
if it is needed.
2017-05-05 09:30:08 +02:00
Antonio Scandurra
001fef4a05 Don't activate scrollPastEnd for autoHeight editors 2017-05-05 09:30:08 +02:00
Antonio Scandurra
c2b854123b Never create empty spans at the beginning of a row
This was happening when a text decoration overlapped a row, but the next
boundary was located exactly at the beginning of it.
2017-05-05 09:29:30 +02:00
Nathan Sobo
ac8a908385 Implement text decorations in rendering layer 2017-05-05 09:29:30 +02:00
Antonio Scandurra
f17baf4790 Use scope ids instead of tags 2017-05-05 09:29:30 +02:00
Antonio Scandurra
570cfdeaff Ignore resize events if they are delivered while the editor is hidden 2017-05-05 09:29:30 +02:00
Nathan Sobo
c36303e631 Avoid blowing away classes assigned on the editor element by packages
/cc @t9md
2017-05-05 09:29:30 +02:00
Nathan Sobo
c7228f6d81 Fix error when attaching soft-wrap editor in synchronous update mode
Taking the initial measurement was setting the soft wrap column, which
was triggering a display layer reset, which was scheduling an update.
This update occurred at an unexpected time causing an exception.
2017-05-05 09:29:30 +02:00
Nathan Sobo
bd6eedcc88 Eliminate strictly contained divs wrapping lines and highlights
I was hoping to strictly contain the layouts of highlights an lines
separately, since they are updated during different render phases.
Unfortunately, strict containment requires both divs to be positioned
absolutely. This in turn creates separate stacking contexts for lines
and highlights, which makes it impossible to render highlights in front
lines which themes sometimes need to do. For example,
atom-material-syntax pushes bracket matcher highlights to the front so
they are not obscured by the theme's solid black cursor line background.

/cc @as-cii. You should examine my work here and make sure I'm not
screwing something up with your line/block decoration update code.
2017-05-05 09:29:30 +02:00
Antonio Scandurra
72351481c7 Fix positioning for block decorations located at the beginning of a tile 2017-05-05 09:29:30 +02:00
Antonio Scandurra
638bb78ecb Fix build failures 2017-05-05 09:29:30 +02:00
Nathan Sobo
82cdf80f25 Extract CursorsAndInputComponent 2017-05-05 09:29:30 +02:00
Nathan Sobo
1ca4c69c87 WIP: Start extracting gutter component 2017-05-05 09:29:30 +02:00
Nathan Sobo
305fd14cd9 Add TextEditorElement.pixelRectRangeForScreenRange for compatibility 2017-05-05 09:29:30 +02:00
Nathan Sobo
a5a80448cb Add intersectsVisibleRowRange on TextEditorElement 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
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
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
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
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
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
Nathan Sobo
4c8fd0cb75 Add tests for TextEditorElement.setScrollTop/Left 2017-05-05 09:29:29 +02:00