Commit Graph

514 Commits

Author SHA1 Message Date
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
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
Corey Johnson
129b574df4 Remove lineHeight config option and rename @rowHeight back to @lineHeight 2013-01-30 09:59:53 -08:00
Justin Palmer
f138a29a87 add config option for line height
This renames the original lineHeight variable to rowHeight to avoid
collision
2013-01-30 09:59:53 -08:00
Justin Palmer
a83460452e add config option for setting the font family 2013-01-30 09:59:53 -08:00
Corey Johnson
a34b9296e9 Escape \ in editor.nonWordCharachters 2013-01-29 17:14:10 -08:00
Corey Johnson
c32836ad2c _ and - both considered non word characters. Fixes #82
Maybe @defunkt wanted the reverse though (consider _ and - word characters)? Either way, it's a config option you can change now.
2013-01-29 17:10:27 -08:00
Corey Johnson
167b9c28fa Rename wordSeparators to nonWordCharacters 2013-01-29 17:06:39 -08:00
Corey Johnson
b66efbe3e7 cursor.getBeginningOfCurrentWordBufferPosition behaves like vim 2013-01-29 16:57:22 -08:00
Corey Johnson & Kevin Sawicki
1d2fa089e5 editor.wordRegex is now a config option. 2013-01-29 16:57:22 -08: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
Jon Rohan
298d50b61e changing the space invisible to 00b7 'middot' 2013-01-29 14:38:01 -05: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