Skip to content

webrepl.html: Automatically resize the terminal to fill the window. #6

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

Merged
merged 1 commit into from
Jun 1, 2016

Conversation

dpgeorge
Copy link
Member

Also centres the terminal.

@pfalcon
Copy link
Contributor

pfalcon commented May 17, 2016

Is that really how we want it to be done? My idea was to offer a dropbox with couple of standard sizes (like 80x24 or 132x50).

@dpgeorge
Copy link
Member Author

I think this way is more convenient: no need to select anything. There's nothing else on the page so the room is just wasted otherwise. Users can then resize their browser window to get exactly the terminal size they want. With a drop-down, what if I want something in between the available options?

Test it out here: http://micropython.org/webrepl/index2.html

@pfalcon
Copy link
Contributor

pfalcon commented May 17, 2016

There's nothing else on the page

Currently. What will happen when there's something else? Will it work as expected or we need to just switch it back to fixed size? If the latter, should be apply it in the 1st place?

The test page you give has big left, right, bottom margins (I wasn't even sure it expands vertically due to bottom margin). Is it expected?

Generally, it's ok, I just wonder how future proof it is. We definitely can apply it and see how it goes.

@dpgeorge
Copy link
Member Author

The test page you give has big left, right, bottom margins (I wasn't even sure it expands vertically due to bottom margin). Is it expected?

Yes the margins are deliberate. It also has a maximum (and minimum) width and height cutoff. All these things are tunable.

@pfalcon
Copy link
Contributor

pfalcon commented May 17, 2016

Great, let's merge it.

@dpgeorge
Copy link
Member Author

Great, let's merge it.

It still has a few bugs (can't scroll when window is too small) and I didn't test it on anything but Firefox.

BTW, do you want to use jQuery (or similar)? If not we will always be resorting to writing lots of idiomatic JS to do simple things like register event handlers.

@pfalcon
Copy link
Contributor

pfalcon commented May 17, 2016

BTW, do you want to use jQuery (or similar)?

I'd want to stay away from JS as much as possible and hope that somewhere else contributes useful features. There's also recent (?) movement to dump jQuery as big old bloat. I don't know whether the alternative is "idiomatic JS" (yes, I'd prefer that, but I already said I'd prefer not to write JS at all), or some more lightweight lib, I'm not current on JS stuff (I guess I'm definitely against heavy-weight stuff like AngularJS, but again, arguing why it's useful are up to whoever wants to add more functionality to webrepl).

@dpgeorge
Copy link
Member Author

I'm not current on JS stuff

No one ever is, it changes too fast :) But there are some ok jQuery alternatives that are much more light weight. For now we can get away without using it but in the future might need it.

[I hope you appreciate that term.js is already 150k. I minified it down to 54k at micropython.org/webrepl]

@pfalcon
Copy link
Contributor

pfalcon commented May 17, 2016

I hope you appreciate that term.js is already 150k.

Exactly, why I don't want jquery and other heavy stuff. If going "heavy stuff" way, we'd rather start with a web IDE then and see how integrate webrepl protocol into it.

#outer {
position: fixed;
}

/*
.terminal {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this section is commented in it would be possible to override the font-size (and the other properties) from the html rather than using the default ones from the terminal.js file (see my pull request). The terminal.js also uses 11px (pixels) as default font size - maybe somehting resolution independant is better? E.g. "14pt", or "small", "medium"

Copy link

@hoihu hoihu May 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I'm apparently no master in writing github line comments :)

I meant the .terminal section

@hoihu
Copy link

hoihu commented May 17, 2016

scaling works ok on safari and chrome (on OSX). Thanks, that's great to have.

The terminal widget is resized depending on the size of its containing
window.  The minimum size is 80x24 characters and the maximum is 150x80
(these numbers can be tuned if needed).  There is also a small margin on
the right side and the bottom.
@dpgeorge dpgeorge force-pushed the auto-term-resize branch from eadb697 to e935155 Compare June 1, 2016 11:56
@dpgeorge dpgeorge merged commit e935155 into micropython:master Jun 1, 2016
@dpgeorge
Copy link
Member Author

dpgeorge commented Jun 1, 2016

Ok, I simplified this patch to only do resizing, not centring. Merged and available at http://micropython.org/webrepl/.

@pfalcon
Copy link
Contributor

pfalcon commented Jun 1, 2016 via email

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

Successfully merging this pull request may close these issues.

3 participants