Commit Graph

2399 Commits

Author SHA1 Message Date
Corey Johnson & Nathan Sobo
2973a81293 Don't assign text grammar by default. Just use the null grammar. 2013-04-03 18:34:54 -06:00
Corey Johnson & Nathan Sobo
1b56cfb270 LanguageMode switches to a better-matching grammar when it is added 2013-04-03 18:34:54 -06:00
Corey Johnson & Nathan Sobo
16b53d3183 Eliminate syntax.grammarsByFileType hash 2013-04-03 18:34:53 -06:00
Corey Johnson & Nathan Sobo
05d6adc6c7 Change syntax.selectGrammar to choose the highest-scoring grammar
This sets us up to switch to a grammar when it is loaded if it is a
better match for the current file.
2013-04-03 18:34:53 -06:00
Nathan Sobo
ed1c5d3417 Localize grammar reloading / setting to LanguageMode
Previously, logic associated with swapping grammars was a bit
scattered. Now grammar reloading / assignment methods delegate to
LanguageMode directly, and it emits a 'grammar-changed' event when
the grammar changes. Now EditSession and TokenizedBuffer listen for
this event and perform necessary actions for grammar change.
2013-04-03 18:34:53 -06:00
Kevin Sawicki
4f8d51450a Add missing space in expected string 2013-04-03 16:01:17 -07:00
Kevin Sawicki
0b9f6b14ba Put 'atom' in window title when no panes are open
Previously the title would revert to 'index.html' when
focus was gained and no panes were open.
2013-04-03 15:53:07 -07:00
Corey Johnson & Nathan Sobo
d136837c79 Fix version spec 2013-04-03 15:28:43 -07:00
Nathan Sobo
40aa81e9c1 Add required activate method to avoid logging during specs 2013-04-03 12:34:56 -06:00
Nathan Sobo
5d22cff6ad 🙊 2013-04-03 12:33:40 -06:00
Nathan Sobo
930cd9551b 💄 add eof newlines 2013-04-03 12:01:37 -06:00
Nathan Sobo
f03b6207de Make all requires of 'fs-utils' assign to fsUtils var instead of fs 2013-04-03 12:01:37 -06:00
Nathan Sobo
59a5a5bc8f Always pass a hash to TextBuffer.scanInRange iterators
This makes it easy to only assign variables for the information you
need in the iterator. Before, we always forced you to take a match and
a range as the first two arguments even if you weren't using them.
2013-04-03 11:16:49 -06:00
Mutwin Kraus
a9c74762cc Add focusPreviousPane to pane container 2013-04-02 15:24:12 -07:00
Nathan Sobo
1bbc9f61e9 Remove unsaved buffer prompt on reload now that we handle it correctly 2013-04-02 15:45:17 -06:00
Nathan Sobo
dab8c5b53b Assign cachedDiskContents when unsaved buffer is deserialized
This allows the buffer to return to an "unmodified" state if the
unsaved changes are reversed.
2013-04-02 15:45:16 -06:00
Nathan Sobo
3150785db2 Ensure we never deserialize two instances of the same buffer
We might have two edit sessions pointing to the same buffer, for
example if we have a split pane… So when we deserialize a buffer, we
always need to check that we don't already have an instance of that
buffer on the project. If we do, then we've already deserialized it
once so we don't need to worry about the saved text.

We still have a problem when deserializing previously unsaved buffers,
because we can't use the path to identify them.
2013-04-02 15:45:16 -06:00
Nathan Sobo
f531d36060 Condense / cleanup TextBuffer serialization specs
Typically it's fine to test serialization behaviorally. If we can
deserialize the serialized state correctly, then we're generally
happy. We don't need explicit tests on the serialized state… but I
added a couple assertions to ensure we don't write text when we don't
need to. It would have been more correct to just modify the saved
file and verify we load the new state, but it's not worth the hassle.
2013-04-02 15:45:16 -06:00
Nathan Sobo
9efc326ff3 Remove spec that can be covered in text-buffer specs 2013-04-02 15:45:16 -06:00
Nathan Sobo
78211acafd Use project.bufferForPath to build buffers in specs
This reflects the way buffers should always be created in practice. It
registers buffers on project, which will be important when testing
that we always get the same buffer when deserializing a buffer for a
path we've already opened.
2013-04-02 15:45:16 -06:00
Nathan Sobo
40975f15d3 💄 Follow whitespace conventions for specs 2013-04-02 15:45:16 -06:00
Mutwin Kraus
cc87595e4e Serialize TextBuffer inside EditSession serialize 2013-04-02 15:45:16 -06:00
Mutwin Kraus
693d8258ad Preserve buffer contents for unsaved files when reloading 2013-04-02 15:45:16 -06:00
Kevin Sawicki
9a8fd062c4 Throw error instead of string 2013-04-02 14:40:55 -07:00
Kevin Sawicki
07b40265fb Log error when no stack exists 2013-04-02 14:40:30 -07:00
Kevin Sawicki
3cfbbc5d94 Attach to DOM in specs that alter the mini editor
This is now required since populateList() is only
calls when the timeout is fired and the select list
is still on the DOM.
2013-04-02 13:22:46 -07:00
probablycorey
ecb159738f Rename singleTrailingNewline to ensureSingleTrailingNewline 2013-04-01 10:44:34 -07:00
Kevin Sawicki
19162db3ce Clip TextBuffer.characterIndexForPosition() position 2013-03-30 00:47:19 -04:00
Kevin Sawicki
da090b57d4 Use line ending length for mapping positions/characters
Previously the line ending length was hard-coded to one which
would cause TextBuffer.scanInRange() to return incorrect results
since one character per line wasn't being accounted for.

Closes #428
2013-03-30 00:30:54 -04:00
Kevin Sawicki
dc3b26c934 Add missing 't' in spec file name 2013-03-29 23:55:31 -04:00
probablycorey
d3920cdc05 Click and drag on the gutter selects lines correctly
Closes #352
2013-03-29 17:58:27 -07:00
probablycorey
05336dc38c Fix atom.version spec 2013-03-29 15:24:27 -07:00
Corey Johnson & Nathan Sobo
7d9e64a52d Mock getMaxTokensPerLine instead of overwriting member var 2013-03-29 11:22:01 -07:00
Kevin Sawicki
8e9a7355bc Return an empty array when the fs-utils.list() path isn't a directory
This makes the common case of iterating over an array of paths and
listing them cleaner since the return value doesn't need to be checked
before it is iterated over.
2013-03-29 13:44:03 -04:00
Kevin Sawicki
ff471ebf5b 💄 2013-03-28 22:08:53 -04:00
Kevin Sawicki
bd48cfced0 Don't track ctrl-click as the start of a selection
Closes #396
2013-03-28 22:06:56 -04:00
probablycorey
aab50d3c2c Only parse the first 100 tokens of a line
This fixes the UI thread lockup when there is a gigantic line in a
file (like minified js). I took a stab at making line tokeninization
async on the atom/async-single-line-tokenization branch, but it was
still too slow.

Closes #150
2013-03-28 17:14:45 -07:00
Kevin Sawicki
d54f2e6eab Only track selections that start with a left-click
Closes #396
2013-03-27 21:06:56 -04:00
probablycorey
72f57ad993 Remove old grammar view files 2013-03-27 17:34:14 -07:00
probablycorey
fd7772a653 Reset scrollLeft when setSoftWrapColumn is called
When the scroll view is scrolled and overflow-x is set to 
'hidden' the scroll view renders wrong. Setting scrollLeft to 0 fixes
this problem. I'm unhappy with this solution, but it was a
simple way to get the scroll view to update its layout.

Closes #137
2013-03-27 15:13:55 -07:00
probablycorey
a48a52922b Indent soft-wrap spec correctly 2013-03-27 15:13:55 -07:00
Kevin Sawicki
1d84274973 Return existing selections from addSelection()
Previously if a selection was added and then merged
away the selection-added event would still fire even
though the selection was already destroyed.

Now the existing selection that intersects with the
range is returned when the merge destroys the new selection.

Closes #374
2013-03-27 17:59:55 -04:00
probablycorey
a1b82e9dad Allow mini-editors to explicitly set their grammars 2013-03-27 11:00:53 -07:00
Cheng Zhao
b5be1c378a Replace Task's implementation with ProcessTask. 2013-03-27 12:25:54 +08:00
Cheng Zhao
142824ec01 Add test for ProcessTask. 2013-03-27 12:25:54 +08:00
Nathan Sobo
d3fa24be57 Remove scoped-properties when deactivating a TextMate package 2013-03-26 17:35:45 -06:00
Nathan Sobo
6a5ca3805e Spec loading of scoped properties when activating TextMate packages 2013-03-26 17:35:44 -06:00
Nathan Sobo
eef13e7db8 Test that deferred packages don't require their main module
As opposed to asserting that the main module isn't present, which
might not be true if a previous spec required it.
2013-03-26 17:35:44 -06:00
Nathan Sobo
e32d7b1ff1 Remove unused test.tmbundle 2013-03-26 17:35:44 -06:00
Nathan Sobo
1f74b5ccb4 Rename textmate package w/ invalid snippets 2013-03-26 17:35:44 -06:00