Commit Graph

181 Commits

Author SHA1 Message Date
Ben Ogle
e6dbea09fe Add onDidCreateMarker and onDidUpdateMarkers 2014-09-05 17:26:14 -07:00
Ben Ogle
47ef54a072 Subscribe directly to the decoration destroy for removal 2014-09-05 16:53:35 -07:00
Ben Ogle
86e9778adb Remove the decoration changed event 2014-09-05 16:51:26 -07:00
Ben Ogle
aeffef30c6 Directly subscribe to the decorations in EditorComponent 2014-09-05 16:49:30 -07:00
Ben Ogle
e6e6028683 Deprecate decoration events 2014-09-05 15:14:27 -07:00
Ben Ogle
6e8a626de2 Add ::onDidChangeSoftWrapped to DisplayBuffer and Editor 2014-09-05 13:41:46 -07:00
Ben Ogle
21e4d8a064 Add DisplayBuffer::onDidChange 2014-09-05 13:30:59 -07:00
Ben Ogle
53fbfb8b27 Merge decoration-changed and decoration-updated
Only emit the decorations from the events
2014-09-05 12:35:52 -07:00
Ben Ogle
a2adbff3e9 Add TokenizedBuffer::onDidTokenize 2014-09-05 12:33:28 -07:00
Ben Ogle
48a68d87f5 Add TextBuffer::onDidChange 2014-09-05 12:26:54 -07:00
Ben Ogle
bcc6adff4f No longer need this as the event method passes it through 2014-09-05 12:26:06 -07:00
Nathan Sobo
6bd8702421 Deprecate DisplayBufferMarker::on 2014-09-05 11:39:34 -07:00
Nathan Sobo
1c95a55740 Add ::onDidChangeGrammar to Editor, DisplayBuffer, and TokenizedBuffer 2014-09-05 11:39:33 -07:00
Nathan Sobo
3e260eea56 Add Editor::onDidChangeSoftWrapped 2014-09-05 11:39:33 -07:00
Nathan Sobo
965afc2c37 Rename softWrap to softWrapped
Our new pattern for booleans is to have ::set and ::is, and that means
the property name needs to be in passive voice for ::is to make sense.
This is in preparation for adding a new change observation method.

* ::setSoftWrapped
* ::isSoftWrapped
* ::toggleSoftWrapped
2014-09-05 11:39:33 -07:00
Nathan Sobo
a947a357f4 Upgrade text-buffer for event subscription methods 2014-09-04 12:44:53 -06:00
Ben Ogle
c4265776b3 Rename unused method 2014-09-03 14:42:46 -07:00
Ben Ogle
ae49fd50b7 DisplayBuffer::linesForRows -> ::tokenizedLinesForScreenRows
Clarity!
2014-09-03 14:42:46 -07:00
Ben Ogle
99f899dc4a lineForScreenRow -> tokenizedLineForRow
The method was severely mislabeled
2014-09-03 14:42:45 -07:00
Ben Ogle
2b9b4a48ef tokenizedLineForRow -> tokenizedLineForScreenRow 2014-09-03 14:42:45 -07:00
Ben Ogle
05bbc480b0 displayBuffer::lineForRow -> tokenizedLineForRow 2014-09-03 14:42:45 -07:00
Ben Ogle
c3c91ae6c3 Only emit the marker-created event when the marker exists
This caused problems in the case of find-and-replace:select-all with 
multiple editors into the same file. 

* a marker is created on the TextBuffer capturing the selection
* DisplayBuffer:create-marker is fired from the first DisplayBuffer. 
The marker is turned into a selection which is merged into the current 
selection, deleting the marker that was created.
* DisplayBuffer::handleBufferMarkerCreated is called on the second
DisplayBuffer. The marker has been destroyed at this point, so it emits 
DisplayBuffer:create-marker with undefined. 
* ERROR>

Closes #3364
2014-08-25 11:42:44 -07:00
Nathan Sobo
a71a524ec7 Rework DOM measurement to try to prevent measurement errors
* Simplify scrollbar refresh and measurement by using imperative DOM
  manipulation instead of React to hide/show scrollbars.
* Rename `::performInitialMeasurement` to `::becameVisible`
* Break `::checkForVisibilityChange` out of `::pollDOM` and use it in
  to check for the element becoming visible in `componentWillUpdate`.
* Don't rely on stored visibility state anywhere. Always check again.
  This could potentially be cached for an update cycle but being wrong
  about this is disastrous so I'm being conservative.
2014-08-21 17:50:46 -06:00
Kevin Sawicki
0eaec57f7b Merge pull request #3116 from maschs/ms-srcLint
coffeelint!
2014-08-15 13:52:15 -07:00
Nathan Sobo
2bd8456923 Preserve invisibles in editor model across serialization
Fixes #3281
2014-08-15 08:18:53 -06:00
Maximilian Schüßler
32e59ce238 Cleanup code according to coffeelint 2014-08-14 19:41:49 +02:00
Nathan Sobo
20daed176b Don't show invisibles in mini editors
This moves observation of the config keys to Editor, which assigns the
invisibles hash or null on the TokenizedBuffer via the DisplayBuffer to
control whether we render invisibles or not.
2014-08-13 16:32:14 -06:00
Ben Ogle
c67f8493e0 Softwrap always takes into account the vertical scrollbar width 2014-07-22 11:52:23 -07:00
Nathan Sobo
6fe05064eb Use default implementation of ::destroy from theorist Model class
Move actions that need to happen on destruction to ::destroyed hook.
2014-07-08 21:29:32 -06:00
Ben Ogle
d7a3ffa9de Handle Decoration::update 2014-07-07 15:13:04 -07:00
Ben Ogle
e991b3d10c Move from addDecoration -> decorateMarker 2014-07-07 14:43:56 -07:00
Nathan Sobo
673b62f547 Scroll React editor all the way left when soft wrap is enabled
Fixes #2842
2014-07-07 12:26:33 -06:00
Ben Ogle
80eb31679f Add a Decoration object. Rework to use this object 2014-07-03 17:32:37 -07:00
Ben Ogle
7b19152a58 Add updateDecorationForMarker() 2014-07-03 17:32:37 -07:00
Nathan Sobo
c2b7955ec6 Adjust DisplayBuffer::longestScreenRow when lines are inserted/removed
Fixes #2810

The line corresponding to the longest screen row moves when lines are
inserted or removed above it, so we need to adjust it accordingly or we
won't always realize when a change affects the longest line.
2014-07-03 16:15:49 -06:00
Nathan Sobo
32c8a3ce99 Only adjust scrollTop when deleting lines when using the React editor 2014-07-01 09:16:29 -06:00
Nathan Sobo
a99bde4e2d Reassign scrollTop if deleting lines decreases the max scrollTop
Fixes #2725
2014-07-01 09:01:04 -06:00
Ben Ogle & Nathan Sobo
f739dce210 Only recompute scroll width once for each batch of measured chars 2014-06-25 15:26:13 -07:00
Ben Ogle & Nathan Sobo
77389b0518 Update scrollWidth when the max line length / default char width changes 2014-06-25 15:26:13 -07:00
Ben Ogle
809804d0cc 💄 2014-06-25 15:26:13 -07:00
Ben Ogle
8054b769d6 Default scrollWidth to 0 2014-06-25 15:26:13 -07:00
Ben Ogle
e3c3779a73 Don’t need to return the list. So just return 2014-06-25 15:26:13 -07:00
Ben Ogle
9cc1244f32 Compute the longest line width based on the longest line 2014-06-25 15:26:13 -07:00
Ben Ogle
d6f217f80a Never allow partial pixel values for scroll 2014-06-24 18:09:03 -07:00
Ben Ogle
5ebb17c2e8 Be defensive when iterating through decorations 2014-06-23 18:03:19 -07:00
Ben Ogle
b4f4ef8ec4 💄
Make it not suck.
2014-06-23 17:04:32 -07:00
Ben Ogle
f381abcbad Re-render when a marker changes
fixes #2705
2014-06-23 16:00:36 -07:00
Nathan Sobo
388763e7cd Wait to measure characters if editor is hidden
Also, when characters *are* measured, request a display update
2014-06-19 04:19:51 -06:00
Nathan Sobo
17f9cc49f2 Honor the center: true option in scrollTo* methods
Fixes #2648
2014-06-18 21:48:14 -06:00
Ben Ogle
4308ce7bb0 Warnings when you pass in a bs marker 2014-06-17 17:08:53 -07:00