Commit Graph

532 Commits

Author SHA1 Message Date
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
Kevin Sawicki
472b436b24 Add spec for dragging/dropping tabs across editors 2013-02-11 20:24:01 -08:00
Kevin Sawicki
8b61c0d8f7 Rearrange tabs when the edit session order changes 2013-02-11 19:40:33 -08:00
Kevin Sawicki
a104e67acd Support moving an edit session's editor index 2013-02-11 18:36:50 -08:00
Justin Palmer
0acd532428 Add transferEditSessionAtIndex to Editor 2013-02-11 17:02:34 -08:00
Nathan Sobo
9c6b658fe5 Merge branch 'dev' into markers 2013-02-06 18:10:42 -07:00
Nathan Sobo
5b3755a170 Fix errors in benchmarks
One notable change is that if the editor has a display update pending,
we wait until it completes before moving on to the next benchmark.
2013-02-06 18:01:32 -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
Nathan Sobo
28c31dc2e1 Merge branch 'dev' into markers 2013-02-06 14:27:30 -07:00
Kevin Sawicki
57484d0756 Remove unused requires 2013-02-05 18:01:31 -08: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
8de45ccc21 Bind meta-D to duplicate line below
Refs #134
2013-02-05 12:16:50 -08:00
Justin Palmer
dd7835faf4 merge dev, fix conflicts 2013-02-05 08:18:59 -08:00
Kevin Sawicki
0270ba3e1c Add bracket matcher that highlights pair
(), {}, and [] pairs are now highlighted when
after or before the cursor
2013-02-04 18:09:20 -08:00
Justin Palmer
022b5fb88c use is-focused for the editor because it needs it's own state independent of the window state 2013-02-04 16:42:46 -08:00
Justin Palmer
f8855ef2e3 the editor has it's own blurred state independent of the window 2013-02-04 16:20:07 -08:00
Justin Palmer
53bf6f5341 tag blurred state instead of focused state 2013-02-04 15:55:14 -08:00
Nathan Sobo
abafb541df Merge remote-tracking branch 'origin/dev' into better-anchors 2013-02-02 16:47:09 -07:00
Nathan Sobo
5e56206fcc This never should have been checked in. 2013-02-02 15:00:54 -07:00
Jon Rohan
0d2a328dcc making the editor .focused .is-focused for symmetry 2013-02-01 19:23:52 -05: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
2df0b9fa19 WIP: Start converting cursor and selection to be based on markers 2013-01-30 22:47:29 -07:00
Nathan Sobo
fd99c795b9 Merge remote-tracking branch 'origin/dev' into better-anchors 2013-01-30 20:45:31 -07:00
Corey Johnson
4e7b1888b4 include ' in editor.nonWordCharacters 2013-01-30 16:04:29 -08:00
Corey Johnson
c650deea01 Merge branch 'font-config' into dev 2013-01-30 13:24:12 -08:00