Commit Graph

165 Commits

Author SHA1 Message Date
Danny Greg & Nathan Sobo
7d0c5ff2f0 Merge branch 'master' into editor 2012-01-19 16:47:12 -08:00
Danny Greg & Nathan Sobo
5e41f82985 Add a raw call to builder. 2012-01-19 16:46:32 -08:00
Danny Greg & Nathan Sobo
597e4c54b2 Merge branch 'master' into editor 2012-01-19 16:37:58 -08:00
Danny Greg & Nathan Sobo
660beb9f65 Text inside of tags is HTML escaped. 2012-01-19 16:36:32 -08:00
Danny Greg & Nathan Sobo
030e241c75 Don't spill out of document when moving right and left 2012-01-19 15:40:26 -08:00
Danny Greg & Nathan Sobo
a606fe55b3 Keep cursor inside the lines when moving. 2012-01-19 14:39:16 -08:00
Danny Greg & Nathan Sobo
cd127c009e Cursor can move around screen
Still not handling corner cases like moving off the edge of screen,
line, etc.
2012-01-17 18:13:50 -08:00
Nathan Sobo
5198a88cce Half-baked: Have a lines reasonably looking cursor working.
A bunch of tests are failing but you can load a buffer and display its
lines.
2012-01-16 22:11:38 -08:00
Nathan Sobo
4274ff4a81 Merge branch 'master' into editor 2012-01-16 21:28:31 -08:00
Nathan Sobo
ba2ed50e87 Also trigger 'attach' on subviews when parent view is attached. 2012-01-16 21:28:18 -08:00
Nathan Sobo
a051e452ea Merge branch 'master' into editor 2012-01-16 21:17:51 -08:00
Nathan Sobo
5dbdd92e6c When views are attached to dom, trigger 'attach' events
Added this mechanism by augmenting jQuery dom mutation methods. It will
only trigger an event if the element has a truthy value for the
'triggerAttach' data entry. This will allow us to execute actions that
require the view to be physically on the dom at the appropriate time.
2012-01-16 21:15:57 -08:00
Nathan Sobo
bde3a9f5f5 Use requireStylesheet for editor stylesheet. 2012-01-16 20:17:07 -08:00
Nathan Sobo
1a16a755b4 Merge branch 'master' into editor
Conflicts:
	spec/spec-helper.coffee
2012-01-16 20:04:50 -08:00
Nathan Sobo
f4aa8daa52 Add window.requireStylesheet
This allows you to synchronously load a stylesheet into the document's
head whenever it is needed.
2012-01-16 20:03:48 -08:00
Nathan Sobo
7d7b119927 WIP 2012-01-16 19:23:27 -08:00
Nathan Sobo
07a51fb310 Displaying lines and a basic cursor 2012-01-16 17:17:36 -08:00
Nathan Sobo
83cfe70962 Rename Editor.get/setCursor to get/setPosition
This makes it more consistent with selectoToPosition. Also... you
weren't getting the cursor. The cursor is a thing on the screen. At the
very least getCursor should return an object you can move around, not
just a row/column struct. Position seems like a better name.
2012-01-14 00:36:15 -08:00
Nathan Sobo
d1869516fd Implement d3w
NumericPrefix now has a .select() method that calls select multiple
times on its operand. Editor.selectToPosition modified to extend
existing selections, and only create a new one if needed. This allows
repetition of a motion's select method to expand the selection.
2012-01-14 00:31:11 -08:00
Nathan Sobo
91cc9cc9a4 Implement dw (delete to beginning of next word)
The w motion has a .select() method. When d composes with a motion it
calls select() on it and then deletes the selected text.
2012-01-14 00:10:34 -08:00
Nathan Sobo
d94d387101 Cover other next word cases.
Now it moves to words on the next line and also to the next empty line.
2012-01-13 19:47:09 -08:00
Nathan Sobo
1809ba4ef1 💄 2012-01-13 19:18:13 -08:00
Nathan Sobo
7546ddc8cc 'w' moves to next word (not fully functional for multi-line) 2012-01-13 19:18:13 -08:00
Corey Johnson & Nathan Sobo
b2648723de dd deletes an entire line 2012-01-13 17:38:33 -08:00
Nathan Sobo
712475569d Can enter multi-digit numeric prefixes in command mode. 2012-01-13 14:49:25 -08:00
Nathan Sobo
b4886bb6d6 In vim command-mode, only eat insertion keys, not other modifiers 2012-01-13 14:23:58 -08:00
Nathan Sobo
13d7f93dd9 GlobalKeyMap adds a 'keystroke' string to events
The keystroke is a string representation of the event... like
"alt-ctrl-x" or "q"
2012-01-13 14:03:22 -08:00
Corey Johnson & Nathan Sobo
fd48c67bfa Add App.bindKey 2012-01-13 12:06:52 -08:00
Corey Johnson & Nathan Sobo
ca2b7c9fd1 Add MoveUp command to VimMode 2012-01-13 10:57:08 -08:00
Corey Johnson & Nathan Sobo
d3d832a740 Add h (move left) monvment to vimMode. 2012-01-13 10:44:51 -08:00
Nathan Sobo
86d7a91dcd 💄 2012-01-12 17:56:49 -08:00
Nathan Sobo
a2cf77892d Don't insert characters in vim command mode
GlobalKeymap.bindKey can take a selector and a custom function that
maps key events to commands. If it returns false, no command is
triggered but event propagation is halted.
2012-01-12 17:51:23 -08:00
Nathan Sobo
ee068a4b84 GlobalKeymap favor most recently declared bindings in case of tie
Just like in CSS, when multiple equally-specific selectors match an
element, we favor the most recently declared one, so keybindings
cascade.
2012-01-12 16:35:10 -08:00
Nathan Sobo
2c2423f985 Single-digit numeric prefixes can repeat commands in vim-mode
Vim mode has an operator stack. Every time an operator is pushed to the
stack, we ask if it is complete. If it's complete, we compose it with
the operator below it, then pop that operator if its complete. When no
operators remain on the stack, we call execute the final composed
operator. So far we only have DeleteChar (x) and NumericPrefix
operators.
2012-01-11 22:02:47 -08:00
Nathan Sobo
671d862441 💄 2012-01-11 20:21:38 -08:00
Corey Johnson & Nathan Sobo
8471270add Vim mode supports command mode and insert mode with i, esc, and x bindings 2012-01-11 15:00:40 -08:00
Corey Johnson & Nathan Sobo
17ad7a26e7 Ensure focus returns to the editor when file finder closes.
We just capture focusout events on root view… if anything other than the editors text area lost focus, we focus the editor again. This will likely need refinement when we add more widgets to the system, but its enough to make the fuzzy finder behave appropriately.
2012-01-11 13:16:11 -08:00
Corey Johnson & Nathan Sobo
83a68dbbb0 GlobalKeymap.handleKeyEvent does not stop event propagation if no binding matches. 2012-01-11 13:16:11 -08:00
Corey Johnson & Nathan Sobo
278ac6a9f2 Remove bindKey from views. Make FileFinder use atom.bindKeys 2012-01-11 13:16:11 -08:00
Corey Johnson & Nathan Sobo
1aa99c379f Move GlobalKeymap instance to App. Clear bindings between examples. 2012-01-11 13:16:11 -08:00
Corey Johnson & Nathan Sobo
e58f699681 Remove KeyBinder and CommandMap. 2012-01-11 13:16:11 -08:00
Nathan Sobo
2a80a72d64 Bind keydown on root view to catch events that aren't handled by ace
Also fixed a bug where the GlobalKeymap wasn't returning true when it
matched a binding, which caused key events to be processed twice when
they bubbled out of the editor and hit the root view.
2012-01-11 13:16:11 -08:00
Nathan Sobo
7f4120ce36 Toggle file-finder with a new CSS-style keybinding
Still doesn't hide when the text field is focused because we need to
handle key events that didn't emerge from Ace. That's next.
2012-01-11 13:16:11 -08:00
Nathan Sobo
51736e7695 Call window.close when window receives the 'close' event.
The RootView binds meta-w to the 'close' event.
2012-01-11 13:16:11 -08:00
Nathan Sobo
783e9446e9 Fix bug: Don't call handleKeyEvent with undefined event
Ace triggers key handlers for both keydown (onCommandKey) and input
(onTextInput) events. Input events don't pass the event, which was
blowing up the keymap.
2012-01-11 13:16:11 -08:00
Corey Johnson & Nathan Sobo
0346671d18 💄 2012-01-11 13:16:11 -08:00
Corey Johnson & Nathan Sobo
4e7b1b8979 Meta-s triggers save event with the new css-based keymap. 2012-01-11 13:16:10 -08:00
Corey Johnson & Nathan Sobo
6a25dc00c5 Add BindingSetSpec and change keybinding pattern separator.
Also, we allow chorded bindings to be surrounded in <…> in preparation of key sequences.
2012-01-11 13:16:10 -08:00
Corey Johnson & Nathan Sobo
11866b90fe Rename KeyEventHandler to GlobalKeymap 2012-01-11 13:16:10 -08:00
Corey Johnson & Nathan Sobo
e9c0b9903d Test that global key bindings defined on root view work in the editor. 2012-01-11 13:16:10 -08:00