.refresh() Doesn't update gutter height? #38

Closed
opened 2011-03-10 02:12:29 +01:00 by marijnh · 4 comments
marijnh commented 2011-03-10 02:12:29 +01:00 (Migrated from gitlab.com)

Hi!

I'm working on an app which will use CodeMirror2 as it's input editor. Everything is working great, except the way the height of the gutter updates. At the moment the height of the gutter gets updated every time a line gets added/removed, which is logical, but it doesn't seem to update when the codemirror instance gets resized.

I thought the best way to counter this, was to call .refresh() on the codemirror object, but it doesn't seem to help. I may be doing something horribly wrong, but it seems to me like .refresh() was created exactly for cases like this.

Looking forward to your reply!

Chiel.

Hi! I'm working on an app which will use CodeMirror2 as it's input editor. Everything is working great, except the way the height of the gutter updates. At the moment the height of the gutter gets updated every time a line gets added/removed, which is logical, but it doesn't seem to update when the codemirror instance gets resized. I thought the best way to counter this, was to call .refresh() on the codemirror object, but it doesn't seem to help. I may be doing something horribly wrong, but it seems to me like .refresh() was created exactly for cases like this. Looking forward to your reply! Chiel.
marijnh commented 2011-03-10 07:33:45 +01:00 (Migrated from gitlab.com)

Hi Chiel,

Are you working with the current git HEAD? Commit ef83a9126c fixed something related to this, and if I now open one of the demo pages, and set (from the script console) the height of the editor, the gutter is indeed off, but calling .refresh() does properly fix this.

Best,
Marijn

Hi Chiel, Are you working with the current git HEAD? Commit ef83a9126c34f68811a488fe55885deec89dd93f fixed something related to this, and if I now open one of the demo pages, and set (from the script console) the height of the editor, the gutter is indeed off, but calling .refresh() does properly fix this. Best, Marijn
marijnh commented 2011-03-10 11:14:29 +01:00 (Migrated from gitlab.com)

Hi Marijn,

I made a point to pull in the latest version of CodeMirror2 before "whining" about it here, so yep, I do have that fix.

If .refresh() is supposed to work as I thought, then the only thing I can think of, is the fact that I changed the style of the .CodeMirror class by using height: 100%;, since it's inside of a wrapper, that resizes with the rest of the layout.

This shouldn't really cause any issues as far as I know, but hey, it might be contributing? In what way do you assess the height of the codemirror instance? I made a little hack for this, for now, but it's hardly ideal. Basically every time the window (which means also the editor-wrapper) I set the height of the gutter to "", and the min-height to 100%. That way it's always at least 100% of the codemirror instance, yet it'll still stretch past this.

Best,
Chiel

Hi Marijn, I made a point to pull in the latest version of CodeMirror2 before "whining" about it here, so yep, I do have that fix. If .refresh() is supposed to work as I thought, then the only thing I can think of, is the fact that I changed the style of the .CodeMirror class by using height: 100%;, since it's inside of a wrapper, that resizes with the rest of the layout. This shouldn't really cause any issues as far as I know, but hey, it might be contributing? In what way do you assess the height of the codemirror instance? I made a little hack for this, for now, but it's hardly ideal. Basically every time the window (which means also the editor-wrapper) I set the height of the gutter to "", and the min-height to 100%. That way it's always at least 100% of the codemirror instance, yet it'll still stretch past this. Best, Chiel
marijnh commented 2011-03-10 17:07:25 +01:00 (Migrated from gitlab.com)

Someone in the google group provided me with a test case for this. db0a7e6fa0 should solve it. If it doesn't reopen.

Someone in the google group provided me with a test case for this. db0a7e6fa0ede727555a7255f3af3f16bd443298 should solve it. If it doesn't reopen.
marijnh commented 2011-03-10 17:21:31 +01:00 (Migrated from gitlab.com)

Awesome, this does the trick perfectly! Thanks a lot for being so fast with all this. CodeMirror is a delight to work with. At the moment it seems to be really slow in Chrome, though. But I'll make another ticket about that if it remains an issue.

Cheers!

Awesome, this does the trick perfectly! Thanks a lot for being so fast with all this. CodeMirror is a delight to work with. At the moment it seems to be really slow in Chrome, though. But I'll make another ticket about that if it remains an issue. Cheers!
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/codemirror5#38
No description provided.