Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeMirror-gutter height doesn't size properly on init & container expends instead of scrolls #1891

Closed
JakobJingleheimer opened this issue Oct 19, 2013 · 5 comments

Comments

@JakobJingleheimer
Copy link

In codemirror.css:160

.CodeMirror-gutter {
  white-space: normal;
  height: 100%;
  -moz-box-sizing: content-box;
  box-sizing: content-box;
  padding-bottom: 30px;
  margin-bottom: -32px;
  display: inline-block;
  /* Hack to make IE7 behave */
  *zoom:1;
  *display:inline;
}

.CodeMirror-gutter would size properly with the above css, except for the following JavaScript, which overrides the height property at the element level. I can't figure out where JavaScript is getting the incorrect height—everything else inside of the .CodeMirror container is sized properly.

https://github.com/marijnh/CodeMirror/blob/master/lib/codemirror.js#L324

d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + "px";

It does correct itself as soon as the content is changed, when it becomes .CodeMirror-gutters.

@brandonwamboldt
Copy link
Contributor

Any chance you could post an example of this problem occuring, using JSBin or something?

@JakobJingleheimer
Copy link
Author

Yes, i'll try to get one together this afternoon.

: .
Jacob
frende
jacob@frende.me

@JakobJingleheimer
Copy link
Author

Hiya, sorry I haven't had time to create an example. But just to show what's happening:

codemirror_2013-10-23_3-50pm

@getvictor
Copy link

I'm seeing this issue as well on 3.16 and 3.19. I have CodeMirror in a resizable div like on jsfiddle.net. When the div is resized, .CodeMirror-gutters does not get resized because it has a hardcoded element height. That element height is only updated when the whole browser window is resized.

Is there a workaround for this?

@marijnh
Copy link
Member

marijnh commented Nov 19, 2013

Is there a workaround for this?

Yes. Call .refresh() after resizing the wrapping container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants