Commit Graph

1155 Commits

Author SHA1 Message Date
Justin Palmer & Nathan Sobo
65927ea0cf fix window blur and focus events 2013-02-05 12:03:56 -08:00
Justin Palmer
22770bd663 add onBlur and onFocus events for the window
This allows us to simulate those events and test for them easier
2013-02-05 10:53:35 -08:00
Nathan Sobo
afe0a6570a Reduce observation to single observeMarker method on display buffer
It will call the observer callbacks with the buffer and screen positions
of the head and tell each time any of these values is changed.
2013-02-04 21:24:06 -07:00
Nathan Sobo
58450d6a65 Give Buffer only a single observeMarker method
It will fire the callback whenever the marker's head or tail position
changes, and it's up to the subscriber to use the information how they
want to.
2013-02-04 20:35:30 -07:00
Nathan Sobo
852b4c2f8a Merge remote-tracking branch 'origin/dev' into markers 2013-02-04 20:04:01 -07:00
Justin Palmer
eb8d6f9766 fix textmate editor specs 2013-02-04 17:07:27 -08:00
Justin Palmer
4350be62c6 💀 is-focused.
targeting blurred state instead so normal state styles don't need a
special prefix
2013-02-04 16:02:09 -08:00
Justin Palmer
7a2a02dacf Merge pull request #227 from github/cut-dat-fat
Reusable styles for common UI elements
2013-02-04 15:39:22 -08:00
Kevin Sawicki
bef965d863 Add line number padding to expected width 2013-02-04 15:35:40 -08:00
Kevin Sawicki
bd88a0de15 Support CSON config file
Use ~/.atom/config.cson as the new default when no
config file exists.

~/.atom/config.json is still the default if they both
exist.
2013-02-04 12:38:00 -08:00
Nathan Sobo
ead93d0f39 Rename to DisplayBuffer.observeMarkerHeadPosition
When you observe, you get callbacks whenever the screen or buffer
position changes, and you get the new and old position in both 
coordinate types.
2013-02-04 11:32:47 -07:00
Nathan Sobo
44e48d42ea Add Buffer.observeMarkerRange 2013-02-04 11:27:39 -07:00
Jon Rohan
3cf07d29f3 Changing the if-focused event binding to blur. 2013-02-03 09:01:27 -08:00
Nathan Sobo
bd96db781e Pass old/new buffer and screen positions to marker position observers
This is needed by the snippets package, which needs to know where the
cursor was previously when it moves to decide whether to cancel the
current snippet.
2013-02-02 18:00:35 -07:00
Nathan Sobo
d144dd4efe Merge branch 'dev' into better-anchors 2013-02-02 17:03:57 -07:00
Nathan Sobo
94f1630152 Bind window focus and focusout events separately to fix spec 2013-02-02 17:02:07 -07:00
Nathan Sobo
7867d0cb3b Fix spec for 'focused' to 'is-focused' class rename. 2013-02-02 16:55:51 -07:00
Nathan Sobo
abafb541df Merge remote-tracking branch 'origin/dev' into better-anchors 2013-02-02 16:47:09 -07:00
Nathan Sobo
aa076a0bf2 Remove focused specs 2013-02-02 16:45:15 -07:00
Nathan Sobo
80b39ae263 Replace mentions of 'anchor' with 'tail' in selection and its spec 2013-02-02 16:44:13 -07:00
Nathan Sobo
6beee10160 Replace anchor w/ marker in selection destruction spec 2013-02-02 16:41:57 -07:00
Nathan Sobo
12425b796c Tweak specs now that buffer changes don't autoscroll the cursor 2013-02-02 16:34:28 -07:00
Nathan Sobo
e53403718a Tell marker head observers if a move was caused by a buffer change
This is used by cursor to only autoscroll when the marker head is
explicitly moved, so that passive movements caused by buffer insertions
don't trigger autoscrolling.
2013-02-02 16:17:14 -07:00
Nathan Sobo
c865b9f53a Update selection autoscroll specs with 3-valued logic
If autoscroll is true, we center the view on the selection. If false,
we do no autoscrolling at all. And if undefined we autoscroll to the
cursor.
2013-02-02 15:58:35 -07:00
Nathan Sobo
3d8406f5a3 Clip screen positions before translating to buffer positions 2013-02-02 15:07:17 -07:00
Jon Rohan
0d2a328dcc making the editor .focused .is-focused for symmetry 2013-02-01 19:23:52 -05:00
Jon Rohan
e54c3d8fbb adding is-focused to body, and styling light ui 2013-02-01 18:40:53 -05:00
Jon Rohan
f62e49d2f4 Adding back the font-weight font-style to tmThemes
We can add this back now because in the default tests we're using a true
monospaced font, not the fake monospace font Inconsolata.
2013-02-01 11:09:12 -05:00
Nathan Sobo
1bbb954239 EditSession specs passing after converting Selection to use markers
Still a bit of a mess though...
2013-01-31 18:26:29 -07:00
Corey Johnson
5d95d8bc4e Remove log noise while running tests 2013-01-31 15:16:03 -08:00
Nathan Sobo
628701fd3a Finish converting cursors to use markers.
The model layer works at least… haven't tested the view. Will test out
the view once I get the selection model working.
2013-01-31 15:52:28 -07:00
Nathan Sobo
ec521b3fd3 Add ability to cancel marker head position observations 2013-01-31 14:11:28 -07:00
Nathan Sobo
bc44540b10 Start adding ability to observe marker head positions 2013-01-31 14:00:01 -07:00
Kevin Sawicki
379a4a4d8d Only auto-load .cson and .json keymap files
This now prevents files such as .DS_Store from being loaded as a
keymap where previously all paths were loaded regardless of extension.

Closes #205
2013-01-31 12:03:21 -08:00
Corey Johnson & Kevin Sawicki
8f030cd97e Always calculate dimensions with editor on DOM
Closes #206
2013-01-31 10:31:13 -08:00
Jon Rohan
11c0637220 Not adding a font family when the user doesn't have it set 2013-01-31 10:19:41 -05:00
Nathan Sobo
074c1815d0 Start adding marker methods to DisplayBuffer
Whereas marker methods on buffer take for granted that everything is
in buffer coordinates, methods on the DisplayBuffer offer both
screen and buffer coordinate versions of the marker API.
2013-01-30 22:46:52 -07:00
Nathan Sobo
1d1c613f5b Allow buffer marker head and tail positions to be manipulated 2013-01-30 22:16:08 -07:00
Nathan Sobo
5dd142b966 Allow markers to be created in a reverse orientation
This means that the head of the marker precedes its tail in the buffer.
This will be important if we want to build selections on top of markers.
2013-01-30 21:44:57 -07:00
Nathan Sobo
d8ffdcd6bd Allow markers to be created with just a position
When a marker is created with just a position, it only gets a head
position and has no tail position.
2013-01-30 21:37:57 -07:00
Nathan Sobo
0e67f35748 Start on marker interface in DisplayBuffer 2013-01-30 21:04:52 -07:00
Nathan Sobo
fd99c795b9 Merge remote-tracking branch 'origin/dev' into better-anchors 2013-01-30 20:45:31 -07:00
Nathan Sobo
e02f9cd830 Rename Buffer.createMarker to markRange 2013-01-30 17:41:04 -07:00
Nathan Sobo
dfe0cad217 Replace anchor point/range with a single concept: markers
A "marker" is basically like a persistent selection/cursor composite,
having a head and a tail. The "head" is like the cursor in a selection,
and the "tail" is like the part of the selection that doesn't move. My
goal is for markers to be the only construct used to track regions
in the buffer. I want to replace anchors with them.
2013-01-30 16:52:09 -07:00
Kevin Sawicki
1acf0b870f Support translating points and ranges 2013-01-30 13:49:10 -08:00
Corey Johnson
c650deea01 Merge branch 'font-config' into dev 2013-01-30 13:24:12 -08:00
Nathan Sobo
bcd9d5d2b9 Rename addAnchorPoint to createAnchorPoint 2013-01-30 13:57:39 -07:00
Nathan Sobo
063cb71175 Spelling 💄 in spec 2013-01-30 13:24:15 -07:00
Corey Johnson
9b1cb29e1f Don't store fontSize and fontFamily as instance variables 2013-01-30 12:20:02 -08:00
Corey Johnson
29ccd271de Set font-size css property using style tag 2013-01-30 12:11:17 -08:00
Corey Johnson
9ea29b2899 Set font-family css property using style tag 2013-01-30 12:07:23 -08:00
Nathan Sobo
113a8fa279 Merge remote-tracking branch 'origin/dev' into better-anchors
Conflicts:
	src/app/cursor.coffee
	src/app/editor.coffee
2013-01-30 12:59:04 -07:00
Kevin Sawicki
f90d29262c Use octicon as folding indicator 2013-01-30 11:50:29 -08:00
Kevin Sawicki
8dbcefa932 Style color of folded line numbers 2013-01-30 11:50:23 -08:00
Nathan Sobo
ec3a1a80cd Restore invalidated anchor points on undo/redo of a change 2013-01-30 12:48:29 -07:00
Nathan Sobo
30909a8e8f Move anchor points to buffer; restore invalidated points on undo 2013-01-30 12:23:42 -07:00
Corey Johnson
e7c3282f53 Add font-family spec 2013-01-30 10:15:34 -08:00
Corey Johnson & Kevin Sawicki
4db876aed1 Deleting before fold no longer unfolds after undo
Use same row delta computation for updating start and
end rows in folds.
2013-01-30 09:10:26 -08:00
Corey Johnson
97fa9d522a end/beginning word implementations are now more similar 2013-01-30 08:39:32 -08:00
Nathan Sobo
6c7b93872c Add failing specs for undoing changes that surround anchor points 2013-01-29 18:29:42 -07:00
Nathan Sobo
0ecfba3262 WIP: Start adding new anchorPoint API on edit session
These will replace anchors, but they won't be stored on the Buffer
at all. The API user will access them by a returned scalar id rather
than calling methods on the returned anchor object directly.
2013-01-29 18:21:56 -07:00
Corey Johnson
46aefc75ab Make EditSession specs match vim style word behavior 2013-01-29 16:57:23 -08:00
Corey Johnson
dac92ca6e7 Make cursor.moveCursorToBeginningOfWord behave like vim 2013-01-29 16:57:22 -08:00
Corey Johnson
b66efbe3e7 cursor.getBeginningOfCurrentWordBufferPosition behaves like vim 2013-01-29 16:57:22 -08:00
Kevin Sawicki
1303e58a87 Don't move trailing newline for multiline selections 2013-01-29 16:51:33 -08:00
Kevin Sawicki
1a04fa31d1 Clip range specified to Buffer.getTextInRange() 2013-01-29 15:35:14 -08:00
Nathan Sobo
3f50dbe1f8 💄 2013-01-29 16:00:45 -07:00
Kevin Sawicki
096566ab2a Bind ctrl-meta-down to move line(s) down
Refs #134
2013-01-29 14:58:52 -08:00
Kevin Sawicki
ad7e4b63c0 Bind ctrl-meta-up to move line(s) up
Refs #134
2013-01-29 14:58:51 -08:00
Nathan Sobo
2380fa3445 Handle 'autoscroll' entirely in Cursor instead of in Anchor
This commit makes autoscroll a 3-valued property on the cursor. If it
is set to true or false, that setting will stick until the cursor's
next visual update. That means we can explicitly move the cursor with
autoscroll set to false, but also still autoscroll by default when the
cursor's anchor moves on its own.
2013-01-29 12:11:43 -07:00
Kevin Sawicki
e792265076 Trigger grammars-loaded event on syntax 2013-01-28 14:34:49 -08:00
Kevin Sawicki
ad8dd767e5 Don't allow web worker grammars to be registered
Grammars are already loaded at the beginning of the
specs synchronously and should not be overridden
when testing the background load task.
2013-01-28 14:23:18 -08:00
Corey Johnson & Nathan Sobo
493ed5f006 Merge branch 'web-workers' into dev 2013-01-28 15:02:57 -07:00
Kevin Sawicki
d84c600679 Don't add CR invisible if line is soft wrapped 2013-01-28 13:33:46 -08:00
Kevin Sawicki
fa5ceedfe0 Don't add EOL invisible if line is soft wrapped 2013-01-28 13:22:32 -08:00
Kevin Sawicki
ee5d70b65d Terminate worker when all packages have been loaded 2013-01-27 22:38:11 -08:00
Kevin Sawicki & Nathan Sobo
98614592af Store line endings on a per-line basis in Buffer
The line ending for each line is recorded and reused
when lines are modified or inserted.

Closes #166
2013-01-27 16:01:22 -08:00
Kevin Sawicki
ecc50506c7 Render trailing carriage return as an invisible 2013-01-27 16:01:22 -08:00
Nathan Sobo
c16acc6b2c Disable 'package-that-throws-an-exception' except in spec that uses it
Loading this package logs a warning, so to minimize noise in the spec
console, it should only be loaded when `console.warn` is mocked.
2013-01-27 13:11:42 -07:00
Kevin Sawicki
1b76b05e4d Bind ctrl-C to copy path to clipboard
Refs #173
2013-01-25 17:52:05 -08:00
Kevin Sawicki
985dd284dc 💄 2013-01-25 17:37:24 -08:00
Kevin Sawicki
22aeda6f1c Add move-to-top/bottom support to select list 2013-01-25 17:31:45 -08:00
Kevin Sawicki
fb4623d5d3 Don't populate list until elements have been set
Closes #174
2013-01-25 10:28:07 -08:00
Kevin Sawicki
7425f58f26 Only change end position if selection is mult-line 2013-01-23 16:46:43 -08:00
Kevin Sawicki
6324a60d72 Wrap selection in brackets
Enclose the selection in brackets when an opening
bracket is typed and the selection is non-empty

Closes #41
2013-01-23 16:24:40 -08:00
Kevin Sawicki
bc3646f180 💄 2013-01-23 16:24:40 -08:00
Kevin Sawicki
17f12c42d3 Delete end pair when begin pair is backspaced 2013-01-23 16:24:40 -08:00
Kevin Sawicki
41a15c7889 Update spec event coordinates for new default styles 2013-01-22 21:43:35 -08:00
Kevin Sawicki
5d404d7ee0 Use new unstyled expected gutter width 2013-01-22 21:10:11 -08:00
Kevin Sawicki
f6e4e69e2b Remove unused require 2013-01-22 18:32:05 -08:00
Kevin Sawicki
ca596db310 Extend AtomPackage directly in packages index.coffee 2013-01-22 18:26:48 -08:00
Kevin Sawicki
7c7ca4a6c3 Don't auto outdent if already fully outdented 2013-01-22 17:39:03 -08:00
Kevin Sawicki
59f7b6650c Don't auto outdent if preceding row is null 2013-01-22 17:38:23 -08:00
Kevin Sawicki
39fd4f7059 Remove extra subscribeToFile() call
This was causing an event listener to leak
on each call to save()

Closes #152
2013-01-22 14:44:34 -08:00
Jon Rohan
cb6798c357 fixing spec for ui test 2013-01-22 12:40:51 -08:00
Jon Rohan
7582952a13 fixing broken specs 2013-01-21 19:53:36 -08:00
Andy Delcambre
759fe2dd5b Bind meta-= to autoindent currently selected rows
Closes #142
2013-01-18 11:33:20 -08:00
Kevin Sawicki
62f1155706 Don't prompt to save on close if buffer is opened elsewhere
Only prompt to save when the buffer is dirty and the last
open session on it is being destroyed.
2013-01-17 17:25:52 -08:00
Kevin Sawicki
0ad71a6008 un-f RootView spec 2013-01-17 17:25:12 -08:00
Brian Lopez & Nathan Sobo
b82e9df5f5 Fix crash when deserializing a pane without a wrapped view 2013-01-17 16:30:09 -08:00
Kevin Sawicki
3a582eab63 Display editor's grammar name in status bar
Clicking on the grammar name displays the list of
available grammars that can be switched to.
2013-01-10 17:51:15 -08:00
Nathan Sobo
b0fe034c9a Add autoflow package w/ autoflow:reflow-paragraph command 2013-01-10 17:29:41 -07:00
Kevin Sawicki
d27080cee6 Always set pathToOpen in RootView.initialize
Without this an untitled buffer will be opened when
Atom is reopened after being closed with no editors
open.
2013-01-10 16:24:40 -08:00
Kevin Sawicki & Nathan Sobo
63dbc2f783 Remove double spies on native pasteboard methods 2013-01-10 15:33:30 -08:00
Kevin Sawicki & Nathan Sobo
4dc7ade4e6 Globally mock pasteboard read and write in specs 2013-01-10 11:41:07 -08:00
Corey Johnson
c3a2b99b69 Merge pull request #124 from github/auto-indent-config
Auto-indent config
2013-01-10 11:02:54 -08:00
Corey Johnson
ca41bf0709 Set auto-indent config defaults 2013-01-10 10:38:44 -08:00
Corey Johnson
d53572d54d Rename editor.autoIndentPastedText to editor.autoIndentOnPaste 2013-01-10 09:42:20 -08:00
Corey Johnson
d2521ca8b8 Set editor.autoIndent to false for tests
Auto-indenting makes it more difficult to write simple tests. So we turn it off.
2013-01-10 09:41:49 -08:00
Corey Johnson
4f0e2c1e9b Add editor.autoIndentPastedText config option 2013-01-10 09:31:57 -08:00
Corey Johnson
d55dfc8a6f AutoIndent is a config property instead of a syntax property 2013-01-10 09:31:23 -08:00
Kevin Sawicki & Nathan Sobo
bb6bed85c6 Raise exception when destroyed repo is accessed 2013-01-09 17:12:15 -08:00
Corey Johnson
21fa3e5a0f autoIndent is stored as a syntax property 2013-01-09 16:26:57 -08:00
Corey Johnson
f5ee676e5e Pass autoIndent as an option flag
Instead of querying EditSession for autoIndenting
2013-01-09 15:24:04 -08:00
Nathan Sobo
46331ded03 Merge remote-tracking branch 'origin/command-extensions' into dev
Conflicts:
	spec/app/editor-spec.coffee
	spec/app/root-view-spec.coffee
	src/app/editor.coffee
	src/extensions/strip-trailing-whitespace.coffee
2013-01-09 14:18:10 -07:00
Kevin Sawicki
ba614d5549 Throw error from GitRepository constructor 2013-01-09 11:53:13 -08:00
Corey Johnson & Nathan Sobo
c56788fd04 Catch packing loading exceptions in Package@load
Instead of in AtomPackage.load
2013-01-09 10:43:41 -08:00
Kevin Sawicki
8d0d62b486 Add Git.open that returns null on exceptions 2013-01-08 21:15:42 -08:00
Kevin Sawicki
6f5e29d48e Throw exception when repository fails to open
Removes need to check if the repository is valid before
each native API call and also removes calling into the
native-side if no repository can be opened for the project
page.
2013-01-08 21:15:41 -08:00
Corey Johnson
95dcf275e4 Remove *.getLastCursor() 2013-01-08 18:27:29 -08:00
Corey Johnson
f9e9b4203c *.getCursor() always returns last cursor (does not use index)
We weren't using the index functionality anywhere.
2013-01-08 18:27:29 -08:00
Kevin Sawicki
61600fcdf1 Reload grammar with edit session path changes 2013-01-08 17:12:08 -08:00
Kevin Sawicki
d9385888c8 Only update display when grammar changes 2013-01-08 16:54:51 -08:00
Kevin Sawicki
2b51a2ce73 Test firstLineRegex first when finding grammar
This is required for the property-list bundle to highlight
.plist files that maybe in XML or non-XML formats.

Also specify the cached buffer disk contents to grammarForFilePath
so fs.read doesn't need to be called again if the contents are
already read.
2013-01-08 16:15:38 -08:00
Corey Johnson & Kevin Sawicki
131708ba37 Serialize grammar overrides for paths 2013-01-08 15:24:14 -08:00
Corey Johnson & Kevin Sawicki
c67fbef2b2 Store grammar overrides on project 2013-01-08 14:39:32 -08:00
Kevin Sawicki
321d424c44 Support unsetting explicit grammar for path 2013-01-08 13:17:47 -08:00
Kevin Sawicki
3b47c26b4d Change an edit session's grammar on meta-l 2013-01-08 13:17:12 -08:00
Corey Johnson & Nathan Sobo
12794672b7 Merge branch 'objective-c-grammar' 2013-01-08 10:55:24 -08:00
Corey Johnson & Nathan Sobo
7372ae00cd Resolve $base includes correctly in TextMate grammars 2013-01-08 10:50:23 -08:00
Kevin Sawicki
7465ae5052 Close all editors in pane with meta-P 2013-01-08 09:06:20 -08:00
Kevin Sawicki
ebe7ff7090 Destroy inactive editor sessions that are dirty
A confirm dialog is now displayed whenever a session
with a dirty buffer is closed so dirty sessions can now
be processed when 'editor:close-other-tabs' is fired.
2013-01-07 16:50:20 -08:00
Kevin Sawicki
0adae3c634 Prompt to save dirty buffers from destroyEditSessionIndex
Previously only the active editor session was prompting to
save dirty buffers before closing.  This caused the confirm
dialog to not display when closing from a tab since the
Editor.destroyEditSessionIndex is used there.
2013-01-07 16:24:51 -08:00
Kevin Sawicki
5ded74b3e6 Close inactive editor sessions on alt-meta-w 2013-01-07 15:41:26 -08:00
Kevin Sawicki
b43c756820 Only deactivate the RootView once during shutdown
Previously window.shutdown() was called multiple times
if window.close() was called since the shutdown handler
was also fired in the native window controller.

This prevented proper serialization of the RootView
from occurring when then window was closed via meta-w or
meta-W since it was called a second time when already
empty of packages and editors.
2013-01-07 14:41:10 -08:00
Corey Johnson
255df32f4d spelling 2013-01-07 14:22:39 -08:00
Kevin Sawicki
88ff5cac29 Add spec for string characters before escape character 2013-01-07 14:22:39 -08:00
Kevin Sawicki
0f71848b2b Add spec for semicolon at end of line 2013-01-07 14:22:39 -08:00
Kevin Sawicki
15d7b2f159 Add failing spec 2013-01-07 14:22:39 -08:00
Kevin Sawicki
0e082878f3 Close window on meta-W 2013-01-07 13:41:27 -08:00
Kevin Sawicki
b4654ea435 Use buffer position when end of word isn't found
Previously if null was returned for the end of word position then
it was interpreted as 0,0 which would select the entire contents
before the current word instead of the current word.
2013-01-07 11:30:30 -08:00
Kevin Sawicki
bbdff31faf Lowercase current word/selection with meta-U 2013-01-07 09:37:51 -08:00
Kevin Sawicki
2a0ee62685 Uppercase current word/selection with meta-u 2013-01-07 09:37:51 -08:00
Kevin Sawicki
7e95bf96a5 Don't highlight ending line if it ends at column 0 2013-01-05 19:45:45 -08:00
Nathan Sobo
af3d3bf4cc 💩 Reset fs.write mock before test. 2013-01-04 18:08:52 -07:00
Nathan Sobo
0624ebaf5d Set config defaults for a package from its module's configDefaults 2013-01-04 17:23:24 -07:00
Nathan Sobo
d509093076 Don't write config defaults out to config.json 2013-01-04 17:08:25 -07:00
Nathan Sobo
8591c86733 Pass a name string to RootView.activatePackage & deactivatePackage
Previously we were relying on the package module itself to have a
`name` field. But now that we're using `atom.loadPackage` to load up
packages, we can infer the name of the module from the name of the
package directory.
2013-01-04 14:33:01 -07:00
Nathan Sobo
0a08d03c68 Rename Buffer, TokenizedBuffer, and Selection events 2013-01-04 13:59:11 -07:00
Kevin Sawicki & Nathan Sobo
96aaefdd7d Rename Project events to be past-tense 2013-01-04 13:46:27 -07:00