Commit Graph

293 Commits

Author SHA1 Message Date
Nathan Sobo
2d25301ea0 Destroy folds when DisplayBuffer is destroyed
Fixes #4562
2015-07-27 12:04:46 -06:00
Nathan Sobo
5566d54f58 Don’t update screen lines if DisplayBuffer has been destroyed 2015-07-09 15:44:11 -05:00
Nathan Sobo
4567601ae9 Maintain change counts for debugging purposes
When we have an unexpected display-buffer or tokenized-buffer state,
we can include the change counts to make sure that every change to the
buffer has been processed by display-buffer and tokenized-buffer. If
they haven’t, there’s something wrong with our event ordering. If they
have, there’s a logic error somewhere else.
2015-07-09 02:18:24 -05:00
Nathan Sobo
afa6c9a786 Add invariant assertion about line count to see if we can find a bug
Does the line count ever get out of whack after an update, or is it
happening in some other way?
2015-07-09 01:55:13 -05:00
Nathan Sobo
3e7881f35f Report extra metadata when screen lines are undefined when clipping 2015-07-08 13:29:25 -05:00
aki
449c03cb35 Fix destroy listeners 2015-06-16 18:05:45 +09:00
Nathan Sobo
88812831ce Only check for max line length when lines exist 2015-06-05 23:40:56 +02:00
Nathan Sobo
56273e7eef Preserve large file mode across serialization and pane splits 2015-06-05 21:44:23 +02:00
Nathan Sobo
efd4662de0 Don’t allow soft wrap to be enabled in large file mode 2015-06-05 21:36:20 +02:00
Nathan Sobo
639647d115 Disallow fold creation in large file mode 2015-06-05 21:31:06 +02:00
Nathan Sobo
c34838277d In largeFileMode, base maxLineLength on the longest line we’ve seen
This is pretty hacky. If we want to compute the true longest line, we’ll
need to process every line, which is what large file mode is designed
to avoid. So now whenever the display buffer returns a line, it has
the potential to update the longest line.

This is a bit weird because retrieving a line now has a side effect.
It’s even more weird because the longest line will actually be wrong for
the initial state updates in the TextEditorPresenter. But as soon as
the user interacts in any way the dimensions are recomputed, so it works
for now.

A better approach may be to set a visible region on the display buffer.
But I’d like to keep this low-touch until we have a chance to revisit
the design of DisplayBuffer in a bigger way.
2015-06-05 19:55:34 +02:00
Nathan Sobo
de508db9b2 Implement basic large file mode for editor
* Don’t tokenize
* Don’t build metadata to support folds and soft wraps

Remaining issues:

* Max line length is hard coded
* Foldable indicators should be disabled
* Folding via API should be disallowed
2015-06-05 02:25:57 +02:00
Max Brunsfeld
b80c480d86 Store overlay decorations to optimize ::getOverlayDecorations() 2015-06-04 10:27:36 -07:00
Max Brunsfeld
f5895d8b0b presenter: use 'markers-updated' event for state updates
Signed-off-by: Nathan Sobo <nathan@github.com>
2015-06-03 17:58:44 -07:00
Max Brunsfeld
6f553f234c Add TextEditor::observeMarkers, use it in presenter
Signed-off-by: Nathan Sobo <nathan@github.com>
2015-05-29 17:21:23 -07:00
Nathan Sobo
2379b3803f Revert "Revert "Merge pull request #6757 from atom/ns-less-memory-for-tokens""
This reverts commit 7cb0bc3bc2.
2015-05-21 19:56:52 +02:00
Nathan Sobo
7cb0bc3bc2 Revert "Merge pull request #6757 from atom/ns-less-memory-for-tokens"
This reverts commit 0cd1f110b5, reversing
changes made to d75d202d33.

Conflicts:
	package.json
2015-05-21 16:25:23 +02:00
Nathan Sobo
50dd7ebbce Only perform a single marker query for folds when updating screen lines
This saves over 50ms to initialize the DisplayBuffer when opening
`text-editor.coffee`.
2015-05-21 00:54:12 +02:00
Nathan Sobo
2beb6c0fe0 Pass TokenIterator reference instead of using global singleton
Adds an extra reference to each tokenized line but is also more sane.

/cc @maxbrunsfeld
2015-05-20 19:29:38 +02:00
Nathan Sobo
3dcf9a4c66 Merge remote-tracking branch 'origin/master' into ns-less-memory-for-tokens 2015-05-16 03:05:11 +02:00
Max Brunsfeld
855d327d35 Merge pull request #6760 from atom/mb-text-buffer-6
Upgrade text-buffer for marker performance improvements
2015-05-14 14:29:35 -07:00
Nathan Sobo
e694b18ae2 Merge branch 'master' into ns-less-memory-for-tokens
Conflicts:
	spec/tokenized-buffer-spec.coffee
	src/tokenized-buffer.coffee
2015-05-14 18:55:16 +02:00
Max Brunsfeld
19d905606b Avoid double computation of screen lines when opening files
Previously, instantiating a TextEditor would always compute compute
screen lines twice: once when the DisplayBuffer was instantiated,
and once when the 'invisibles' property was set on the DisplayBuffer.
2015-05-13 19:59:25 -07:00
Max Brunsfeld
fe2cfff7a6 Allocate fewer objects for fold attributes in DisplayBuffer 2015-05-13 17:00:35 -07:00
Nathan Sobo
37d9a00b37 Use TokenIterator in DisplayBuffer instead of tokens shim 2015-05-14 01:15:44 +02:00
Max Brunsfeld
34a3ee1be9 ⬆️ text-buffer 2015-05-12 18:02:27 -07:00
Nathan Sobo
0d310c767f Splice in new DisplayBuffer lines in chunks to avoid stack overflows 2015-05-08 19:23:45 +02:00
Max Brunsfeld
5b8262bd96 🐎 Avoid repeated array allocation in ::getDecorations 2015-05-07 12:56:29 -07:00
Machiste Quintana
5d2392ea67 👕 Fix new coffeelint errors 2015-04-06 23:59:54 -04:00
Kevin Sawicki
6e3bdd2daf Return value from scroll top/left setters 2015-04-06 13:38:34 -07:00
Kevin Sawicki
72678df7fc Use new Model superclass in DisplayBuffer 2015-04-06 13:25:55 -07:00
Kevin Sawicki
7d592c8b78 includeDeprecations -> includeDeprecatedAPIs 2015-04-03 11:29:16 -07:00
Kevin Sawicki
23d1c72a5f Remove unused imports 2015-04-03 11:29:14 -07:00
Kevin Sawicki
8eded9f9bd Use disposables in DisplayBuffer 2015-04-03 11:29:13 -07:00
Kevin Sawicki
193ab71aca Call dispose instead of unsubscribe on marker 2015-04-03 11:29:13 -07:00
Kevin Sawicki
15c48c5388 Conditionally include deprecations in DisplayBuffer 2015-04-03 11:29:11 -07:00
Jesse Grosjean
0fe1ea1af3 Target 0 instead of -Infinity to make the code a bit clearer. 2015-04-02 12:25:16 -04:00
Jesse Grosjean
4a864e79dc Fix screenPositionForPixelPosition for case above first row.
Currently screenPositionForPixelPosition special cases pixel positions
below the last row so that the column position is always set to the
last column of the last line, even if the pixel 'x' position is less
then that column.

This patch special cases picks above the first row so that the  text
column position will be in the first column even if the pixel 'x'
position is greater then that column.

At a higher level, this patch fixes the problem where you can’t select
to the start of a text field by just clicking and dragging up. Instead
you have to click and drag back (x axis) beyond the start of the text
field.
2015-03-30 13:09:30 -04:00
Nathan Sobo
10458a5b45 Always autoscroll when the range of the last selection changes
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-03-26 15:30:53 -06:00
Max Brunsfeld
2f5d975338 Remove autoscroll-related legacy editor view support
Signed-off-by: Nathan Sobo <nathan@github.com>
2015-03-26 11:12:37 -07:00
Kevin Sawicki
590a4b0fd5 Add explicit return after for loop 2015-03-19 11:48:40 -07:00
Antonio Scandurra
f5e1e40edd Avoid named parameter to save an allocation 2015-03-18 17:44:35 +01:00
Antonio Scandurra
7c33b9bf41 🎨 Rename to softWrapHangingIndent 2015-03-18 14:18:27 +01:00
Antonio Scandurra
67b1d7890b Add soft-wrap hanging indentation spaces 2015-03-17 22:05:43 +01:00
Antonio Scandurra
f4b791d33b Use screenPosition to select above and below 2015-03-13 10:57:45 +01:00
Antonio Scandurra
3b5a0b292d 📝 Better and consistent naming across specs and docs 2015-03-12 12:32:59 +01:00
Antonio Scandurra
9f1bb82451 Adjust DisplayBuffer#getVisibleRowRange logic
This fixes #4596, where the calculation returned a wrong range.

* 📝 State clearly that we'll return a closed interval in docs
*  Write tests to ensure a correct behavior
2015-03-12 10:08:02 +01:00
Antonio Scandurra
efefc0dc66 DisplayBuffer#getEditorWidthInChars must always be >= 0 2015-02-27 00:55:03 +01:00
Nathan Sobo
c9ce9f41c2 Merge pull request #5567 from as-cii/indent-soft-wrap
Indent soft wrap
2015-02-25 19:06:35 -07:00
Nathan Sobo
5fdb3cde08 Fix ::longestScreenRow update for changes directly above longest line
Fixes #5716
2015-02-24 11:36:01 -07:00