Commit Graph

557 Commits

Author SHA1 Message Date
Corey Johnson & Nathan Sobo
c3456dd5ac Remove serialization methods from editor 2013-03-07 09:30:30 -08:00
Nathan Sobo
f2e5fcc902 Move autosave from editor into panes 2013-03-07 09:30:29 -08:00
Nathan Sobo
fff5d5158f Pass items through in editor's pane-splitting convenience methods 2013-03-07 09:30:28 -08:00
Nathan Sobo
685df18a3a Fix breakages due to save method moving to Pane (except saveAll specs) 2013-03-07 09:30:28 -08:00
Nathan Sobo
3f9ee08e76 Handle save-as on pane. Replace 'editor:save-as' w/ 'core:save-as'
Pane will only show the saveAs dialog if the item has a `saveAs` method.
2013-03-07 09:30:28 -08:00
Nathan Sobo
699e780e99 Handle save in panes with new 'core:save' event 2013-03-07 09:30:28 -08:00
Nathan Sobo
9f7b804a6c Panes prompt to save modified items before destroying them 2013-03-07 09:30:27 -08:00
Corey Johnson & Nathan Sobo
5d9e20afa4 Make Editor.getPath return null if edit session is null 2013-03-07 09:30:27 -08:00
Corey Johnson & Nathan Sobo
15144514bb Don't update editor's display if its edit session is null or destroyed 2013-03-07 09:30:27 -08:00
Corey Johnson & Nathan Sobo
c1e226d6a3 Kill unused event 2013-03-07 09:30:26 -08:00
Corey Johnson & Nathan Sobo
3bf31e440d Remove code for setting the active editor from root view
Supplanted by "active pane"
2013-03-07 09:30:26 -08:00
Nathan Sobo
2bfc73afaa These should have been renamed w/ currentView/Item -> activeView/Item 2013-03-07 09:30:25 -08:00
Nathan Sobo
fab3b4564e Add Pane.moveItemToPane specs. Fix bug moving the last edit session. 2013-03-07 09:30:25 -08:00
Nathan Sobo
fe0d3cad36 Remove multiple edit session handling from Editor 2013-03-07 09:30:25 -08:00
Kevin Sawicki & Nathan Sobo
062adae714 Return the new pane's currentView when splitting the editor 2013-03-07 09:30:23 -08:00
Kevin Sawicki & Nathan Sobo
75229808de Add Editor.getModel 2013-03-07 09:30:22 -08:00
Nathan Sobo
8f980a0f20 Replace Editor's next/previous edit session bindings w/ pane bindings 2013-03-07 09:28:52 -08:00
Nathan Sobo
7d147dd2ce Make Pane handle split commands instead of Editor 2013-03-07 09:28:52 -08:00
Nathan Sobo
45eec6a8ff Get more specs passing. Failing specs due to missing features. 2013-03-07 09:28:52 -08:00
Nathan Sobo
62729c42ee Panes destroy their items when they are removed
As a consequence of these changes, editors will no longer need to
listen for destruction of their edit sessions. An editor will
eventually only ever be displaying a single edit session, and the
editor will destroy that edit session when it is removed. Panes
will be responsible for supporting multiple edit sessions, and
they will automatically remove the editor when they have no more
edit session items.
2013-03-07 09:28:51 -08:00
Nathan Sobo
372393d9ca Allow panes to have model objects as items in addition to views
The problem I've been struggling with is that we need to potentially 
assign tabs both to EditSessions and also to other views added by
extensions, like a markdown preview view. EditSessions are however not
actually views… instead they plug into editors. The solution is to
have the pane ask a model object what view should be used to render
it. When asked to show a non-view item, the pane constructs and
appends a view for that item or recycles an appropriate view that it
has already appended.
2013-03-07 09:28:51 -08:00
Corey Johnson
057ccf7157 Add - to nonWordCharacters 2013-02-28 09:45:19 -08:00
Corey Johnson
44680ad50c Revert "💄"
This reverts commit c2c4d03c2d.
2013-02-27 10:11:02 -08:00
Corey Johnson
c2c4d03c2d 💄 2013-02-27 08:51:51 -08:00
Kevin Sawicki & Nathan Sobo
5da5bf94b6 Add 'editor:save-debug-snapshot' command. Closes #191.
This saves the state of the rendered lines, the display buffer, the
tokenized buffer, and the buffer to a file. If a problem arises with
rendering, hopefully we can use it to diagnose in which layer things
went awry.
2013-02-22 14:28:04 -07:00
Corey Johnson
aa84256774 - and _ are not considered word characters by default.
Fixes #297
2013-02-21 13:41:21 -08:00
Kevin Sawicki
2b002e0ef9 Use Range.getClientRects() to find mouse event column
Previously document.caretFromRange() was used which
required hiding and showing the overlayer which would
cause a relayout and entire repaint of the editor area.

Now the text nodes on the selected row are iterated over
until the column corresponding to the event's pageX value
is found.

Closes #290
2013-02-21 12:33:04 -08:00
Kevin Sawicki
2457e7f5b2 Add indent guide to whitespace lines
The whitespace in lines that have no non-whitespace
text is treated as trailing whitespace so add the
indent guide to the trailing whitespace tokens when the
line is 100% whitespace.
2013-02-20 15:40:44 -08:00
Kevin Sawicki
af58c1e83f Bind meta-shift-enter to insert newline above current line
Closes #292
2013-02-20 13:44:30 -08:00
Kevin Sawicki
27f44fbfd7 Invalidate empty lines proceeding a change event
The indent guide on empty lines will now be updated when
the non-empty line preceeding the empty lines is updated.
2013-02-20 12:20:15 -08:00
Kevin Sawicki
101b1aba12 Add indent guide to editor
The guide displays a continuous vertical line across lines with
the same indent levels.

Closes #50
2013-02-20 12:20:15 -08:00
Kevin Sawicki
d27bbee37d Support selecting editor lines from the gutter
Mouse events that occur in the gutter are forwarded to the
rendered lines with the y-coordinate translated to be the
leftmost pixel of the editor to simulate the event originating
from column 0 of the current line row.

Closes #287
2013-02-19 18:16:29 -08:00
Corey Johnson & Nathan Sobo
0b5ea8578f Eliminate rootView.project references. 2013-02-19 18:26:50 -07:00
Nathan Sobo
7bdd51b456 Rename deserializeView to deserialize
In additional, rename `registerViewClass(es)` to `registerDeserializer(s)`.
This moves us to a situation where any kind of object may want to be
deserialized, not just views.
2013-02-19 09:48:40 -07:00
Kevin Sawicki
2910f7798a Always use global rootView object
This removes the last few places where rootView was
looked up via jQuery selector and instead just uses
the rootView property available on the window.
2013-02-15 09:56:03 -08:00
Nathan Sobo
2f71ee9a0d Prevent clicks on a focused editor from unfocusing its hidden input
This closes #233. When an editor is focused, what's *actually* focused
is a hidden input element inside the editor. So clicking on a focused
editor was temporarily stealing focus away from the hidden input, and
then moving it back to the hidden input (which the editor always does
when it is focused). Returning false from the mousedown handler when
the editor is already focused prevents this bouncing of focus and
prevents the fuzzy finder from hiding when you click its editor.
2013-02-14 13:38:46 -07:00
Kevin Sawicki
15c02014f7 💄 2013-02-14 12:27:46 -08:00
Corey Johnson & Nathan Sobo
52cbf5e367 Correctly translate clicks to screen positions w/ var-width fonts
Closes #267
2013-02-14 12:04:18 -07:00
Nathan Sobo
e7fb13037a 💄 2013-02-12 17:09:06 -07:00
Nathan Sobo
3ab354d426 Recycle existing lines when calculating pixel positions 2013-02-12 17:09:06 -07:00
Nathan Sobo
2d2b4ea754 Redraw on reattached only if detached editor was previously attached 2013-02-12 17:09:05 -07:00
Nathan Sobo
498c11a080 Don't translate screen to pixel positions if Editor isn't on the DOM 2013-02-12 17:07:14 -07:00
Nathan Sobo
97988eb62e Clear font style in afterEach so it doesn't cause test pollution 2013-02-12 17:07:14 -07:00
Nathan Sobo
405a918280 Never redraw when the font size changes on a detached editor
When the font size changes and the editor is detached, it schedules
itself to be redrawn the next time we're reattached rather than
updating the display in a detached state.

Detached display updates worked in the past because we didn't need to
be on the DOM to determine horizontal and vertical positions once we
had calculated dimensions once. So it worked to temporarily attach
the editor when calculating new dimensions, and then continue updates
even when it was detached. That now breaks because we can't ask for
pixel positions if we aren't on the DOM.
2013-02-12 17:07:14 -07:00
Nathan Sobo
81145eb35f Initial support for variable width fonts
When translating a logical screen position (columns/rows) to a pixel
position, the editor now builds a temporary version of the line for the
given row. It then uses the DOM range API to insert an empty range
at the correct text node and offset for the given column and determines
the left position based on its clientRect.

Depending on the speed impact, we may want to optimize this by
recycling the existing line node if it exists on screen rather than
building a new one every time. We will still have to build one if the
line we're moving to isn't on screen yet. We could also increase the
chances of the line being on screen by autoscrolling to the vertical
position first, and *then* calculating the horizontal position. Lots
to explore here.
2013-02-12 17:07:14 -07:00
Kevin Sawicki
37ff0d05ed Subscribe to grammars-loaded event in editor
Previously an error would be logged if this event fired
after an editor had been removed.
2013-02-12 15:12:59 -08:00
Kevin Sawicki
d234c8fdce Don't track closed sessions with no path 2013-02-12 11:20:21 -08:00
Kevin Sawicki
5ecbda0aac Restore closed tab at previous index 2013-02-12 09:41:32 -08:00
Jon Rohan
c43a1e5ce5 Undo last closed tab 2013-02-12 08:56:39 -08:00
Kevin Sawicki
c9fae85375 Rename moveEditSessionAtIndex to moveEditSessionToIndex 2013-02-11 20:29:48 -08:00