Commit Graph

182 Commits

Author SHA1 Message Date
Max Brunsfeld
e14aa842ff Move auto-indent code to TokenizedBuffer, 🔥 LanguageMode 2017-09-22 16:44:21 -07:00
Matthew Dapena-Tretter
863faffd23 Only expect a single 'did-destroy' event
These events will only be fired a single time at most, so we should clean up the listeners after that.

This should help minimize accidental memory leaks.
2017-06-27 16:20:33 -07:00
Nathan Sobo
8aae3ab1ae Hide cursors with non-empty selection if showCursorsOnSelection is false
Also, remove some barely used public APIs around cursor visibility that
don't make much sense and are not ideal for performance. We don't want
to subscribe to the visibility of each cursor.
2017-05-05 09:29:28 +02:00
Nathan Sobo
f4c45c1e39 Rename stable: true to avoidOverlay: false and fix tests
As part of the test fixes, I’m honoring the `autoscroll: false` option
in `insertText` and `insertNewline` to avoid inadvertently scrolling the
editor during tests when the editor is modified.
2016-11-28 12:45:05 -07:00
Antonio Scandurra
18ddcf902b Statically assign a clipboard instance to the TextEditor class 2016-10-07 18:21:09 +02:00
Indrek Ardel
55f3311c01 Remove unused variables 2016-09-26 20:52:13 +03:00
Mihail Bodrov
d602655708 replace _.extend in favore of Object.assign 2016-05-20 01:27:27 +03:00
Antonio Scandurra
f2a497d591 Don't create folds for empty ranges 2016-04-28 13:43:00 +02:00
Nathan Sobo
3bbeb9e680 Merge remote-tracking branch 'origin/master' into ns-switch-to-display-layers 2016-04-19 15:30:00 -06:00
Michelle Tilley
b2aad098e1 Correctly autoindent \r\n in Selection#insertText 2016-04-18 11:06:51 -07:00
Michelle Tilley
e41b9f00fb Correctly autoindent single newline in Selection#insertText 2016-04-15 21:23:28 -07:00
Antonio Scandurra
fd483cb918 Fix deprecation 2016-04-15 17:45:04 +02:00
Antonio Scandurra
e236b8c3be Avoid storing properties in selection markers
Previously we were storing a {type: ‘selection’} property, probably
leftover from the “pre-marker-layer” world. We were also storing
`Selection`’s `goalScreenRange` on the marker, which is now just an 
instance variable.
2016-04-06 20:00:08 +02:00
Antonio Scandurra
3ec1027d5c Remove clipDirection parameter in a call to cursor.setBufferPosition
We aren’t clipping in that code path, so we might as well avoid to pass
the parameter.
2016-04-06 14:38:53 +02:00
Antonio Scandurra
66b9383c4e Use clipDirection instead of the clip option 2016-04-06 14:20:27 +02:00
Antonio Scandurra
a8d6a0036d Don’t unfold buffer rows when editing 2016-03-24 13:40:24 +01:00
Michelle Tilley
64308bbacb Revert "Revert "Allow pasting white space when autoIndentOnPaste is enabled""
This reverts commit 5c03894227.
2016-03-21 16:27:48 -07:00
Michelle Tilley
5c03894227 Revert "Allow pasting white space when autoIndentOnPaste is enabled"
This reverts commit 0088053de4.
2016-03-20 22:22:33 -07:00
Antonio Scandurra
d86309e46b Use DisplayLayer.prototype.foldBufferRange in Selection.prototype.fold 2016-03-18 11:33:29 +01:00
Antonio Scandurra
dfed7c4537 Merge branch 'master' into ns-use-display-layers
# Conflicts:
#	package.json
#	src/display-buffer.coffee
#	src/text-editor.coffee
#	src/tokenized-buffer.coffee
2016-03-10 13:53:14 +01:00
Nathan Sobo
a55ad00ac1 Fix option pass-through in Selection:: and Cursor::autoscroll 2016-02-29 18:51:12 -07:00
Katrina Uychaco
0088053de4 Allow pasting white space when autoIndentOnPaste is enabled 2016-02-17 20:35:06 -08:00
Antonio Scandurra
6a32a874e9 🐎 Compare markers instead of ranges in Selection
This largely reduces the overhead of converting ranges and points from native to
javascript objects.
2016-02-17 16:09:14 +01:00
Nathan Sobo
972fda4ef7 Start using DisplayLayer for folds 2016-01-13 12:17:01 -07:00
Antonio Scandurra
b5fc710f15 Don't use atom.clipboard global in Selection 2015-10-07 15:25:05 -05:00
Nathan Sobo
32ec6b5321 🔥 Remove deprecations from Selection 2015-09-22 10:37:14 -06:00
Ivan Zuzak
7e1a295f07 Add method for cutting text to the end of the buffer line 2015-09-17 19:34:53 +02:00
Nathan Sobo
3ca11c2cef 🎨 select-line adjustments; Only select single row if row is given 2015-09-03 08:25:24 -06:00
jc roy
361ef308e2 SelectLine : When multiple line selected, complete both first and last line. 2015-09-02 20:03:18 -04:00
Nathan Sobo
698e414bfb Update selection and cursor state atomically before emitting any events
This ensures we correctly restore the last cursor when handling a cursor
destruction event. It fixes an exception that occurred when undoing
after splitting an editor.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
2015-09-02 12:20:30 -06:00
Nathan Sobo
567199a3d2 Autoscroll the editor as a quadratic function of mouse cursor overshoot
This was a spike and still needs tests, but it’s going to be way better.
2015-08-28 12:17:59 -06:00
Nathan Sobo
12dc045329 Fix bug where word- and line-wise selections got stuck in reversed state 2015-07-29 11:49:14 -06:00
Nathan Sobo
d1dec4e0cf Don’t autoscroll to selection when double- or triple-click dragging 2015-07-28 16:16:34 -06:00
Sander van Harmelen
eaf814e5be Improve auto indenting by removing a hard coded restriction and adding a 3rd regexp
Currently there are only two regexps that can influence the indents.
Those are `increaseIndentPattern` (which tells Atom the indent of next
line should be increased) and `decreaseIndentPattern` (which tells Atom
the indent of the current line should be decreased).

But I found that a couple of languages would need a 3rd regexp in order
to support their use cases. This 3rd regexp should be a mixture of the
existing two so it tells Atom that the indent of the next line should
decrease.

I’ll add a screencast to show a use case for this 3rd regexp which I
would like to call `decreaseNextIndentPattern`.
2015-07-08 20:30:21 +02:00
Nathan Sobo
e472830063 Merge remote-tracking branch 'origin/master' into dsandstrom-add-subword-cursors-4 2015-06-30 22:55:40 -05:00
Nathan Sobo
83bddaf34e Merge branch 'master' into add-subword-cursors-4
Conflicts:
	spec/text-editor-spec.coffee
2015-06-30 15:43:33 -05:00
Nathan Sobo
82e25872b2 Handle indentation with mixed tabs and spaces 2015-06-30 15:31:11 -05:00
Nathan Sobo
b6d099ac78 Consider tabs or spaces mutually exclusively as indentation
Previously, we allowed a mix of tabs and spaces to be counted toward the
indentation of a line. This caused problems when auto-indenting lines in
a hard-tabbed file that contained “alignment spaces”, such as occurs in
aligned comment blocks. For this case, it makes more sense to assume
that the line is indented via tabs only, and consider the subsequent
alignment space as part of the line’s content. Since it’s hard to
imagine actual source code in which a mixed treatment of tabs and spaces
is desirable, I’m going with this over any more complex approach.
2015-06-29 17:05:28 -05:00
Max Brunsfeld
3cdeaa8b51 Don't auto-indent when pasting text w/ no line breaks 2015-06-17 10:57:21 -07:00
herkyl
b3687265bb Fixed 'setBufferRange' documentation parameter name 2015-06-11 10:37:38 +03:00
Lee Dohm
70a8b54e50 Delete bad merge artifacts and reword docs 2015-04-29 18:27:09 -07:00
CaptSaltyJack
a8283c3c9b Added delete-to-next/previous-word-boundary
This is better behavior for alt-del/backspace operations, is less
"greedy" and doesn't eat up excess characters.
Also set default key mappings to these, feel free to trash my changes
to keymaps/darwin.cson. Though I do feel this should be default
behavior, personally.
2015-04-29 16:31:07 -07:00
Machiste Quintana
5d2392ea67 👕 Fix new coffeelint errors 2015-04-06 23:59:54 -04:00
Kevin Sawicki
7d592c8b78 includeDeprecations -> includeDeprecatedAPIs 2015-04-03 11:29:16 -07:00
Kevin Sawicki
82c39a5af9 Use lighter Model in cursor, selection, and project 2015-04-03 11:29:15 -07:00
Kevin Sawicki
729fe91e36 Conditionally include deprecations in Selection 2015-04-03 11:29:12 -07:00
Nikolaus Wittenstein
5a3f2035a1 Replace skipAtomicTokens with clip
When clipping a screen position, callers used to have to pick between
clipping to the left edge or the right edge when the position was in the
middle of an atomic token. This change allows them to choose the closest
edge, and makes this the default.

This makes selecting hard tabs (or any other atomic tokens) work in a
similar manner as in other text editors; that is, when clicking near
the middle of a tab, the insertion point will move to the closest edge
rather than the left edge.
2015-03-29 19:43:25 -04:00
Nathan Sobo
ae4f7f6170 Explicitly autoscroll when needed
Rather than when the selection’s marker changes. This is simpler than
suppressing autoscroll via state when we don’t want it. It also captures
the intent to autoscroll when attempting to move the cursor at the
beginning or end of the document.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-03-26 16:48:24 -06:00
Nathan Sobo
99c437ccec Allow autoscroll override option in cursor/selection methods
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-03-26 16:48:21 -06:00
Nathan Sobo
10458a5b45 Always autoscroll when the range of the last selection changes
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-03-26 15:30:53 -06:00