Commit Graph

104 Commits

Author SHA1 Message Date
Nathan Sobo
8e107359f3 Changes correctly update cursor position when there are folds 2012-02-24 22:08:34 -07:00
Nathan Sobo
0bc510ab58 Properly translate positions when wrapper and folder are composed
The key was in LineMap.linesForScreenRows. For each screen line, it
concatenates all line fragments (if there are indeed more than 1) that
traverse that line to return a single line fragment representing the
line. The key was to update the buffer delta for that fragment to
always be 1,0. Because the wrapper is treating the folder as if it's
the buffer, the lines it stores in its map need to traverse only a
single "buffer" line (that's a single line after folds are taken into
account). We may need better language than "screen" and "buffer"
because the wrapper treats the folder as the "buffer" but that's
confusing because it isn't.
2012-02-24 21:56:18 -07:00
Nathan Sobo
17205cae3f WIP: Working on position translation. Pretty broken right now.
The layered relationship between the line wrapper and the folder is
still not quite ironed out yet. The editor behaves pretty erratically
when text is folded.
2012-02-24 21:05:49 -07:00
Nathan Sobo
c8c7033550 Rename Cursor.set/getPosition to set/getScreenPosition
Now that buffer positions don't always line up with screen positions, it's important that it's clear which one we're talking about.
2012-02-24 11:53:18 -07:00
Nathan Sobo
dfcf4a1629 Alt-meta-f folds the current selection 2012-02-24 11:30:32 -07:00
Nathan Sobo
68d08acc1b Soft-wrap can be enabled before editor is attached to DOM. 2012-02-10 15:18:02 -07:00
Nathan Sobo
12a404fe5d Re-wrap lines when window size changes. 2012-02-10 13:14:17 -07:00
Nathan Sobo
90e019a4ac Merge branch 'softwrap' of github.com:github/atom into softwrap
Conflicts:
	spec/atom/editor-spec.coffee
2012-02-10 12:53:45 -07:00
Nathan Sobo
220deb88e9 Meta-alt-w toggles soft-wrap. Fix insert line element bug. 2012-02-10 12:52:12 -07:00
Corey Johnson
f5da211ad3 mouse clicks should correctly position the cursor on wrapped lines 2012-02-10 11:35:42 -08:00
Nathan Sobo
b70acf2006 Un-F 2012-02-10 11:39:31 -07:00
Nathan Sobo
80d42ddb46 Selections render correctly with wrapped lines. 2012-02-10 11:32:46 -07:00
Nathan Sobo
ea4f122e19 Editor handles changes to wrapped lines. 2012-02-10 11:15:57 -07:00
Nathan Sobo
9fef75cb5f All tests passing. Editor gets lines from LineWrapper.
Line wrapping still not fully functional. Need to fix many aspects of the LineWrapper integration.
2012-02-10 10:50:01 -07:00
Nathan Sobo
e24b5fbc24 Add LineWrapper.displayPositionFromBufferPosition 2012-02-08 12:30:46 -07:00
Nathan Sobo
bb72c839da Use LineWrapper to calculate pixelPositionFromPoint 2012-02-08 09:49:51 -07:00
Nathan Sobo
a16bc99249 WIP: Start on LineWrapper.displayPositionFromBufferPosition
It takes a row, column from the buffer and converts it to coordinates
that account for line wrapping.
2012-02-07 18:40:59 -07:00
Nathan Sobo
b21595f037 WIP: Add a LineWrapper object
Only passing specs are focused. Everything is still broken. Editor uses
the line wrapper to render lines, but the line wrapper isn't updating
on buffer change events yet. Still moving vertically and clipping
positions based on unwrapped lines as well.
2012-02-07 18:07:12 -07:00
Nathan Sobo
62470f61ab WIP: Wrap lines at token boundaries when soft wrap is on
This is still really rough... cursor positioning isn't working properly
yet. Nor does anything adjust when the window is resized.
2012-02-07 14:43:33 -07:00
Nathan Sobo
dd04475756 Shift-meta-z to redo. 2012-02-07 12:10:14 -07:00
Nathan Sobo
b3d1291643 Add UndoManager. Pressing meta-z undoes last change. 2012-02-07 11:22:19 -07:00
Nathan Sobo
6a963e8845 Merge remote-tracking branch 'origin/master'
Conflicts:
	src/atom/cursor.coffee
	src/atom/editor.coffee
	src/atom/selection.coffee
2012-02-06 12:37:26 -07:00
Nathan Sobo
64a97b9427 Use SpacePen for all views
SpacePen is better because its objects inherit directly from the jQuery
prototype, meaning you can create them with `new`.
2012-02-06 12:12:45 -07:00
Corey Johnson
88cf574bc6 Positioning the cursor beyond the bottom of the buffer will clip it to the last column of the last row 2012-02-03 16:07:54 -08:00
Corey Johnson
97aa3b6e82 Triple click works with selections made with moused dragging. 2012-02-03 13:33:22 -08:00
Corey Johnson
bbf892de96 Triple click selects line under cursor 2012-02-03 13:11:42 -08:00
Corey Johnson
2b6b4b1717 Make sure all specs are run 2012-02-03 10:03:02 -08:00
Corey Johnson
7c778d197e Text is selected when mouse is moved after double click 2012-02-03 09:55:10 -08:00
Nathan Sobo
37dc813a56 Backfill spec coverage for handling highlighter change events. 2012-02-03 10:39:13 -07:00
Corey Johnson & Nathan Sobo
ec6ed285b1 Merge branch 'editor' 2012-02-02 17:06:18 -07:00
Corey Johnson & Nathan Sobo
0120df540a Lines remain syntax-highlighted when they are updated. 2012-02-02 17:04:37 -07:00
Corey Johnson & Nathan Sobo
a62bd4b304 Double clicking selects a word. 2012-02-02 14:57:05 -08:00
Corey Johnson
c6c762ba23 Double mouse click selects word
The mousedown event on editor is causing this to fail right now.
2012-02-02 14:13:28 -08:00
Corey Johnson
d8975e7a94 SpecHelper has a method for getting pixel points from a row/column 2012-02-02 11:14:50 -08:00
Corey Johnson
d2a6eca8f3 meta-x removes text from buffer and places it on the clipboard 2012-02-02 09:35:18 -08:00
Corey Johnson
3c37c0ebeb Test the correct line 2012-02-01 18:13:22 -08:00
Corey Johnson
8882c060f1 e
spelling is hard, let's go shopping
2012-02-01 18:02:12 -08:00
Corey Johnson
86d23c775d meta-v inserts text at cursor position 2012-02-01 18:00:47 -08:00
Corey Johnson
16cfcd9396 Move the copy event test to editor, make selection test copy implementation 2012-02-01 17:46:22 -08:00
Nathan Sobo
77f227c7e9 WIP: Using ace tokenizer to break lines into tokens.
Breaks some specs because the highlighter doesn't update when the
buffer changes. Not loading the ace theme CSS yet, so you can't see any
colors yet either.
2012-01-31 21:59:58 -07:00
Nathan Sobo
677df675fb 💄 reorganize editor spec a bit 2012-01-31 20:57:43 -07:00
Nathan Sobo
a72dc17b87 Move hidden input to follow cursor to stop spurious scrolling
Commit 8e77c05c fixed scrolling *up* when clicking the buffer while
scrolled down. But it was still scrolling to the far left when typing /
clicking on a really long line. This commit solves both issues by
always positioning the hidden input to the same location as the cursor,
so it doesn't tell webkit to scroll away from the current focus when it
is focused or the user types.
2012-01-31 11:21:13 -07:00
Nathan Sobo
a77dd28e47 Fix bug: can now delete multiple lines
Before, we were traversing through lines to remove in ascending order
and then calling remove(n) for each. But when we removed line 10, line
11 became the *new* line 10. So when we removed line 11 we ended up
skipping the old line 11. I solved this by traversing in reverse when
we need to delete lines.
2012-01-28 22:05:35 -07:00
Nathan Sobo
1dd718f896 Can select text with the mouse 2012-01-28 17:00:59 -08:00
Nathan Sobo
6dad8c448a 💄 2012-01-28 15:58:59 -08:00
Nathan Sobo
3e5cef9672 Cursor can be re-positioned with the mouse 2012-01-28 15:54:01 -08:00
Nathan Sobo
cb3d97692e Auto-scroll horizontally after exceeding editor.hScrollMargin
Rename previous editor.scrollMargin to vScrollMargin to indicate it's
for vertical scrolling.
2012-01-27 18:42:20 -08:00
Corey Johnson & Nathan Sobo
900f745b65 Delete removes character in front of cursor. 2012-01-27 14:16:17 -08:00
Corey Johnson & Nathan Sobo
3b64b78336 Backspace with a selection only deletes the selected text 2012-01-27 13:48:20 -08:00
Corey Johnson & Nathan Sobo
29e7a6d774 Moving the cursor without holding shift clears selection 2012-01-27 12:42:33 -08:00