Commit Graph

6975 Commits

Author SHA1 Message Date
Antonio Scandurra
f2a497d591 Don't create folds for empty ranges 2016-04-28 13:43:00 +02:00
Antonio Scandurra
57442781ec Fix bug when positioning cursors after the fold-marker 2016-04-28 13:31:28 +02:00
Antonio Scandurra
ce4b2fa810 Merge branch 'master' into ns-switch-to-display-layers
# Conflicts:
#	src/display-buffer.coffee
#	src/text-editor.coffee
#	src/tokenized-buffer.coffee
2016-04-27 18:16:03 +02:00
Antonio Scandurra
5cfe97160d Report boundary when next line's openScopes don't match containingTags
Sometimes, when performing an edit, a change on some row can cause
another row's tokenization to be affected: the classic example is
opening a multi-line comment on a line, thereby causing subsequent lines
to become commented out without changing the buffer's contents at those
locations. We call this technique "spill detection".

Since the amount of affected lines can grow quite large, Atom tokenizes
synchronously only those lines where the edit occurred, triggering
background (i.e. `setInterval`) tokenization for all the other lines
that need to be refreshed because of a "spill".

As predictable, this approach causes a temporary inconsistency in the
stored tokenized lines. In particular, suppose we had two tokenized
lines, and that there's an open tag in the middle of the first one which
closes on the second one. If we perform an edit that causes that tag to
be deleted, when reading the second tokenized line we now have a
dangling close tag.

This didn't matter much in the `DisplayBuffer` version, because for each
line we reopened all the tags found in the stored `openScopes` property,
and closed all the tags starting on such line right at the end of it.

In the `DisplayLayer` world, however, we don't read tags from each
tokenized line, but we let `TokenizedBufferIterator` report tag
boundaries and their respective location: since this is an
iterator-based approach, we were not reading `openScopes` for each
`TokenizedLine`, making the dangling close tag example showed above
evident (e.g. close and open tags didn't match anymore, and exceptions
were being thrown all over the place).

To solve this issue I have considered several approaches:

  1. Recompute all the lines where a spill occurs synchronously when the
  buffer changes. For large files, this can be pretty onerous, and we
  don't want to regress in terms of performance.

  2. Let `TokenizedBuffer.tokenizedLineForRow(bufferRow)` recompute
  potential invalid lines lazily (starting from the first invalid line,
  down to the requested buffer row). When editing the first lines of a
  long file and causing a spill to occur, Atom (or any other package,
  for that matter) could request a line down in the file, causing this
  method to recompute lots and lots of lines.

  3. Let `DisplayLayer` deal with closing an un-opened tag. This is nice
  because we already keep track of containing tags there. However, it
  also feels like the wrong spot where to put this logic, as display
  layers shouldn't deal with grammar-related stuff.

  4. Keep track of containing tags in `TokenizedBufferIterator`, and
  report a boundary at the end of the line when the subsequent one's
  `openScopes` property doesn't match the `containingTags` that the
  iterator has been keeping track of.

Of all these solutions I've chosen 4), because it's the most performant
and clean in terms of code.
2016-04-27 18:06:13 +02:00
joshaber
aa9e8ab620 Update the spec. 2016-04-26 14:56:00 -04:00
Josh Abernathy
bb1b89da60 Merge pull request #11603 from atom/remove-packagemanager-dependency
Remove TextEditor's dependency on PackageManager
2016-04-26 12:43:35 -04:00
joshaber
0541755ac8 Consistent indentation. 2016-04-26 09:49:38 -04:00
joshaber
67c7c60dcc Test getUpstreamBranch 2016-04-26 09:49:03 -04:00
joshaber
e16e987e08 Give the fixture a remote 2016-04-26 09:46:04 -04:00
joshaber
ff43d917be Lower case 2016-04-26 09:23:54 -04:00
joshaber
f86a15e5fc Spec for getOriginURL 2016-04-26 09:22:56 -04:00
joshaber
f589bdd8d9 Add a remote to the fixture. 2016-04-26 09:22:38 -04:00
Antonio Scandurra
7ba9cc6329 Unfold all the folds intersecting the row when clicking fold indicators 2016-04-26 13:24:21 +02:00
Antonio Scandurra
38bd120fb1 🎨 2016-04-26 12:11:13 +02:00
Antonio Scandurra
f81f54e08a Apply 'folded' decoration only to 1st screen row of a wrapped buffer row 2016-04-26 12:11:05 +02:00
Antonio Scandurra
4f6687324e Include bufferRange in decorationsStateForScreenRowRange 2016-04-26 12:09:38 +02:00
Antonio Scandurra
ebfd821237 Destroy folds corresponding to fold-markers and not the whole buffer row 2016-04-26 10:47:42 +02:00
Antonio Scandurra
00ebe6bbbc Merge branch 'master' into ns-switch-to-display-layers
# Conflicts:
#	src/text-editor.coffee
2016-04-26 10:19:39 +02:00
joshaber
759d64501d Better test. 2016-04-25 16:07:49 -04:00
joshaber
6852d6e91c Test it. 2016-04-25 15:34:46 -04:00
joshaber
956e037681 But without the space. 2016-04-25 14:20:54 -04:00
joshaber
d494f065df Update the spec. 2016-04-25 14:12:42 -04:00
joshaber
3574613fa3 Don't need resource pool anymore. 2016-04-21 14:19:24 -04:00
joshaber
809d194f31 Update the tests 2016-04-21 13:17:35 -04:00
Nathan Sobo
5ed30f910c Create synthetic iterator boundaries between open and close tags
If no non-negative integer exists between an open and close tag code,
we still need to report a boundary there, since close tags always have
to come first at any given iterator position.

:pear:ed with @as-cii
2016-04-21 10:43:21 -06:00
Antonio Scandurra
754cbc2a67 Merge branch 'master' into ns-switch-to-display-layers
# Conflicts:
#	spec/tokenized-buffer-spec.coffee
2016-04-20 10:55:56 +02:00
Wliu
ea5ad4ae59 Coffeescript comment tokenization no longer matches the newline character 2016-04-19 21:31:53 -04:00
Damien Guard
42fef8c014 Merge pull request #11488 from atom/dg-fix-windows-specs
First batch of Windows specs fixes
2016-04-19 15:48:31 -07:00
Nathan Sobo
3bbeb9e680 Merge remote-tracking branch 'origin/master' into ns-switch-to-display-layers 2016-04-19 15:30:00 -06:00
Damien Guard
1500381ac9 Tweaks to the specs improvements from feedback 2016-04-19 14:25:44 -07:00
Michelle Tilley
b2aad098e1 Correctly autoindent \r\n in Selection#insertText 2016-04-18 11:06:51 -07:00
Michelle Tilley
e41b9f00fb Correctly autoindent single newline in Selection#insertText 2016-04-15 21:23:28 -07:00
Damien Guard
99e716f9ed Fix specs failures on Windows including paths 2016-04-15 11:25:05 -07:00
Antonio Scandurra
7eba972f39 Merge branch 'master' into ns-switch-to-display-layers 2016-04-15 17:39:15 +02:00
Antonio Scandurra
147fed3123 Revert "Remove this commit if it works on travis"
This reverts commit 303bb8c74e.
2016-04-14 15:46:50 +02:00
Antonio Scandurra
303bb8c74e Remove this commit if it works on travis 2016-04-14 11:24:59 +02:00
Antonio Scandurra
4adf23a595 Unconditionally report deprecations on every test environment 2016-04-14 11:24:01 +02:00
Antonio Scandurra
581dd45418 Merge branch 'master' into ns-switch-to-display-layers 2016-04-13 13:54:13 +02:00
Katrina Uychaco
49fb287592 Don't load packages starting with dot. Fixes #9805 2016-04-12 20:35:30 -07:00
Damien Guard
2d173911b2 Ignore autorun on our buffered process commands. Fixes #10082 2016-04-12 12:02:20 -07:00
Antonio Scandurra
f3c6a77954 💚 Use persistent instead of maintainHistory in specs 2016-04-09 09:30:47 +02:00
Antonio Scandurra
afdd8d2b6d Avoid creating line nodes twice in lines-yardstick-spec.coffee 2016-04-08 17:41:29 +02:00
Antonio Scandurra
c23ef9a168 Stop using tokenizedLineForScreenRow in random-editor-spec.coffee 2016-04-07 13:54:29 +02:00
Antonio Scandurra
a532000af4 Handle only buffer coordinates in TokenIterator 2016-04-07 13:39:13 +02:00
Antonio Scandurra
b0c485c4ea 🔥 Remove TokenizedLine specs 2016-04-07 11:48:18 +02:00
Nathan Sobo
85ab86df10 Merge branch 'master' into ns-use-display-layers 2016-04-05 16:40:41 -06:00
Antonio Scandurra
bef7539e34 Refactor DisplayBuffer to DecorationManager
This commit moves all the remaining concerns not related to decorations
out of `DisplayBuffer` and into `TextEditor`. This means the
`DisplayBuffer` is now free to be renamed to `DecorationManager`.
2016-04-05 18:43:08 +02:00
Antonio Scandurra
712b1f1f88 Fix LanguageMode specs
Also, avoid creating folds twice for the same position when calling
`foldAll`.
2016-04-05 14:19:59 +02:00
Antonio Scandurra
544b75c7b0 🔥 💚 Fix TokenizedBuffer specs 2016-04-05 12:19:45 +02:00
Antonio Scandurra
80b956e996 💚 Fix TextDecorationLayer API specs in TokenizedBuffer 2016-04-05 11:39:06 +02:00