Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Expose resizing to editor - #2603

Merged
probablycorey merged 12 commits into
masterfrom
cj-expose-resizing-to-editor
Jun 18, 2014
Merged

probablycorey merged 12 commits into
masterfrom
cj-expose-resizing-to-editor

Conversation

@probablycorey

Copy link
Copy Markdown

This updates the editor's height/width when the editor component's height/width changes. This fixes the problem of tool-panels covering up the cursor position.

Closes #2578

@probablycorey

Copy link
Copy Markdown
Author

We decided to abandon the use of the overflowchanged event because it is being deprecated in blink https://codereview.chromium.org/download/issue295993006_40001.diff.

@probablycorey

Copy link
Copy Markdown
Author

@nathansobo doing the update in componentWillUpdate worked, but it looks like it is causing some react errors in the specs.

@nathansobo

Copy link
Copy Markdown
Contributor

That's probably because of the feedback loop I discussed. We need to pause handling of height and width changes during updates.

We always measure the scroll view in the ::componentWillUpdate hook, so
performing *another* update in response to the measurement causes an
invariant violation in react. Whenever we are measuring, we are always
already updating.
@probablycorey

Copy link
Copy Markdown
Author

I tested this out with splits and soft-wrap and didn't find any problems. I found one slight bug, but I'm not going to invest too much time into fixing it.

atom

To reproduce:

  1. Place the cursor close to the end of the file, right above where the keybinding-resolver will be displayed.
  2. Toggle the keybinding-resolver.
  3. Press Down

Expected
The cursor is goes behind the keybinding resolver, so I would expect the editor to scroll.

What happens
The editor doesn't scroll. If you press down again it will scroll and the behavior works as expected.

@kevinsawicki

Copy link
Copy Markdown
Contributor

The soft wrapped lines don't seem to update anymore when the tree view is toggled though, it this something we still plan on fixing on this branch?

wrap

@nathansobo

Copy link
Copy Markdown
Contributor

We should experiment with whether the overflowchanged event is emitted when the tree view or keybinding resolver are toggled. I think it matters because otherwise it will be a regression.

@kevinsawicki

Copy link
Copy Markdown
Contributor

@nathansobo it is emitted, this was how we originally got this working.

@probablycorey

Copy link
Copy Markdown
Author

@kevinsawicki I can't reproduce this. How are you toggling the tree-view, cmd-\? Do you have the react editor config option on?

atom

@kevinsawicki

Copy link
Copy Markdown
Contributor

Using cmd-\, I have the react editor on.

@probablycorey

Copy link
Copy Markdown
Author

I've moved things back to the overflowchanged event. It will all work until the event is fully deprecated in chromium.

I'm still not sure why the overflowchanged event is being triggered when the editor's width changes, but it is.

@probablycorey

Copy link
Copy Markdown
Author

@nathansobo I'm not sure if adding the resize events make if feel any faster. I'm going to leave them in though and you can test it out yourself.

@probablycorey probablycorey self-assigned this Jun 17, 2014
probablycorey pushed a commit that referenced this pull request Jun 18, 2014
@probablycorey
probablycorey merged commit 2e73a46 into master Jun 18, 2014
@probablycorey
probablycorey deleted the cj-expose-resizing-to-editor branch June 18, 2014 16:19
@nathansobo

Copy link
Copy Markdown
Contributor

🎆

I'd like to dig into a timeline and play with this to make sure the polling doesn't adversely affect responsiveness. I doubt it will though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selections are hidden by tool panels

4 participants