Commit Graph

98 Commits

Author SHA1 Message Date
Nathan Sobo
ce5c29fb47 Base the visible lines on the height instead of the clientHeight
Because overlay scrollbars are invisible unless scrolling and even
regular scrollbars can be transparent.
2014-05-09 11:33:04 -06:00
Nathan Sobo
dbd271f70a Don't obscure last character of long lines with vertical scrollbar
This entailed quite a few changes to dial in scrollbars. The scrollbars
are now adjusted in size to account for the width of the opposite
scrollbar. If the width or height are not explicitly constrained and we
are scrollable in the opposite direction that is constrained, we account
for the width of the opposite scrollbar in assigning a natural height
or width based on the content.
2014-05-09 11:33:04 -06:00
Nathan Sobo
e412371b88 Remove logging 2014-05-09 11:33:03 -06:00
Nathan Sobo
7b4bc16531 Fix specs that broke when accounting for horizontal scrollbar height 2014-05-09 11:33:03 -06:00
Nathan Sobo
e6df30e94c Respect horizontal scrollbar when rendering the vertical, and vice versa
We set overflow to hidden in the opposite scroll direction only if we
can't actually scroll in that direction, causing the white square where
neither scrollbar overlaps to appear at the lower right corner.
2014-05-09 11:33:03 -06:00
Nathan Sobo
d9ba9262bf Update scrollTop to valid position when scrollbar disappears 2014-05-09 11:33:03 -06:00
Nathan Sobo
c4be32a5dd Revert "Revert "Don't obscure the last line of the editor with the horizontal scrollbar""
This reverts commit 1d634e471e.
2014-05-09 11:33:03 -06:00
Nathan Sobo
1d634e471e Revert "Don't obscure the last line of the editor with the horizontal scrollbar"
This reverts commit babbdbf9e5.
2014-04-23 14:03:33 -06:00
Nathan Sobo
babbdbf9e5 Don't obscure the last line of the editor with the horizontal scrollbar
This assumes the scrollbar is 15px high, which is incorrect when using
overlay scrollbars or when the scrollbar is styled to have a different
height. We'll need to measure it in a subsequent commit.
2014-04-23 13:59:35 -06:00
Nathan Sobo
f53d489abb Add DisplayBuffer::scrollToScreen/BufferPosition
Also add delegators in Editor and ReactEditorView
2014-04-22 17:10:23 -06:00
Nathan Sobo
fdccc0bcc2 Measure DOM dimensions before rendering elements that depend on them
This commit breaks the initial render of the editor component into two
stages.

The first stage just renders the shell of the editor so the height,
width, line height, and default character width can be measured. Nothing
that depends on these values is rendered on the first render pass.

Once the editor component is mounted, all these values are measured and
we force another update, which fills in the lines, line numbers,
selections, etc.

We also refrain from assigning an explicit height and width on the
model if these values aren't explicitly styled in the DOM, and just
assume the editor will stretch to accommodate its contents.
2014-04-22 17:10:21 -06:00
Nathan Sobo
a0ff6f5325 Handle 'autoscroll' option in model when setting selected buffer range 2014-04-22 17:09:45 -06:00
Nathan Sobo
4b9871fa13 Enable advanced scroll management only when editor is used by react view
This preserves the original behavior of the editor model with respect
to scroll position and autoscroll unless it's being used by the react
component, which flips the ::manageScrollPosition flag to true.
2014-04-22 17:09:41 -06:00
Nathan Sobo
9a3f8022ad Add shims to get bracket matcher working 2014-04-22 17:09:40 -06:00
David Graham & Nathan Sobo
6997adece9 Associate TokenizedLines with an ::indentLevel
This can be used to render the appropriate number of indent guide spans
for empty lines.
2014-04-22 17:09:39 -06:00
David Graham & Nathan Sobo
d0a917ed14 Prevent scrollLeft/scrollTop from going out of bounds 2014-04-22 17:09:39 -06:00
Nathan Sobo
171631d20f Autoscroll cursors horizontally at the model layer
Still need to respect the horizontal scroll position in the editor view
2014-04-22 17:09:38 -06:00
Nathan Sobo
486a7937b5 Render • instead of line number for soft-wrapped lines 2014-04-22 17:09:38 -06:00
Nathan Sobo
f5551929d8 Account for half-visible lines in DisplayBuffer::getVisibleRowRange
We need to add 1 to the editor's height in lines, because it's possible
to have *partially visible* lines at the top and the bottom.
2014-04-22 17:09:38 -06:00
Nathan Sobo
c4be3069f7 Select on mouse drag 2014-04-22 17:09:37 -06:00
Nathan Sobo
3a433f734c Move the cursor on single click 2014-04-22 17:09:36 -06:00
Nathan Sobo
3d3b72a954 Render selections 2014-04-22 17:09:04 -06:00
Nathan Sobo
96e6ddac2e Prevent out-of-bounds scrollTop assignment on DisplayBuffer 2014-04-22 17:09:04 -06:00
Nathan Sobo
5a8ca1ae66 Move screen-related properties to DisplayBuffer
Scroll positions, height, width, line height. We force update when one
of these observed properties changes.
2014-04-22 17:09:03 -06:00
Nathan Sobo
53cc5c9856 Base cursor x position on char widths stored in DisplayBuffer
Whenever new lines are added to the screen, we measure and store any
unseen scope/character combinations in the DisplayBuffer.
2014-04-22 17:09:03 -06:00
Nathan Sobo
148a9f0248 Add DisplayBuffer::pixelPositionForScreenPosition
This bakes character width tracking into display buffer directly, which
moves us toward a world where all rendering decisions can be made in the
model to strictly control DOM reads.
2014-04-22 17:09:03 -06:00
Corey Johnson
4a6b70d261 Use Marker::get/setProperties 2014-04-18 15:50:30 -07:00
Nathan Sobo
b9b3d021cc Add private method docs to DisplayBuffer::outermostFoldsInBufferRange 2014-03-06 15:31:14 -07:00
Nathan Sobo
6e202e18d8 💄 more comment formatting 2014-03-06 15:29:25 -07:00
Nathan Sobo
da85a07dae 💄 comment formatting 2014-03-06 15:17:34 -07:00
Nathan Sobo
ce4ce55b29 Make outermostFoldsForBufferRowRange exclusive of end row 2014-03-06 12:52:27 -07:00
Nathan Sobo
d97a0a3324 Add DisplayBuffer::outermostFoldsInBufferRowRange 2014-03-06 12:36:42 -07:00
Nathan Sobo
63f5a0a324 💄 Rename attributes to params to match TextBuffer naming 2014-03-06 12:32:17 -07:00
Nathan Sobo
f0837bb98b 📝 Improve DisplayBuffer::findMarkers docs 2014-03-06 12:31:55 -07:00
Nathan Sobo
40a8522460 Merge pull request #1623 from atom/ns-fix-editor-width-related-freezes
Fix freezes related to the editor's width in characters being assigned to non-positive integers
2014-02-28 20:38:07 +02:00
Nathan Sobo
4681098e8c Only allow positive widths in characters to be assigned
Fixes #1574
2014-02-28 10:31:02 -08:00
Nathan Sobo
dc5dc608ba Avoid row map corruption when replacing a subset of a fold's buffer rows
Fixes #1576

When splicing regions into the row map, we always express the starting
buffer row, then the number of buffer rows covered by the regions we're
inserting. When we're inserting regions representing folds, they always
extend to the end of a fold, so we need to ensure the endBufferRow also
extends to the end of the fold.

For example, say rows [5…10] are folded, and we handle a replacement of
rows [5…8]. We will still insert a region for the fold covering 1 screen
row and 5 buffer rows, so we need to update the endBufferRow to extend
to the end of the fold as well (10).
2014-02-28 10:11:57 -08:00
Nathan Sobo
f17c490768 Make Editor::unfoldBufferRow destroy all folds containing the buffer row
Also, remove ::destroyAllFoldsContainingBufferRow as it is now redundant
2014-02-27 16:16:01 -08:00
Nathan Sobo
761fcde654 💄 2014-02-27 15:34:19 -08:00
Nathan Sobo
f20c55f849 Use error constructor's name explicitly rather than arguments.callee 2014-02-27 15:29:47 -08:00
Nathan Sobo
1f7027d825 Throw a custom BufferToScreenConversion error with metadata 2014-02-27 15:07:08 -08:00
Nathan Sobo
0c8bb089b9 Reduce variation of buffer row to screen row conversion error message 2014-02-27 10:34:57 -08:00
Nathan Sobo
f612a85599 Merge remote-tracking branch 'origin/master' into ns-modernize-doc-links 2014-02-20 16:35:16 -07:00
Corey Johnson & Nathan Sobo
6c5a5c49da Remove unused Point 2014-02-20 11:14:15 -08:00
Nathan Sobo
53fb36d0e2 Switch all documentation links to match CoffeeScript literal notation
Foo::bar for instance methods
Foo.bar for class methods
2014-02-19 17:23:47 -07:00
Nathan Sobo
d64fefd96c Merge branch 'master' into ns-fix-softwrap
Conflicts:
	src/row-map.coffee
2014-02-14 08:36:58 -07:00
Kevin Sawicki
ec4cf8b497 Remove ConfigObserver
This class offers little utility now that emissary exists with beefed
up Subscriber and Emitter classes.
2014-02-06 13:07:25 -08:00
Kevin Sawicki
5b453290ad Mark DisplayBuffer methods delegated to as public 2014-02-06 11:17:20 -08:00
Kevin Sawicki
227454e27e Remove ### style visibility comments 2014-02-06 10:40:45 -08:00
Kevin Sawicki
cee0b951fb Remove empty Private: comments 2014-02-06 10:11:32 -08:00