Commit Graph

214 Commits

Author SHA1 Message Date
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
Nathan Sobo
2fffbba503 Eliminate Decoration class and use plain objects instead 2014-06-17 17:35:56 -06:00
Nathan Sobo
2c04bff0fa Only return decorations for markers intersecting the screen row range
This relies on a fix to the interval-skip-list provided with the upgrade
to text-buffer@2.4.0.
2014-06-16 15:36:09 -07:00
Ben Ogle
2d4360dcf0 Decorations can now only be attached to markers.
The basics work. It will render them on the gutter.
2014-06-16 15:36:08 -07:00
Ben Ogle & Nathan Sobo
7142022f05 Add intersection support to DisplayBuffer::findMarkers 2014-06-16 15:36:08 -07:00
Ben Ogle & Nathan Sobo
25520a4cad Add containedInScreenRange to DisplayBuffer::findMarkers 2014-06-16 15:36:08 -07:00
Ben Ogle & Nathan Sobo
56da6399b8 Add startScreenRow and endScreenRow to DisplayBuffer::findMarkers 2014-06-16 15:36:08 -07:00
Ben Ogle & Nathan Sobo
a7379b067a Use ::getMarker for fold decorations instead of new DisplayBufferMarker 2014-06-16 15:36:07 -07:00
Nathan Sobo
7c1a4a9e08 Don't clip range start/end in DisplayBuffer::pixelRectForScreenRange
Fixes #2583

This prevents the cursor from having 0 width inside atomic tokens.
2014-06-11 11:40:57 -06:00
Nathan Sobo
b73d267a5f Merge branch 'master' into cj-add-react-editor-shims 2014-06-11 07:34:41 -06:00
Nathan Sobo
7040906473 Ignore null bytes when measuring character widths in React editor
Fixes #2391
2014-06-11 07:18:52 -06:00
probablycorey
9e7e77bdf8 Merge remote-tracking branch 'origin/master' into cj-add-react-editor-shims
Conflicts:
	src/gutter-component.coffee
2014-06-10 15:42:23 -07:00
Ben Ogle
31b4b7a372 Speed up decoration removal and use less temp objects. 2014-06-09 14:04:24 -07:00
Ben Ogle
312901ff68 Use decorations for folds.
They are more efficient when re-rendering.
2014-06-09 14:04:24 -07:00
Ben Ogle
346b6007ca Allow for typeless decorations that apply to everything
If you are querying for `type: ‘gutter’` it will return the typeless 
decorations as well.
2014-06-09 14:04:24 -07:00
Ben Ogle
049531e495 Add comment 2014-06-09 14:04:23 -07:00
Ben Ogle
e8594ccec4 💄 Change var names for consistency 2014-06-09 14:04:23 -07:00
Ben Ogle
02594e3f7a 💄 Use for loops 2014-06-09 14:04:23 -07:00