Commit Graph

2421 Commits

Author SHA1 Message Date
Kevin Sawicki
c7175c7e5f Return top and left values of 0 when not visible 2013-04-08 13:03:19 -07:00
Kevin Sawicki
b7b4dcda24 Schedule redraw when updating an invisible editor
The redrawOnReattach flag will now be set when update
display is called on an invisible editor so that if the
editor is detached or hidden before the next update was
processed it will be performed when reattached.
2013-04-08 12:50:05 -07:00
Kevin Sawicki
503b1231db Redraw editor when it becomes the active view
Start watching for when the editor becomes the active view
once it is attached and redraw it when it does.
2013-04-08 12:00:25 -07:00
Cheng Zhao
e0865e8c38 Use node-pathwatcher. 2013-04-07 16:35:35 +08:00
Nathan Sobo
abc5ed5190 Add editor:add-selection-above command 2013-04-05 14:52:35 -06:00
Nathan Sobo
37e16bb163 Clear multiple selections on escape
The binding uses the `!important` selector to ensure that the editor
always gets a chance to clear multiple selections before other bindings
for escape are processed.
2013-04-05 14:52:35 -06:00
Nathan Sobo
7018f33ad7 Allow !important flag in keymap selectors 2013-04-05 14:52:35 -06:00
Nathan Sobo
2efed9f42c Add EditSession.consolidateSelections() 2013-04-05 14:52:30 -06:00
Nathan Sobo
bd58834e7d Merge goal ranges when merging selections 2013-04-05 14:17:21 -06:00
Nathan Sobo
be009e87c2 Skip empty lines when adding selections below empty selections
Unless the selection's column is 0
2013-04-05 14:17:21 -06:00
Nathan Sobo
393cba4d42 Don't skip shorter lines when the adding empty selection below 2013-04-05 14:17:21 -06:00
Nathan Sobo
131df22c11 Skip lines that are too-short when adding non-empty selection below 2013-04-05 14:17:21 -06:00
Nathan Sobo
40d7fcf32c 🙊 2013-04-05 14:17:21 -06:00
Nathan Sobo
f22461e5e8 Clear goal range when selection is modified
Just like the cursor clears its goal column when it is moved in any
way other than vertically, the selection clears its goal range (the
range it will attempt to use when adding a selection below) when it
is changed in any way.
2013-04-05 14:17:20 -06:00
Nathan Sobo
f6bfab5dd7 Don't freak when selections are added & removed before display update
Previously, if a selection was added and removed before the editor got
a chance to update its display, it would try to add a selection view
for the destroyed selection. Now we check the new selections and
cursors to make sure they aren't destroyed before we add views for
them.
2013-04-05 14:17:20 -06:00
Nathan Sobo
31579703f0 Ensure new non-empty selections have an invisible cursor. 2013-04-05 14:17:20 -06:00
Nathan Sobo
af923cca9b Preserve original selection's range when adding selection's below
Just like the cursor tries to stay in its "goal column" when moving
vertically, here we try to keep the same selection even when adding
across shorter lines.
2013-04-05 14:17:20 -06:00
Nathan Sobo
26e53584c1 Add 'editor:add-selection-below' command
It still needs work, but the basic idea is for every selection to
add another another selection over the same column range of the line
below.
2013-04-05 14:17:20 -06:00
Kevin Sawicki
30fb637f86 Add spec for excluding ignored files from Project.scan() 2013-04-05 08:45:00 -07:00
Kevin Sawicki
84107317bb Support opening non-existent files from the CLI
This required changing text-buffer to support having a
path but not underlying file that exists yet.

Now calling RootView.open() with a non-existed path will
open a dirty empty editor to the path and the file will be
created on first save.
2013-04-04 17:08:05 -07:00
Kevin Sawicki
e442dfff11 Support joining editor lines with ctrl-J
This can be used with or without a selection to join one
or more lines with the line below it separated by a space.

Refs #134
2013-04-04 11:07:59 -07:00
Kevin Sawicki
9773751e79 Delete left when meta-backspacing at start of line
Previously EditSession.backspaceToBeginningOfLine() would do nothing
if at the beginning of the line.

Now it selects left and does a delete so it can be used to delete
multiple lines continuously without having to move the cursor.

Refs #134
2013-04-04 09:25:35 -07:00
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