Nathan Sobo
1cab51cefa
RootView can no longer be focused.
...
Allowing root view to be focused was stealing focus away from the
editor whenever a click event made it to the root view. This unnecessary
switching of focus was interfering with the ability to drag tabs.
But if RootView can't be focused, focus ends up being returned to the
document body when there are no focusable elements. This would be fine,
except for the fact that we frequently bind global events on root view,
and so they aren't triggered when events are triggered on the body. We
could just bind all global events on the body, but this would require
us to always attach elements to the DOM during specs, which is a serious
performance killer in specs.
The workaround is in the keymap. When the keymap handles a key event
that was triggered on the body, it triggers the corresponding semantic
event on the root view anyway, so from the event perspective, it's as
if the root view actually had focus. The only place this might fall
down is if someone wants to capture raw key events. But that's the
keymap's job anyway, and we maybe add a hook on the keymap if such a
need ever arises.
2013-02-08 17:33:37 -07:00
Nathan Sobo
4fdb1c454e
Restore marker cleanup assertions
...
Now that EditSessions clean up their markers, we can pass these tests
again.
2013-02-06 17:29:08 -07:00
Nathan Sobo
0bd98bf8f8
Do a better job cleaning up after Editors and EditSessions
...
- EditSessions destroy their Selections when they are destroyed
- Editors destroy their EditSessions when they are destroyed
- Editors unsubscribe from the document and window when they are
removed from the DOM.
- When an EditSession is destroyed via any code path, the Editor with
that EditSession removes it.
- Selections no longer trigger 'destroyed' events if their parent
EditSession has already been destroyed.
These are all really intertwined, so I'm doing them as one commit
since that was the only way to keep the specs green.
2013-02-06 16:54:19 -07:00
Kevin Sawicki & Nathan Sobo
59d0742c17
Remove Anchor and AnchorRange. They're fully replaced by markers.
...
We're still leaking markers for selections and cursors. We need to
clean that up before merging.
2013-02-05 18:15:48 -07:00
Kevin Sawicki & Nathan Sobo
13183639b6
Ensure the cursor becomes visible when the selection is emptied
...
(Even if the cursor doesn't move)
2013-02-05 17:06:56 -07:00
Kevin Sawicki & Nathan Sobo
85111748ec
Reset spy in spec before making next assertion
2013-02-05 16:34:36 -07:00
Kevin Sawicki & Nathan Sobo
5a1de9fa44
Add specs for truthiness of marker position assignment return values
2013-02-05 16:33:59 -07:00
Kevin Sawicki & Nathan Sobo
75e040b73b
Merge remote-tracking branch 'origin/dev' into markers
...
Conflicts:
src/app/editor.coffee
2013-02-05 16:07:05 -07:00
Kevin Sawicki & Nathan Sobo
94d1edcc06
Add EditSession.selectMarker
2013-02-05 15:54:20 -07:00
Kevin Sawicki & Nathan Sobo
c893f0c338
Add Buffer.markersForPosition and coerce marker ids to strings
2013-02-05 15:50:54 -07:00
Kevin Sawicki & Nathan Sobo
240e893d33
Don't emit a cursor-moved event when only the tail of the marker moves
2013-02-05 15:19:10 -07:00
Kevin Sawicki
3e84e9886c
Break out event handler setup into separate method
...
This mirrors the keymap setup method and allows specs
to reattach handlers after calling shutdown()
2013-02-05 13:17:53 -08:00
Kevin Sawicki
ba811c4119
Un-f a window spec
2013-02-05 12:59:26 -08:00
Justin Palmer
8512bee6c9
merge dev, fix conflicts
2013-02-05 12:42:44 -08:00
Nathan Sobo
1d30605f7f
Convert selection and cursor fully over to markers.
2013-02-05 13:39:00 -07:00
Kevin Sawicki
8de45ccc21
Bind meta-D to duplicate line below
...
Refs #134
2013-02-05 12:16:50 -08:00
Kevin Sawicki
ad3c18077c
Compare against EOF position when clipping
...
Previously the column could potentially be set to
zero since a Math.min comparison was used for the
length of an already adjusted row.
2013-02-05 12:08:17 -08:00
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
Kevin Sawicki
cd07ec841d
Add more window globals and shims in task shell
...
This allows jQuery to be successfully loaded from a web worker
since it does not have a document or window object by default.
Previously it would log about missing methods and properties.
Closes #228
2013-02-04 11:43:58 -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
Kevin Sawicki
84feaf369d
Format undefined array values as null
2013-02-04 09:08:00 -08:00
Kevin Sawicki
f65e83fe2a
Add spec for converting CSON back to object
2013-02-04 09:08:00 -08:00
Kevin Sawicki
ffc65b3735
Add more CSON specs
2013-02-04 09:08:00 -08: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
e25d83ccbc
Use new addEqualityTester method to employ _.isEqual in specs
2013-02-02 17:58:39 -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
fa940d0386
Merge pull request #168 from github/window-focused
...
Atom Window Focused
2013-02-01 17:50:28 -08:00
Jon Rohan
0d2a328dcc
making the editor .focused .is-focused for symmetry
2013-02-01 19:23:52 -05:00
Kevin Sawicki
69097bee50
Kill trailing newline and inline empty arrays
2013-02-01 16:20:25 -08:00