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

writing code off the bottom of the screen #336

Open
shriram opened this issue Aug 20, 2014 · 18 comments
Open

writing code off the bottom of the screen #336

shriram opened this issue Aug 20, 2014 · 18 comments

Comments

@shriram
Copy link
Member

shriram commented Aug 20, 2014

No matter how tall your monitor, once your program gets long, you're stuck writing at the very bottom of your screen. There doesn't seem to be an equivalent of C-l in Emacs to re-center things. Maybe this is fine by kids these days, but I find myself adding a bunch of blank lines to the file...

In case there's an option to do something about this in CodeMirror, it'd be nice to enable it. And if not, perhaps file a not-expecting-to-be-fixed-soon request.

@shriram
Copy link
Member Author

shriram commented Oct 7, 2016

This is still a problem, and maybe there's something in CodeMirror that helps now? I still find myself (both when coding on my own, and in class) having to insert a whole bunch of newlines.

@blerner blerner removed their assignment Oct 7, 2016
@blerner
Copy link
Member

blerner commented Oct 7, 2016

This still falls into the "too bad" category, as CM hasn't improved on this point at all yet.

@schanzer
Copy link
Contributor

CodePen uses CodeMirror, and it looks like they add a padding-bottom to CodeMirror-lines when there's more than one line of code. As a result, putting the cursor at the bottom of the screen still allows you to scroll. See this example: https://codepen.io/anon/pen/XVNjJJ

@schanzer
Copy link
Contributor

@shriram now that we have a footer, the cursor no longer goes to the bottom of the screen. Is this good enough, or would the suggestion be to make C-I a keyboard shortcut that just adds lines?

@shriram
Copy link
Member Author

shriram commented Aug 12, 2020

I don't feel this problem has really improved.

If you're teaching in a room where the bottom 20% of the screen is not visible from everywhere (as often happens), you really want to move the active area to the middle of the screen.

@blerner
Copy link
Member

blerner commented Aug 12, 2020

I sympathize, and am also really, really struggling to think how to implement this within the confines of CSS. Emacs' notion of Ctrl+I is really weird, from an implementation perspective, and AFAIK CodeMirror simply doesn't let you scroll past the bottom of the document. (I.e., the invariant seems to be "if there's any vertical space at the bottom of the screen that doesn't correspond to a line of text of the document, then the zeroth line of the document must be visible." I've checked their scrolling APIs and you can't scroll to a line past the end of the document.)

One idea I just had was to allow the bottom footer to have resizable height, just as the separator bar resizes the width of definitions and interactions. The idea would be that if you could resize it big enough, then even if the REPL is at the "bottom" of its area, that bottom is still visible to everyone.

I don't want this resizing to be available by default, though, since it'd confuse students... Three possibilities:

  • add another url parameter option, footerStyle=resizable, that would let the footer be draggable in height. This is easiest to implement such that students would avoid it, but teachers would forget about it, and it's kinda brittle. URL parameters really should be for embedding only.
  • add a "Presentation mode" to the Bonnie menu that could (a) enter fullscreen so that you get a bit more screen real-estate, (b) make the footer resizable, (c) whatever else we think is a good idea. But Bonnie menu items should be kept minimal.
  • add a "Presentation theme" to the theming options that makes the footer's resizer become visible and usable.

@sorawee
Copy link
Contributor

sorawee commented Aug 12, 2020

@schanzer
Copy link
Contributor

Whoa. @sorawee I was about to recommend doing this exact thing by hand. How did you even find this addon? It's not linked from the CM homepage!

@blerner I think this is 100% the way to go.

@sorawee
Copy link
Contributor

sorawee commented Aug 12, 2020

I... googled "codemirror scroll past the end" and http://codemirror.977696.n3.nabble.com/Scroll-Past-End-td4028057.html comes up.

@blerner
Copy link
Member

blerner commented Aug 12, 2020

Ok, so to be clear, this is not a 100% fix. What it allows you to do is instantly add a scrollbar to the definitions area, so that you can scroll until the last line of the file is at the top of the screen (which breaks the putative invariant I claimed above, so go figgur). It's a bit ugly, to be honest, since the scrollbar is unneeded almost all the time...but it's a workaround.

But it does nothing to fix the REPL side of the screen, which still has a similar problem: the last line of text will be at the bottom of the screen. And I think Shriram has complained bitterly about that being a problem as well...right?

@shriram
Copy link
Member Author

shriram commented Aug 12, 2020

Well, I'll take what I can get…but yes, this is also a problem in the REPL. I have sometimes re-run programs just to get the cursor back up.

@schanzer
Copy link
Contributor

The interactions area has been fixed for quite some time. There’s a 5em bottom padding that was added specifically to fix this problem. If that’s not big enough, we can talk about changing that number

@blerner
Copy link
Member

blerner commented Aug 12, 2020

I don't see any such thing...? If I have a bunch of interactions such that the interactions area needs a scrollbar, I get no padding below the last item at all...

@schanzer
Copy link
Contributor

Try as I might, I cannot get my cursor to be at the bottom of the screen:
image

That's because of the padding-bottom: 5ex rule. I can set it to 25ex and force the REPL even higher:

image

@blerner
Copy link
Member

blerner commented Aug 12, 2020

Super weird -- that doesn't work in Firefox! I can only reproduce what you're seeing in Chrome.

@jpolitz
Copy link
Member

jpolitz commented Aug 12, 2020

@shriram re the repl option: amusingly, way back there was a “Clear” button that did basically Ctrl-L. I can't find the discussion about it, but it was argued that it should be removed.

brownplt/pyret-lang@03c6a84

Do we miss it dearly?

@shriram
Copy link
Member Author

shriram commented Aug 12, 2020

We miss it dearly.

@schanzer
Copy link
Contributor

@blerner See https://stackoverflow.com/questions/29986977/firefox-ignores-padding-when-using-overflowscroll

We should make sure this works on FF, even when we bring back the kbd shortcut for Shriram. It solves a large percentage of "simple cases" in normal k12 classrooms, where what's needed is just an extra 6-12" at the bottom of the projector.

@blerner blerner transferred this issue from brownplt/pyret-lang Aug 13, 2020
blerner pushed a commit that referenced this issue Aug 13, 2020
…l last row of content is scrollable to top of screen. Does not address the Firefox REPL padding issue yet.
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

5 participants