Commit Graph

21581 Commits

Author SHA1 Message Date
Nathan Sobo
510520d2c7 🎨 rename ::getStart/EndRow to ::computeStart/EndRow 2015-02-03 15:05:32 -07:00
Nathan Sobo
4eb39b1be2 Remove unnecessary onDidChangeSoftWrapped subscription 2015-02-03 15:05:32 -07:00
Nathan Sobo
9d507ea692 Break out state updates explicitly when editor content changes 2015-02-03 15:05:32 -07:00
Nathan Sobo
f005b2005f Add specs for updating scrollWidth when the longest line changes 2015-02-03 15:05:32 -07:00
Nathan Sobo
b521e8dc97 Handle auto-height in TextEditorPresenter 2015-02-03 15:05:32 -07:00
Nathan Sobo
bbc1a264b5 Make each section of presenter state self-contained
This means we have some duplicated values in different parts of the
tree, but it’s cleaner in the view since each component only consumes
a single object. Seems like the presenter should convey the correct
data to the correct locations and minimize the logic in the view. A
few duplicated integers is a reasonable trade-off.
2015-02-03 15:05:31 -07:00
Nathan Sobo
da4b3a47ef Don’t observe decorations in text editor view 2015-02-03 15:05:31 -07:00
Nathan Sobo
0e27bebbb3 Fix indentation 2015-02-03 15:05:31 -07:00
Nathan Sobo
efdba9fc24 Use presenter state for scrollbars and scrollbar corner 2015-02-03 15:05:31 -07:00
Nathan Sobo
0910e86357 Add .right and .bottom to presenter scrollbar states 2015-02-03 15:05:31 -07:00
Nathan Sobo
14776e3f0a Give each scrollbar its own state object and track visibility 2015-02-03 15:05:30 -07:00
Nathan Sobo
42ab02d7d2 Rename ::clientHeight/Width to ::height and ::contentFrameWidth
The term “client” was actually a misnomer here because it typically
means the height excluding the scrollbars, which wasn’t how we were
using it here.
2015-02-03 15:05:30 -07:00
Nathan Sobo
1b5be9aef8 Track horizontal/vertical scrollbar height/width in presenter 2015-02-03 15:05:30 -07:00
Nathan Sobo
9de8ab949f Drop TextEditorComponent::getRenderedRowRange 2015-02-03 15:05:30 -07:00
Nathan Sobo
6108c04f40 Add spec coverage for deprecated ‘cursor:moved’ event
So we don’t accidentally drop it during this transition
2015-02-03 15:05:30 -07:00
Nathan Sobo
d8cafb1fc6 Don’t observe screen line changes in editor component 2015-02-03 15:05:29 -07:00
Nathan Sobo
76241fb779 Handle line and line number preservation in presenter
The target of mousewheel events needs to be preserved when scrolling.
It used to be dealt with in the view, but now we can do it in the
presenter for a simpler view implementation.
2015-02-03 15:05:29 -07:00
Nathan Sobo
d9a5d141eb Clear ::mouseWheelScreenRow after delay even if we don’t actually scroll 2015-02-03 15:05:29 -07:00
Nathan Sobo
37a040a620 Preserve line numbers in presenter based on ::mouseWheelScreenRow 2015-02-03 15:05:29 -07:00
Nathan Sobo
35d3690088 Preserve lines in TextEditorPresenter based on ::mouseWheelScreenRow 2015-02-03 15:05:29 -07:00
Nathan Sobo
578a76ba6b Make “mouse wheel” 2 words in presenter API
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-02-03 15:05:28 -07:00
Nathan Sobo
da5ee3fa86 Add TextEditorPresenter::state.mousewheelScreenRow 2015-02-03 15:05:28 -07:00
Nathan Sobo
a88486e950 Use maxLineNumberDigits from presenter state in GutterComponent 2015-02-03 15:05:28 -07:00
Nathan Sobo
1a22952eda Only store backgroundColor and gutterBackgroundColor on presenter 2015-02-03 15:05:28 -07:00
Nathan Sobo
fd50a0db6c Construct TextEditorPresenter before component mounts
This allows us to use the presenter for all stages of the component
lifecycle rather than needing to wait until it is created.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-02-03 15:05:28 -07:00
Nathan Sobo
ac25596002 Wait for required measurements before building some presenter state
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-02-03 15:05:27 -07:00
Max Brunsfeld
9cc7ecb1be Add maxLineNumberDigits to presenter state 2015-02-03 15:05:27 -07:00
Max Brunsfeld
60fca8d8b2 Use presenter state for gutter background color
Signed-off-by: Nathan Sobo <nathan@github.com>
2015-02-03 15:05:27 -07:00
Max Brunsfeld
fd4f28911d Use presenter state for placeholder text
Signed-off-by: Nathan Sobo <nathan@github.com>
2015-02-03 15:05:27 -07:00
Nathan Sobo
1a61133def Remove unused local var
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-02-03 15:05:26 -07:00
Nathan Sobo
f5fa3b837e Set content.indentGuidesVisible in presenter if editor is mini 2015-02-03 15:05:26 -07:00
Nathan Sobo
b21b9c3402 Use presenter’s scrollingVertically property to defer line measurement 2015-02-03 15:05:26 -07:00
Nathan Sobo
d4517b1ab0 Add TextEditorPresenter::state.scrollingVertically
This is used by the view to defer measuring new lines until we stop
scrolling.
2015-02-03 15:05:26 -07:00
Nathan Sobo
837b9eefbb Use backgroundColor from presenter in LinesComponent 2015-02-03 15:05:26 -07:00
Nathan Sobo
71a27de7ac Add TextEditorPresenter::state.content.backgroundColor 2015-02-03 15:05:25 -07:00
Nathan Sobo
96ba4cc6bd Remove unused React props and methods that build them 2015-02-03 15:05:25 -07:00
Nathan Sobo
9d7285d04a Use presenter for rendering overlay decorations
We’re still doing some sync DOM reads and computation in the view that
should eventually be made async and moved into the presenter, but I’m
going to leave it alone for now.
2015-02-03 15:05:25 -07:00
Nathan Sobo
e4c95d8ac3 Add overlay decorations to TextEditorPresenter::state 2015-02-03 15:05:25 -07:00
Nathan Sobo
a5580a704d Remove unused properties in EditorComponent and children 2015-02-03 15:05:25 -07:00
Nathan Sobo
c4b5a0f411 Honor the ‘onlyHead’ option for line and line-number decorations 2015-02-03 15:05:24 -07:00
Nathan Sobo
af8c38ad80 🎨 2015-02-03 15:05:24 -07:00
Nathan Sobo
0802b9bdd1 Don’t decorate soft-wrapped lines/line numbers unless spanned by marker 2015-02-03 15:05:24 -07:00
Nathan Sobo
b1fe567ce8 Build line numbers based on presenter state 2015-02-03 15:05:24 -07:00
Nathan Sobo
20838accc1 Key line numbers by buffer row and soft-wrap count
…instead of an array. This will make things simpler to diff in the
view.
2015-02-03 15:05:24 -07:00
Nathan Sobo
182531a010 Use presenter for gutter scrollHeight and scrollTop
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-02-03 15:05:23 -07:00
Max Brunsfeld
f218e985cf Update presenter scrollHeight when clientHeight changes
Signed-off-by: Nathan Sobo <nathan@github.com>
2015-02-03 15:05:23 -07:00
Max Brunsfeld
33081cefda Move .lineNumbers onto .gutter property of presenter state
Signed-off-by: Nathan Sobo <nathan@github.com>
2015-02-03 15:05:23 -07:00
Nathan Sobo
d26e8a2df1 Move vertical scroll state to root of presenter state object
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-02-03 15:05:23 -07:00
Nathan Sobo
1ff0b20cea Add ‘foldable’ to line number presenter state 2015-02-03 15:05:23 -07:00
Nathan Sobo
66c35d6e3e Reflect changes to line number decorations in presenter state
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2015-02-03 15:05:22 -07:00