Commit Graph

15702 Commits

Author SHA1 Message Date
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
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
Nathan Sobo
9da6e22487 Return false from isLineCommentedAtBufferRow if no line yet exists 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
Antonio Scandurra
f7c55b9473 Honor the updateSynchronously parameter 2017-05-05 09:29:29 +02:00
Nathan Sobo
15ecbed61f Don't pane focus when pane model is destroyed
This avoids a non-failure error message when resetting the environment
in some specs.
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
c76fc5af2d Round column measurements to nearest whole pixel
This preserves the expected behavior for positioning overlays, etc so
that package tests keep passing.
2017-05-05 09:29:29 +02:00
Nathan Sobo
84c20d95d4 Add deprecated rootElement property 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
a9d0f82afb Use async/await in text-editor-element-spec 2017-05-05 09:29:29 +02:00
Nathan Sobo
e423b833db Replace getDefaultCharacterWidth with getBaseCharacterWidth
That's the language we use throughout the implementation now and a more
accurate name for the concept.
2017-05-05 09:29:29 +02:00
Nathan Sobo
0441625fba Set lineHeightInPixels on model for backward compatibility 2017-05-05 09:29:29 +02:00
Nathan Sobo
174bac378d Fix lint errors 2017-05-05 09:29:29 +02:00
Nathan Sobo
c8f2fbb657 Get TextEditorElement tests passing 2017-05-05 09:29:29 +02:00
Nathan Sobo
eb33b5c39b Delete obsolete code and tests related to text editor rendering 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
87eb16f5ed Fix clicking fold placeholders by ignoring pointer events on cursors div 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
Antonio Scandurra
893da22c55 Replace element-resize-detector with experimental ResizeObserver API
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 09:29:29 +02:00
Antonio Scandurra
837871700d Position dummy line element absolutely and make it invisible
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 09:29:29 +02:00
Antonio Scandurra
8372d08b49 Don't share block decoration/character measurement vnodes across instances
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 09:29:29 +02:00
Antonio Scandurra
03702a1fe6 Add deprecated shadow root property to editor element
Signed-off-by: Nathan Sobo <nathan@github.com>
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
5df17f061e Create resize detector before calling etch.updateSync for the first time 2017-05-05 09:29:29 +02:00
Antonio Scandurra
f3c48c8b70 Register style elements change events in AtomEnvironment.initialize
...and fix spec/workspace-element-spec.js
2017-05-05 09:29:29 +02:00
Antonio Scandurra
1d01d499a9 Fix spec/text-editor-spec.coffee 2017-05-05 09:29:29 +02:00
Antonio Scandurra
e2cf60a0c9 Don't reuse resize detectors across TextEditorComponent instances
Due to the way element-resize-detector schedules the delivering of
resize events, this will ensure that creating an editor while the clock
is mocked won't prevent subsequent tests using the real clock from
getting such events.
2017-05-05 09:29:29 +02:00
Antonio Scandurra
2993f3c1ac Further optimize line replacement 2017-05-05 09:29:29 +02:00
Antonio Scandurra
a99237b33b Fix lint errors and delete dead code 2017-05-05 09:29:29 +02:00