Commit Graph

257 Commits

Author SHA1 Message Date
Max Brunsfeld
48abb16edb Fix exception in screenPositionForPixelPosition when content updates are pending
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-07-18 14:31:47 -07:00
Bryant Ung
c50f73e9f5 Merge pull request #15011 from mehcode/gutter-marker-layer-bug
Check if incoming element is non-null before attempting to append to it
2017-07-13 22:29:44 -07:00
Antonio Scandurra
c3f7edc104 Swap underlying editor correctly when calling setModel on editor element
Previously, when `setModel` was called, we forgot to update the pointer
to the component in the newly supplied editor. This was causing the
element to not update in response to model updates but only as a result
of focus or visibility changes. We suspect this regressed during the
rewrite of the editor rendering layer.

With this commit we will now correctly swap the element's underlying
editor by updating the component pointer on the newly supplied editor.
Also, if the element was already attached to another editor, we will
null out the component reference on it, because one instance of
`TextEditorElement` can only represent one instance of `TextEditor`.
2017-07-13 18:13:48 +02:00
Ryan Leckey
d0588cd812 Check if incoming element is non-null before attempting to append to it 2017-07-13 02:32:43 -07:00
ungb
07c7e53b1e fix lint errors 2017-07-10 16:26:47 -07:00
Nathan Sobo
f6d2f966bf Fix middle-mouse-button paste on Linux
Chrome now synthesizes a textInput event on mouseup for middle mouse
button clicks, which rendered our custom JS for handling that case
redundant.
2017-07-10 15:53:23 -06:00
Nathan Sobo
cd27b49dc4 Don't handle ctrl-click events on macOS
It brings up the context menu, so we shouldn't change the cursor
position
2017-07-10 14:28:21 -06:00
Nathan Sobo
82619a989b 🎨 2017-07-10 14:27:55 -06:00
Nathan Sobo
960e515e77 Merge pull request #14948 from atom/ns-add-gutter-decoration-class
Always render 'decoration' class on custom decorations
2017-07-05 15:24:43 -06:00
Antonio Scandurra
bcaf655325 Update buffer-row and screen-row data fields on each line number node 2017-07-05 11:12:48 +02:00
Antonio Scandurra
942dd03bd0 Assign screen-row to each line number as a data field 2017-07-05 11:11:44 +02:00
Nathan Sobo
e7b4ad48f0 Always render 'decoration' class on custom decorations 2017-07-03 16:10:41 -06:00
Antonio Scandurra
b30f55bb57 Invalidate block decorations height automatically if their size changes 2017-06-30 14:08:49 +02:00
Antonio Scandurra
57570accbf Merge pull request #14893 from atom/as-fix-resetting-node-pool-styles
Fix resetting styles in NodePool
2017-06-27 11:35:19 +02:00
Antonio Scandurra
52ba6c7342 Fix measuring block dec. if adding them before updating element's width 2017-06-26 12:52:18 +02:00
Antonio Scandurra
a171380544 Fix resetting styles in NodePool
Previously, we were mistakenly not clearing out some styling properties
like `marginTop`, thus causing e.g. line numbers to be misaligned. This
was caused by manual updates to an element's style object, without a
consequent update to the NodePool.

With this commit we will now rely on `element.styleMap` (a DOM
primitive) to detect which styles have been set on a element that is
about to be recycled and, if the object being created doesn't use them,
simply clear them out.
2017-06-26 11:37:11 +02:00
Antonio Scandurra
0a46c9ad7b Prevent block decorations from mistakenly wrapping during measurements
Before rendering block decorations, we read their heights by putting
them into a special div called `blockDecorationMeasurementsArea`.

Previously, this div was not explicitly sized, which was causing
decorations to wrap while being measured but not when actually rendering
them.

This commit fixes this inconsistency by explicitly styling the
measurement area so that it has the same width as the component scroll
width.
2017-06-13 12:31:27 +02:00
Antonio Scandurra
9a0709e95e Don't try to measure lines that don't exist
By the time that the animation frame is delivered, the requested
autoscroll
position could not exist anymore. This could cause the editor component
to measure a non-existent line and, as a result, throw an exception.

With this commit we will always ignore measurements for screen lines
that do not exist.
2017-06-09 18:40:24 +02:00
Antonio Scandurra
baca845e64 Fix not resetting unused styles in NodePool 2017-06-03 14:56:21 +02:00
Antonio Scandurra
ec774e143a Fix lint errors 2017-06-03 10:52:32 +02:00
Antonio Scandurra
a25134e97f Recycle line number nodes
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-06-01 17:24:18 +02:00
Antonio Scandurra
b8d0d83b9a Recycle line nodes
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-06-01 17:24:13 +02:00
Antonio Scandurra
6d1f8ea88c Render line number gutter without numbers when showLineNumbers is false
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-06-01 16:29:04 +02:00
Antonio Scandurra
23e26da2fb Skip overlay resize events when we already measured at the current size
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-06-01 14:44:06 +02:00
Antonio Scandurra
028b4c9082 Try a different approach for preventing autoscroll to off-screen input
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-31 16:43:08 +02:00
Antonio Scandurra
a106a3baa0 🎨 2017-05-16 15:19:13 +02:00
Antonio Scandurra
3b3505d969 Always allow to destroy free-form folds from the gutter 2017-05-16 14:36:50 +02:00
Antonio Scandurra
ad6202cadb Show foldable icon on the last screen row belonging to a buffer row 2017-05-16 14:26:57 +02:00
Antonio Scandurra
4c5127ca2f Update foldable icon when a row's foldability changes 2017-05-16 14:05:11 +02:00
Antonio Scandurra
96533998e2 Fix editor element tests on Windows 2017-05-12 16:51:05 +02:00
Antonio Scandurra
1b27df639d 💄 2017-05-11 16:08:26 +02:00
Antonio Scandurra
f3a96c968d Change editor.bufferRowsForScreenRows to include the supplied endScreenRow 2017-05-11 11:00:51 +02:00
Antonio Scandurra
a0ed201fe8 Fix blurring the editor when no hidden input is present 2017-05-11 10:52:56 +02:00
Antonio Scandurra
dc6653ffa6 Avoid creating a new timeout every time cursor blinking is paused 2017-05-11 10:39:52 +02:00
Antonio Scandurra
955cf98feb Use bufferRowsForScreenRows to compute line numbers 2017-05-10 13:45:19 +02:00
Antonio Scandurra
ab20fc3b19 Don't populate more screen rows than necessary
See 4eecf8d1a6.
2017-05-10 10:48:16 +02:00
Nathan Sobo
4eecf8d1a6 Don't change number of tiles based on block decorations
This means we may render more tiles than necessary when we have block
decorations, but it prevents changing the number of rendered tiles
during scrolling with certain combinations of line height and editor
height. If it ever becomes a problem we can get smarter about
subtracting the height of the visible block decorations from the editor
height, but for now this gives us more reliable performance for the
common case.
2017-05-09 15:09:14 -06:00
Antonio Scandurra
f58fd749aa Dispose nodes associated with a LineComponent when replacing it 2017-05-09 18:30:44 +02:00
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
Antonio Scandurra
7f3794b12e Don't populate more screen rows than necessary
See 1c8847cb4f
2017-05-09 16:08:48 +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
245f294cc3 Call editor.setEditorWidthInChars only when the value changed
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-05-05 19:55:57 +02: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
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
97d2d7fb8b Fix remaining linting warnings 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
0c7030c70b Only resolve update promise after final render phase 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