Commit Graph

843 Commits

Author SHA1 Message Date
Nathan Sobo
839d57d819 Use existing line's indentation level if inserting normalized lines within it
If we're pasting multiple lines starting inside an already existing line, we never want to auto indent. We should just take its existing indentation level. Also, we strip the leading whitespace off the first line we're inserting, assuming it's already being represented by the indentation of the line we're onto which we're appending it.
2012-10-23 16:17:26 -06:00
Nathan Sobo
3b18c6a42d With autoIndent disabled, don't use suggested first line indent when normalizing
Also, when some lines are *less* indented than the first line, it might not be possible to outdent them as far as they originally were relative to the first line, so we do as much as possible.
2012-10-23 14:27:26 -06:00
Nathan Sobo
7bd4e8801f If inserting on a line that is longer than the suggested indent, preserve indent 2012-10-23 14:13:51 -06:00
Nathan Sobo
0e5c76b474 Start adding the normalizeIndent option to EditSession.proto.insertText
This will be used by the paste command to ensure that indentation is normalized.
2012-10-23 14:07:00 -06:00
Nathan Sobo
7be3c55765 Only auto-indent when typing, not when pasting or programmatically inserting
This paves the way for using a different strategy to normalize indentation when pasting, without it getting tangled in auto-indent.
2012-10-23 11:59:54 -06:00
Kevin Sawicki
ab8c22825c Support outdenting when indent is < 1 tab length 2012-10-23 09:57:39 -07:00
Corey Johnson & Nathan Sobo
fcbbe0a29b Do not use cached results for regexes that contain \G. 2012-10-22 11:04:20 -07:00
Corey Johnson & Nathan Sobo
9bf16063fc Un-F 2012-10-19 12:58:42 -06:00
Corey Johnson & Nathan Sobo
9303aaa8fd Rename root-view: event prefix to window: 2012-10-19 12:51:36 -06:00
Corey Johnson & Nathan Sobo
84b2cabeb3 Calling .abortKeyBinding on an event that wasn't triggered by the keymap is ok
Certain events call `abortKeyBinding` to opt out of handling certain keybindings. Snippets does this with tab for example. If it's not a situation where it's appropriate to go to the next tab stop, we let the next binding be triggered, which could insert a tab, for example. But when we trigger events from the event palette, there *is* no next binding. Having a no-op function helps in this situation.
2012-10-19 12:42:27 -06:00
Corey Johnson & Nathan Sobo
93cbe2bb22 Create root-view:toggle-invisibles event 2012-10-18 14:44:21 -07:00
Corey Johnson & Nathan Sobo
a72d0399f7 Add Editor.setShowInvisibles and remove showInvisibles from EditSession 2012-10-18 14:10:36 -07:00
Corey Johnson & Nathan Sobo
b33bbbfc0d Handle invisible character rendering when building HTML for lines.
Not during creation of tokens.
2012-10-18 11:43:17 -07:00
Corey Johnson
53534e61cf Remove double comment 2012-10-18 11:33:19 -07:00
Corey Johnson
c9db576a1c Fix specs 2012-10-18 11:33:19 -07:00
Corey Johnson
22e009a999 Set invisible values for spaces and tabs when initial tokenization occurs.
Also break whitespace into its own token just like tabs.
2012-10-18 11:33:19 -07:00
Corey Johnson
4478bbca9a When project.showInvisibles is true; spaces, tabs and newlines are visible 2012-10-18 11:31:39 -07:00
Corey Johnson
e2a917fcf3 Change tabText to tabLength 2012-10-18 11:31:39 -07:00
Corey Johnson & Nathan Sobo
4987ea3e49 If a TextMate syntax/preference fails to parse, catch error and log warning 2012-10-17 13:53:55 -07:00
Corey Johnson
6171ea33e1 Add support for TextMate grammars with newlines in their regexes 2012-10-16 15:58:11 -07:00
Kevin Sawicki
6551be0c85 Update the buffer being used when the editor path changes
Previously the status indicator would only work for the first
buffer open since only the buffer used when the extension was
initialized was subscribed to for change events.
2012-10-12 15:39:52 -07:00
Kevin Sawicki
0da869589e Use change event instead of buffer-change event
This will update the modified indicator after operations
are undone
2012-10-12 15:08:01 -07:00
Kevin Sawicki
19aa192c47 Return paths instead of deferred from project.getFilePaths
It was already being performed synchronously
2012-10-12 14:45:18 -07:00
Kevin Sawicki
38802ba287 Use javscript.tmbundle commit 2f95d9ae92
The commit after this one breaks syntax highlighting
for the lines after a single line comment
2012-10-12 11:34:44 -07:00
Corey Johnson
75d7950ef5 Fix linemap translation when an atomic token is at the end of a line.
Previously, if you entered an atomic token (like a tab) on an empty line it would not position the cursor after the token. This commit fixes that.

If the last screen line token is atomic, and screenLine.translateColumn's sourceColumn parameter is greater than the start position of the atomic token, then the translated column should be the end position of the atomic token.
2012-10-10 14:45:47 -07:00
Corey Johnson
8eb9d6629c Remove unused methods from token.
The refactoring of Editor.buildLineHtml removed the need for these methods
2012-10-10 14:45:46 -07:00
Kevin Sawicki
f694d1d2c8 Update ruby bundle to commit 77dc5d13cc 2012-10-10 13:48:46 -07:00
Kevin Sawicki
6dc5a05f35 Expect var to have modifier class instead of type
This changed in the underlying JavaScript bundle
2012-10-09 17:55:21 -07:00
Kevin Sawicki
2aa3667586 Update expected var selector to storage.modifier.js
This changed in the underlying JavaScript bundle
2012-10-09 17:49:53 -07:00
Kevin Sawicki
1694f74bcb Expect var to be a storage.modifier.js type in spec 2012-10-09 17:46:26 -07:00
Kevin Sawicki
8b61e6a9df Split out file and directory callbacks 2012-10-09 17:41:32 -07:00
Corey Johnson
701631e7cb Update spec to use new ruby scopes 2012-10-09 17:23:01 -07:00
Corey Johnson
6b5c3dc1cf Remove unused variable that causes specs to fail 2012-10-09 17:23:00 -07:00
Corey Johnson
7afbac5a4e Merge branch 'transpose' 2012-10-09 11:03:26 -07:00
Corey Johnson
a2f2e388d5 Test 💄
Instead of inserting text into an existing buffer, I replaced all text in the buffer to make the test easier to understand.
2012-10-09 11:02:39 -07:00
Will Farrington
4b3505d9b5 Disable buffer modified indicator if buffer content matches content on disk 2012-10-08 17:55:35 -10:00
Chris Wanstrath
f5f18abbf0 ctrl-t: transpose 2012-10-08 20:08:07 -07:00
Will Farrington
214735f1d7 add some specs for buffer modified indicator 2012-10-07 09:48:46 -10:00
Nathan Sobo
eae7fcdd97 Fix breaking due to "root-view:" prefixed events 2012-10-05 10:07:37 -10:00
Nathan Sobo
9906dd41b4 Give editor-specific events the "editor:" prefix 2012-10-05 10:07:37 -10:00
Kevin Sawicki
c30220ae80 Uncomment lines that match non-whitespace prefix of comment regex 2012-10-04 15:37:28 -07:00
Kevin Sawicki
b7f32036c2 Change editor-selection-change event name to selection-change 2012-10-01 15:44:58 -07:00
Kevin Sawicki
edfd61c702 Remove unneeded class addition 2012-10-01 15:44:58 -07:00
Kevin Sawicki
41cdf130fb Update highlighted line when editor selection changes 2012-10-01 15:44:58 -07:00
Kevin Sawicki
c7361d487f Update cursor line when selection screen range changes 2012-10-01 15:44:58 -07:00
Kevin Sawicki
2bea67057b Add spec for line highlight after backspace 2012-10-01 15:44:58 -07:00
Kevin Sawicki
f2306f444a 💄 2012-10-01 15:44:58 -07:00
Corey Johnson
887720e4de [fail] added failing gutter spec
When you remove a newline with backspace, the background on the gutter line number isn't highlighted. This is to help @kevinsawicki debug the problem.
2012-10-01 15:44:58 -07:00
Corey Johnson
9361b0717c Give gutter line highlighting its own describe 2012-10-01 15:44:58 -07:00
Kevin Sawicki
e039dab0f6 Don't highlight line in mini editor 2012-10-01 15:44:57 -07:00
Kevin Sawicki
a03512fd90 Add line number padding to expected width 2012-10-01 15:44:57 -07:00
Kevin Sawicki
a4ad5829a5 Disable gutter background highlight on multiline selections 2012-10-01 15:44:57 -07:00
Kevin Sawicki
33abaff747 Don't highlight line if selection is multiline 2012-10-01 15:44:57 -07:00
Kevin Sawicki
12a30873cf 💄 2012-10-01 15:44:57 -07:00
Kevin Sawicki
d69e08a858 Use screen rows for line highlight 2012-10-01 15:44:57 -07:00
Corey Johnson & Kevin Sawicki
e15694bb41 No longer cache cursorScreenRow in gutter highlighting 2012-10-01 15:44:57 -07:00
Corey Johnson & Kevin Sawicki
2863d92ce3 Use screen position for gutter highlighting 2012-10-01 15:44:57 -07:00
Kevin Sawicki
6412cde7a8 Support guide column callback function
This allows a config function to be registered
in the atom.coffee file to support different wrap
guide columns depending on the type of file being
viewed.
2012-09-29 11:44:05 -07:00
Nathan Sobo
4e49fbec72 TextMate grammars can include other grammars 2012-09-28 17:28:40 -06:00
Nathan Sobo
3a8fe2b24e Spans have a class for each dot-separated portion of their token's scope
Previously, we were rendering every prefix of the dot-separated scope as its own class. So the scope meta.delimiter.method.period.coffee would make a token w/ classes:

class="meta, meta-delimiter, meta-delimiter-method, meta-delimiter-method-period…"

Now we just give the token each piece of the scope as a class:

class="meta delimiter method period coffee"

We lose a bit of meaning, in that a scope selector method.period.coffee would match this element in CSS even though it *wouldn't* in TextMate. But we also gain the behavior where longer prefixes are more specific by naturally producing more specific css selectors. So '.meta.delimiter.method' is always more specific than '.meta.delimiter', whereas '.meta-delimiter-method' ties with '.meta-delimiter'. 

If prefix ambiguities become a problem later we may need to revisit this approach, but I think it's good enough for now.
2012-09-28 17:00:31 -06:00
Nathan Sobo
5ad6c67e07 Round alpha channel in TextMate theme rgba colors to 2-decimal places 2012-09-28 16:43:02 -06:00
Nathan Sobo
4ba5ccb0fa Properly translate hex colors from TextMate themes to rgba (divide alpha by 255) 2012-09-28 14:06:10 -06:00
Nathan Sobo
3ebd7cfef1 Output nested spans so that scope selector specificity translates better to CSS
The tokenizer emits individual tokens with arrays of scopes, rather than a more tree-like structure. It's debatable whether we want to emit scope trees rather than token streams in general, though that might complicate things like line wrapping. For now, we're reconstructing the tree during rendering based on information that's implicit in the tokens.
2012-09-28 13:36:43 -06:00
Corey Johnson & Nathan Sobo
bebfaed69b wip: creating token spans 2012-09-28 13:36:43 -06:00
Kevin Sawicki
02fa815459 Highlight the line number of the current cursor row 2012-09-28 09:52:34 -07:00
Corey Johnson & Nathan Sobo
82cecbf042 Add test for situation where we infinitely looped 2012-09-28 09:05:51 -07:00
Corey Johnson
f95e67d8cd Triple click selects entire line (including \n). Fixes #44 2012-09-26 13:53:51 -07:00
Nathan Sobo
2dbba203a0 Allow begin/end rules with back-references to be nested 2012-09-26 12:10:00 -06:00
Nathan Sobo
9c8d897317 Start on a spec for nested begin/end rule w/ back-references in the end rule 2012-09-26 09:59:15 -06:00
Nathan Sobo
2d38650265 Linguistic 💄 2012-09-26 09:57:35 -06:00
Corey Johnson
dd81e69bfb Merge branch 'master' of https://github.com/github/atom 2012-09-25 17:24:23 -07:00
Nathan Sobo
1d9cc53e7f RootView focuses the *first* focusable child.
This prevents an issue where the fuzzy finder's mini-editor would get focused again when the fuzzy finder was being hidden.
2012-09-25 17:38:48 -06:00
Corey Johnson
533ad84d03 Buffer.scanInRange can do a case-insensitive search 2012-09-25 16:30:44 -07:00
Nathan Sobo
1383a94d60 Second attempt: don't blow up when commenting in files w/ no language bundle 2012-09-25 17:14:25 -06:00
Corey Johnson & Nathan Sobo
685cbc3575 When focused, RootView retains focus itself if it has no focusable children 2012-09-25 15:11:07 -06:00
Nathan Sobo
5f253d78e9 Optimization: Use absolute positioning instead of flexbox in editor
Flexbox was causing layouts and repaints to cover the entire scroll view instead of just the edited line. This cuts down on DOM manipulation cost significantly.
2012-09-25 14:58:31 -06:00
Corey Johnson
a6352497b9 Merge branch 'master' of https://github.com/github/atom 2012-09-25 13:22:24 -07:00
Corey Johnson
d13796074b RootView passes focus to a child element with a tabindex of -1 (if one exists) 2012-09-25 13:22:06 -07:00
Nathan Sobo
b4b34b0489 Don't explode on meta-/ if there isn't a valid comment regex 2012-09-25 13:27:46 -06:00
Nathan Sobo
b00d0bacd9 When uncommenting multiple lines, don't raise an error if a line isn't commented
Previously, we were assuming that when uncommenting, that every line would match the comment regex. But this might not be the case. If the first line in the selection is commented but some subsequent lines aren't, they won't match the comment regex. So this commit guards for that case.
2012-09-25 13:19:59 -06:00
Kevin Sawicki
8393af2cd6 Serialize root view font size 2012-09-20 09:31:04 -07:00
Kevin Sawicki
7278bc62c6 Ensure start row is always >= 0
Previously if a file was a single line
it couldn't be deleted using the delete
line command because the start row would
index one row back which would be -1 and
therefore not be able to report a length
for use in the delete range.
2012-09-20 09:00:37 -07:00
Kevin Sawicki
f241bc5d2b Delete entire region when deleting a folded line 2012-09-19 18:16:45 -07:00
Kevin Sawicki
54180462f6 Match describe to method name 2012-09-19 17:08:17 -07:00
Kevin Sawicki
f7670dc1a0 Add support for save all via meta-S 2012-09-19 17:03:50 -07:00
Kevin Sawicki
b18627ab9b Add delete line support bound to meta-d key 2012-09-19 15:23:10 -07:00
Kevin Sawicki
47ed19f851 Substract scroll top when paging up 2012-09-19 08:52:05 -07:00
Kevin Sawicki
9ba3b74a9d Add support for Page Up and Page Down keys 2012-09-18 19:53:23 -07:00
Nathan Sobo
7937380eed Projects w/ EditSessions for now-deleted files can now be reloaded w/out error 2012-09-18 13:30:16 -06:00
Corey Johnson & Nathan Sobo
12e2fbdb14 Add support for back-references in TextMate grammars 2012-09-07 15:27:13 -07:00
Corey Johnson & Nathan Sobo
b00830cbc8 A pattern with no name or contentName does not insert undefined into scope array 2012-09-07 11:20:56 -07:00
Corey Johnson
4f2cc1f856 Add OnigRegExp.captureIndices(string, index, regexes)
Allows us to know if a zero-length regex matched.
2012-09-06 15:26:42 -07:00
Corey Johnson
4734c8cdc4 If the file name has no '.' use the file name as the extension. 2012-09-04 10:53:28 -07:00
Corey Johnson
fb039276de un-f 2012-09-04 10:52:34 -07:00
Corey Johnson
3b9310ebe4 Gutter width is sized to fit the width of the largest line number 2012-08-31 13:33:59 -07:00
Corey Johnson & Nathan Sobo
44db540528 All specs pass 2012-08-30 17:12:52 -06:00
Nathan Sobo
461ec70e7b Fix window spec 2012-08-30 16:19:38 -06:00
Corey Johnson & Nathan Sobo
b073f3e2b1 Make some assertions fuzzy to deal with sub-pixel issues. Not totally there yet 2012-08-30 16:13:13 -06:00
Corey Johnson & Nathan Sobo
bc9d9842a7 Kill atom spec. It's not worth testing this stuff right now 2012-08-30 16:10:24 -06:00
Nathan Sobo
d5ffdb153a Remove $native.saveDialog. It's replaced with atom.showSaveDialog 2012-08-30 11:08:55 -06:00
Nathan Sobo
d0c767ac15 Fix spy 2012-08-29 20:54:39 -05:00
Nathan Sobo
558ffd9cbe Spy on atom.confirm instead of $native.alert in specs 2012-08-29 20:50:47 -05:00
Corey Johnson
6f99b61dd3 Now storing a window's state based on its rootDirectory (instead of on windowNumber) 2012-08-29 10:59:45 -07:00
Corey Johnson & Nathan Sobo
12b06ddf0c Get spec suite running (lots of failures) 2012-08-27 17:36:36 -05:00
Nathan Sobo
c2c8724ad0 Initial commit 2012-08-10 13:32:19 -06:00
Corey Johnson & Nathan Sobo
26d17f7525 Fix failing spec 2012-08-23 10:45:44 -07:00
Kevin Sawicki & Nathan Sobo
1a8e36d6b7 💄 2012-08-22 13:43:46 -07:00
Kevin Sawicki
f778345b3a Add support for requiring a platform-specific stylesheet
Add a getPlatform method to the native object that
is used for requiring the platform stylesheet from
within window.coffee after the atom.css is required.

This is used to provide non-native scrollbars on Linux
for an improved look and feel.
2012-08-22 13:43:46 -07:00
Nathan Sobo
847b514164 Merge branch 'textmate'
Conflicts:
	benchmark/benchmark-helper.coffee
	benchmark/benchmark-suite.coffee
	src/app/language-mode.coffee
2012-08-09 18:57:59 -06:00
Corey Johnson
c1bd922d89 💄 2012-08-09 15:17:01 -07:00
Corey Johnson
634bebd207 Toggling comments adjusts selection's start and end columns 2012-08-09 14:38:16 -07:00
Corey Johnson
cc5ee48470 Auto-outdent lines correctly 2012-08-09 13:10:37 -07:00
Corey Johnson & Nathan Sobo
e8aaec43f7 WIP: Reworking auto-indent/outdent logic 2012-08-09 12:57:47 -06:00
Corey Johnson
19511fe8b8 Selections are restored to their original ranges after toggling comments. 2012-08-09 10:46:54 -07:00
Corey Johnson
c95ca04340 Use TextMate to toggle comments 2012-08-09 10:33:46 -07:00
Nathan Sobo
4109669284 Bold and italic fonts hose our width calculations 2012-08-08 22:31:33 -06:00
Corey Johnson & Nathan Sobo
7fe6a05594 Folding no longer relies on Ace.
Indentation is used to determine foldable regions, if the last line matches TextMate's foldEndRegex it is included in the foldable region.
2012-08-08 17:42:11 -07:00
Nathan Sobo
c8154e4e8c Use Twilight theme stylesheet based on TextMateTheme 2012-08-08 16:55:34 -06:00
Nathan Sobo
2df05e235a Break out window.applyStylesheet from window.requireStylesheet
This will be useful in applying generated stylesheets associated with themes.
2012-08-08 16:09:23 -06:00
Nathan Sobo
f559ad73a7 Make grammar handle lines that don't match *any* of the current rule's patterns
It's possible to get a match based on a lookahead, but not actually have any non-empty capture groups. This should be considered a failed match.
2012-08-08 08:59:13 -06:00
Nathan Sobo
d520d6c859 WIP: Optimization: compile a single regex for each grammar rule
We compile a giant regex out of all the individual regexes for each pattern by or'ing together a capture group for each one. Then we use the index of the matched capture group to determine which pattern actually matched, and adjust the capture indexes of the subtree to make it appear to start from index 0, so the capture indices on the pattern align properly. There is still broken-ness on more complex patterns, but basic patterns and patterns w/ captures work.
2012-08-06 18:32:55 -06:00
Nathan Sobo
7bc6a5f24b TextMateGrammar handles nested capture groups and trailing lookahead captures
Our previous implementation only allowed for a single layer of capture groups. Now we can have captures within captures. I achieved this by converting the match into a tree before generating tokens. If there are any capture scopes specified, then we will always emit a token for every capture group in the match. This may create some redundant tokens (a serious of 2 or more tokens with the same scopes), but it will at least be technically correct. I think the overhead of removing these redundancies exceeds the cost of maintaining them for now.
2012-08-06 16:35:33 -06:00
Nathan Sobo
0d6d16a438 Move TextMateGrammar.buildCaptureTree to .getCaptureTree method on OnigRegExp 2012-08-06 11:43:44 -06:00
Nathan Sobo
32fc042929 Add TextMateGrammar.buildCaptureTree, which organizes nested captures in a tree
This will be a weapon in dealing with capture groups that nest within other capture groups, and also helps deal with trailing lookahead groups that don't belong in the main match. I made it a class method because it's stateless and that made it easier to test.
2012-08-03 23:52:58 -06:00
Nathan Sobo
fd28a3577a Improve spec description 2012-08-03 23:51:14 -06:00
Corey Johnson & Nathan Sobo
0e1d3fe3a9 wip: fixing capture group problems 2012-08-03 11:38:45 -07:00
Corey Johnson & Nathan Sobo
1a243adfcf All specs pass w/ TextMateGrammar for tokenization (auto-indent disabled) 2012-08-03 12:00:05 -06:00
Corey Johnson
08a55dfcac wip: IndentationForRow almost works TextMate preferences 2012-08-02 17:02:17 -07:00
Corey Johnson & Nathan Sobo
9ca4c2c347 WIP: Loading TextMate Bundle preferences globally 2012-08-02 13:04:43 -06:00
Corey Johnson
b378620c54 Add TextMateBundle which handles all bundle loading 2012-08-02 11:38:14 -07:00
Corey Johnson
114847fb0f Update display buffer spec 2012-08-02 10:25:55 -07:00
Corey Johnson & Nathan Sobo
0a97cb0590 Tokenized buffer uses TextMate grammar 2012-08-02 10:05:09 -07:00
Corey Johnson & Nathan Sobo
b50b8eacca wip: hooking up tokenized buffer to textmate grammars 2012-08-01 17:54:08 -07:00
Corey Johnson & Nathan Sobo
370e0b896e Add TextMateGrammar.loadFromBundles() 2012-08-01 16:58:31 -07:00
Nathan Sobo
6de055aa1c Lines aren't taller when they contain an Inconsolata em dash (–) character 2012-08-01 17:04:33 -06:00
Corey Johnson & Nathan Sobo
98ef3e4243 Start on TextMateTheme object 2012-08-01 16:27:32 -06:00
Corey Johnson & Nathan Sobo
ed12f66b13 Do not insert matching bracket unless the following character is whitespace 2012-08-01 13:20:34 -07:00
Nathan Sobo
238fecb766 💄 2012-08-01 14:11:39 -06:00
Nathan Sobo
cdf20c7a15 Rename Parser to TextMateTokenizer 2012-08-01 13:58:38 -06:00
Corey Johnson & Nathan Sobo
fc1228619e Add spec for interpolated strings inside of interpolated strings 2012-08-01 11:49:45 -07:00
Corey Johnson & Nathan Sobo
487c4ed439 $self includes work 2012-08-01 11:45:30 -07:00
Corey Johnson & Nathan Sobo
bccd525084 Handle includes 2012-08-01 11:05:37 -07:00
Corey Johnson & Nathan Sobo
594e27b057 Parser maintains a stack of rules, which begin/end patterns mutate 2012-08-01 10:47:40 -07:00
Corey Johnson & Nathan Sobo
fbdebd644d Revert "Handle patterns that include other patterns from the grammar repository"
This reverts commit 64795c032306200f05ce3b262fe58adc86e06b34.
2012-08-01 09:48:40 -07:00
Corey Johnson & Nathan Sobo
62c5da760c Handle patterns that include other patterns from the grammar repository 2012-08-01 09:48:40 -07:00
Corey Johnson & Nathan Sobo
6af22fce67 Add specs for begin/end patterns with nested patterns. 2012-08-01 09:48:39 -07:00
Corey Johnson & Nathan Sobo
aa02785d67 Parser handles patterns w/ begin/end regexes (if begin/end are on the same line) 2012-08-01 09:48:38 -07:00
Nathan Sobo
7682f586be Parser can tokenize lines containing simple tokens (no nested scopes yet) 2012-08-01 09:48:37 -07:00
Corey Johnson & Nathan Sobo
a2a58a3506 TextMate parser can parse single plain tokens / tokens with captures 2012-08-01 09:48:37 -07:00
Corey Johnson & Nathan Sobo
c6bae093c1 Starting on TextMate bundle support 2012-08-01 09:48:35 -07:00
Corey Johnson & Nathan Sobo
a589557aaa Ignore bracket matching when there are multiple cursors 2012-08-01 09:47:12 -07:00
Corey Johnson & Nathan Sobo
97b492edfc When an identical closing bracket is inserted, don't insert a new character and move cursor to the right. 2012-08-01 09:33:42 -07:00
Corey Johnson & Nathan Sobo
3a5e73aa77 Merge branch 'making-folding-better' 2012-07-30 13:43:47 -07:00
Corey Johnson & Nathan Sobo
f7614c210a Add unfold-all and bind it to ctrl-} 2012-07-30 12:11:54 -07:00
Corey Johnson & Nathan Sobo
a7db67e68d When DisplayBuffer.foldBufferRow is called with a buffer row that is within a fold, it folds the scope that incloses the buffer row's fold 2012-07-30 11:46:43 -07:00
Corey Johnson & Nathan Sobo
9622d6f9b3 Rename un/foldScopeContainingBufferRow to un/foldBufferRow.
Scope containing buffer row was a misnomer. Waiting until I implement the repeat folding feature before considering a better name.
2012-07-30 10:25:53 -07:00
Corey Johnson & Nathan Sobo
75f0438f6a Rename fold/unfold to foldCurrentRow/unfoldCurrentRow 2012-07-30 09:58:15 -07:00
Corey Johnson
69d7ff0a55 add unfold to display buffer 2012-07-27 16:05:56 -07:00
Corey Johnson
7ff31d1ad7 Remove toggleFold and replace with fold 2012-07-27 13:46:50 -07:00
Corey Johnson
76ffa5a2c5 change toggle-fold to fold 2012-07-27 13:45:13 -07:00
Nathan Sobo
dc662ed071 When ( [ { ' or " is inserted, insert the matching character after the cursor 2012-07-27 13:08:43 -06:00
Nathan Sobo
87f4d8c6e9 Upon inserting '(', insert matching ')' character after cursor 2012-07-27 13:02:26 -06:00
Nathan Sobo
d0d5cb534f Merge branch 'master' of github.com:github/atom 2012-07-27 12:30:17 -06:00
Nathan Sobo
3516dea210 Introduce LanguageMode wrapper for Ace modes as a foundation of our own modes
LanguageMode is the central point for all language-specific behavior associated with an EditSession. There is one LanguageMode instance per EditSession. LanguageMode has access to the EditSession and its TokenizedBuffer, and in reverse the EditSession, DisplayBuffer, and TokenizedBuffer also make use of LanguageMode. This is a bit incestuous, but I think it's okay because you can think of LanguageMode as a swappable strategy object that governs language-specific aspects of that constellation of objects.
2012-07-27 12:30:06 -06:00
Corey Johnson
20ff70115f Fix bug in failing editor spec 2012-07-27 11:11:45 -07:00
Corey Johnson
42299c6a71 When the active edit session is modified, and its file is then modified by the file system, it displays an alert. 2012-07-26 10:59:58 -07:00
Nathan Sobo
252a1a4d5f 💄 2012-07-26 10:29:42 -06:00
Corey Johnson
470e8a6191 Add rootView.deactivateExtension 2012-07-25 15:45:21 -07:00
Nathan Sobo
1886b2a48e Merge branch 'master' of github.com:github/atom into global-find
Conflicts:
	spec/app/buffer-spec.coffee
	spec/extensions/command-panel-spec.coffee
	spec/extensions/tree-view-spec.coffee
	src/app/buffer.coffee
	src/extensions/command-panel/command-panel.coffee
	src/extensions/command-panel/keymap.coffee
2012-07-25 13:38:12 -06:00
Nathan Sobo
454557b502 Merge branch 'master' into global-find
Conflicts:
	spec/extensions/command-panel-spec.coffee
	src/app/buffer.coffee
	src/extensions/command-panel/command-panel.coffee
	src/extensions/command-panel/keymap.coffee
2012-07-24 17:59:49 -06:00
Corey Johnson
e491fe7bb7 Clean up after tests 2012-07-24 10:52:42 -07:00
Corey Johnson & Nathan Sobo
239fd2f9e6 buffer triggers a 'path-change' event when a file is moved or removed 2012-07-24 10:34:30 -07:00
Nathan Sobo
66f80c2dd8 Backfill coverage for handling of breaks in Project.scan subprocess output
If the stdout callback is fired with partial data, and it ends right after a path, we need to ensure we don't handle it as if there's an extra newline.
2012-07-24 10:07:07 -06:00
Corey Johnson & Nathan Sobo
9658cf61ff Buffer.getPath() returns null when the buffer's file is deleted on disk 2012-07-23 16:35:24 -07:00
Corey Johnson & Nathan Sobo
8d82f3125f When a file is deleted, associated Files trigger the 'remove' event 2012-07-23 16:35:24 -07:00
Corey Johnson & Nathan Sobo
7962c8ff34 When a file is moved (via the fs) associated File objects update their path and trigger a 'move' event 2012-07-23 16:35:24 -07:00
Nathan Sobo
c05fa7dc6f Merge branch 'master' into global-find
Conflicts:
	src/app/buffer.coffee
2012-07-20 19:01:38 -06:00
Nathan Sobo
239cba25e4 Use the silver searcher to implement global search
Parsing uses a simple state machine in `Project.scan`.
2012-07-19 17:28:46 -06:00
Corey Johnson & Nathan Sobo
f0417e7287 Ensure that Project.scan handles evil file fixtures correctly 2012-07-19 11:15:08 -06:00
Corey Johnson & Nathan Sobo
7a85e07cf1 Project.scan handles paths with newlines 2012-07-19 10:27:42 -06:00
Nathan Sobo
f5e46e57fc Use bundled ack instead of grep
Our ack is slightly modified to use `'\0'` characters instead of `':'` in the --nogroup listing. This makes it easier to handle both `':'` characters and newlines in filenames, but we aren't really doing that yet.
2012-07-19 09:17:44 -06:00
Corey Johnson & Nathan Sobo
4b1403724b Ensure that evil filenames do not hose Project.scan 2012-07-18 17:53:53 -06:00
Corey Johnson & Nathan Sobo
b959d5aa37 Buffers are memoized on project by path 2012-07-18 12:56:09 -07:00
Corey Johnson & Nathan Sobo
d36873f702 Rename Project.open to Project.buildEditSessionForPath 2012-07-18 11:20:13 -07:00
Nathan Sobo
4b147c04e5 RootView.proto.open returns the opened edit session 2012-07-17 14:44:04 -06:00
Corey Johnson & Nathan Sobo
126bdc1138 💄 2012-07-17 14:26:20 -06:00
Corey Johnson & Nathan Sobo
c3fe9aa0b3 Implement refcounting scheme on Buffer 2012-07-17 14:24:33 -06:00
Nathan Sobo
1d21de1e83 Merge cursors after buffer changes that didn't occur via the EditSession
The buffer now emits a new event 'update-anchors-after-change' to signal that all the anchors have been updated, which is an appropriate time to merge cursors.
2012-07-17 10:38:01 -06:00
Corey Johnson
5914b6cc2a Add Buffer.reload() 2012-07-16 16:12:09 -07:00
Corey Johnson
611eb93219 Buffer stores a is modified on disk flag 2012-07-16 16:11:52 -07:00
Nathan Sobo
512c1bfdb9 Merge branch 'master' into global-find 2012-07-16 14:56:24 -06:00
Corey Johnson
ac04a8ed66 Allow additional indentation after line has been auto-indented 2012-07-16 10:55:44 -07:00
Corey Johnson
95c3ea1b74 Rename insert tab event to indent 2012-07-16 10:34:02 -07:00
Corey Johnson
453af489d9 un-log 💩 2012-07-16 10:28:52 -07:00
Corey Johnson
5184b90365 Hitting tab on a line (containing only whitespace) will auto indent the line and set the cursor to the end 2012-07-16 10:25:28 -07:00
Corey Johnson
3e3bc99161 Merge branch 'master' into global-find
Conflicts:
	spec/app/editor-spec.coffee
2012-07-16 09:16:07 -07:00
Corey Johnson
e089b74867 Editor.renderedLines' css width is set to 100% when editor.maxScreenLineLength() is less than Editor.scrollView's width 2012-07-16 09:14:33 -07:00
Nathan Sobo
1ac6581f33 EditSession.setSelectedBufferRanges recycles selection instances
This prevents changing the scroll position when it isn't necessary.
2012-07-15 17:32:30 -06:00
Corey Johnson & Nathan Sobo
926067164d Buffer updates anchors when it changes instead of EditSession 2012-07-13 17:42:41 -06:00
Corey Johnson & Nathan Sobo
c7b7135388 Temporary fix: When editor is resized, adjust width of rendered lines.
We do this to ensure that the lines aren't longer than the scroll view if they don't have to be. We really should use min-width instead because it's automatic. Also, trigger window resize when we make the editor narrower.
2012-07-13 17:17:18 -06:00
Corey Johnson
b9d4270693 Merge branch 'master' into global-find 2012-07-13 09:36:21 -07:00
Corey Johnson
9dfa7d9439 When splitting an editor only the active edit session is copied to the new editor. 2012-07-13 09:24:14 -07:00
Corey Johnson & Nathan Sobo
d44c648d4b Editor.renderedLines' width is set to the maximum of either Editor.scrollView's width or the maximum rendered line width 2012-07-13 09:05:38 -07:00
Nathan Sobo
a4db677979 Implement setSelectedBufferRange w/ setSelectedBufferRanges
Also add the preserveFolds option, which doesn't destroy folds containing the selected ranges – mainly for specs right now
2012-07-12 18:57:12 -06:00
Nathan Sobo
f99146b42f EditSession.setSelectedBufferRanges destroys folds
It also clears all existing selections and makes new ones.
2012-07-12 18:40:34 -06:00
Corey Johnson & Nathan Sobo
e59d15868d un-f 2012-07-12 12:18:24 -07:00
Corey Johnson & Nathan Sobo
86adf09267 Test that project scan executes callback with match data 2012-07-12 12:12:44 -07:00
Corey Johnson & Nathan Sobo
d2d6efdcb5 Project.scan invokes the callback with matches 2012-07-12 11:12:31 -06:00
Nathan Sobo
3854f73c84 WIP: Start on Project.prototype.scan
Right now it calls out to grep and parses the output, but doesn't do anything with it just yet.
2012-07-11 18:50:38 -06:00
Corey Johnson & Nathan Sobo
9f9c636883 When snippet expansion is undone, the snippet is destroyed
This is still in progress. You can't *redo* snippet expansion and restore tab stops. Also, this commit performs all changes associated with snippet expansion in a transaction.
2012-07-06 12:10:14 -06:00
Corey Johnson & Nathan Sobo
6177b46cf9 Restore selection on active edit session when undoing/redoing
The `do`, `undo`, and `redo` methods on operations take an optional editSession argument, which can be used to determine the context in which they are being run. We restore selections on that edit session instead of the session where the operations originally occurred.
2012-07-06 11:42:07 -06:00
Nathan Sobo
53d6c4960a Fix specs that broke due to no subscription on Buffer from UndoManager 2012-07-05 20:06:09 -06:00
Nathan Sobo
42eefb49a9 Add UndoManager.prototype.transact
The `transact` method takes a function and batches all operations within that function as a single transaction to be undone and redone. The edit session now uses generic operations to restore selection state around transactions. The `undo` and `do` methods on operations are now optional. In addition, the undo manager now supports an optional `redo` method on an operation for code that should *only* be run on redo, and not when the operation is initially pushed. This is used by edit session to restore selection state after redo.
2012-07-05 20:04:16 -06:00
David Graham & Nathan Sobo
6fbd019b1d Pull out a BufferChangeOperation, which Buffer.change sends to UndoManager 2012-07-05 19:07:12 -06:00
Nathan Sobo
569359b687 Don't destroy selection/cursor anchors when encompassed by a change
Add the 'strong' option to anchors. If anchors are 'strong' instead of being destroyed by encompassing changes they move to the beginning of the change range.
2012-07-05 15:20:28 -06:00
Nathan Sobo
60a4f23c50 Anchors are destroyed when encompassed by a buffer change 2012-07-05 14:53:37 -06:00
Nathan Sobo
f253820250 💄 Use more delegated (editor -> buffer) methods 2012-07-04 12:58:00 -06:00
Nathan Sobo
b254fa39d9 💄 Replace editor.getBuffer().getText() w/ editor.getText() 2012-07-04 12:41:51 -06:00
Nathan Sobo
6d7a6f9a92 💄 Replace editor.getBuffer().getPath() w/ editor.getPath() 2012-07-04 12:40:17 -06:00
Nathan Sobo
c90c2e80d6 Replace @buffer reference on Editor with @getBuffer method 2012-07-04 12:34:44 -06:00
Nathan Sobo
fb6aa46531 Editor subscribes to buffer-path-change events on edit sessions, not buffers directly 2012-07-04 12:05:09 -06:00
Nathan Sobo
bdfdf08ea0 Adjust Editor.scrollTop when removing a line reduces the scroll height
This eliminates rendering artifacts and jerky scrolling at the bottom of the screen
2012-07-03 11:12:54 -06:00
Nathan Sobo
3ee7c0dc0f "Scroll" gutter by relatively positioning its line numbers
This matches how we scroll lines, and eliminates opportunities for the gutter to get out of sync with the lines. If that happened, it would probably be a bug, but this at least eliminates one source of confusion when debugging.
2012-07-03 11:09:34 -06:00
Nathan Sobo
9cae4d3d8f Rename RootView.editors -> getEditors 2012-07-02 19:47:38 -06:00
Nathan Sobo
bd5c1f8694 Rename RootView.activeEditor -> getActiveEditor 2012-07-02 19:46:33 -06:00
Nathan Sobo
a38042f89f Rename Editor.removeActiveEditSession -> destroyActiveEditSession 2012-07-02 19:44:24 -06:00
Corey Johnson & Nathan Sobo
b59bd4bc7b Saving a buffer does not trigger a "contents-change" event 2012-07-02 17:48:30 -07:00
Nathan Sobo
7387ad13f6 Merge branch 'master' of https://github.com/github/atom 2012-07-02 13:13:51 -06:00
Nathan Sobo
6b3180e144 Ensure path is present before building a Buffer with it in spec 2012-07-02 13:13:25 -06:00
Corey Johnson
10bfc56624 When a Buffer is created, the initial call to setText is not treated as an undoable change. 2012-07-02 11:39:22 -07:00
Corey Johnson
ae34611d2a Changes to buffer (via external process) do set buffer as modified. 2012-07-02 09:13:05 -07:00
Corey Johnson
801a91ec9b Specs cleanup buffers 2012-06-29 15:38:12 -07:00
Corey Johnson
c3d7d3566f Buffer listens for changes to file and triggers 'contents-change' event 2012-06-29 15:09:31 -07:00
Corey Johnson
e295d19d51 Editor.prototype.removeActiveEditSession calls destroy on the removed edit session 2012-06-29 15:09:01 -07:00
Corey Johnson
3dd9253bc5 When Buffer's path changes, stop listening for events on former path 2012-06-29 15:09:01 -07:00
Corey Johnson
8e7a8836cd Unmodified buffer updates contents when file changes outside of atom. 2012-06-29 15:09:01 -07:00
Corey Johnson
6182cf4736 un-f and un-console 2012-06-29 15:09:01 -07:00
Corey Johnson
e24c9932a4 Files trigger contents-change event 2012-06-29 15:09:01 -07:00
Nathan Sobo
3524490946 Ensure selection emits event if a buffer change moves its anchor 2012-06-29 11:55:16 -06:00
Nathan Sobo
6c60993f5c Fuzzy buffer finder switches to the editor that has the selected buffer if it isn't open on the current active editor 2012-06-29 09:59:37 -06:00
Nathan Sobo
22515e7ba0 RootView.open takes an 'allowActiveEditorChange' option
When the 'allowActiveEditorChange' option is true, RootView will try to activate an existing edit session for the given path on *any* editor, and switch focus there. This will be used by the fuzzy-finder for the meta-b option, which should open the chosen buffer on the editor that contains it, even if it isn't currently active.
2012-06-29 09:48:16 -06:00
Nathan Sobo
423b312e9c Meta-b opens the fuzzy finder with paths to the current editor's buffers 2012-06-28 12:57:52 -06:00
Nathan Sobo
5b11762989 Fix bug where edit sessions were not properly restored on refresh 2012-06-27 07:53:32 -06:00
Nathan Sobo
086b33f606 Merge branch 'snippets'
Conflicts:
	src/app/root-view.coffee
2012-06-26 22:58:32 -06:00
Corey Johnson
6d69ec77f1 Remove un-needed window.advanceClock calls from editor 2012-06-26 16:41:13 -07:00
Nathan Sobo
6389b19b7c Merge branch 'master' into snippets 2012-06-22 16:25:33 -06:00
Nathan Sobo
e2efa95d13 Ensure that 'change-screen-range' events are triggered on selections by backspace 2012-06-22 16:20:50 -06:00
Nathan Sobo
e1309f7c66 Key binding event handlers can call abortKeyBinding on the event object to abort and try the next binding 2012-06-20 22:08:16 -06:00
Nathan Sobo
d50b7f7a37 Trigger a 'new-edit-session' event when Project.prototype.open creates an EditSession 2012-06-20 17:40:45 -06:00
Nathan Sobo
e3d7ab31b5 Merge branch 'project-refactor' 2012-06-20 16:41:54 -06:00