microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.95k stars 8.35k forks source link

Add an ability to reset and zoom in/out with ANSI #18256

Open ClaireCJS opened 6 days ago

ClaireCJS commented 6 days ago

Description of the new feature

Kind of a duplicate of #2578, but with ANSI codes.

Weren't there already OSC(?) ANSI codes in the VT200(?) or other standard for increasing/decreasing terminal font size? Or am I mis-remembering?

Proposed technical implementation details

Ansi code to increase font by 1 unit of size. Ansi code to decrease font by 1 unit of size. Ansi code to reset font to default/original size.

Preferably at a rate of >15fps, if possible

j4james commented 6 days ago

Weren't there already OSC(?) ANSI codes in the VT200(?) or other standard for increasing/decreasing terminal font size?

Everything from the VT100 onwards had the ability to change the font width with the DECCOLM mode, but you only had two choices: 80 columns per row, or 132 columns per row. The VT420 and later terminals also had the option of setting the font height with the DECSNLS sequence. For that you typically only had three choices, although the sequence itself could theoretically support any number.

DEC also had some software terminal emulators that let you control the font more directly with an OSC sequence (OSC 2F), and that had parameters specifying the point size, pitch, and font family. All of those parameters were optional, so for example you could just change the size and pitch without altering the font family.

There are probably also a boat load of proprietary sequences supported by various modern terminals that have their own ways of setting the font, and I'm assuming that includes changing the size, but I really don't know much about any of those.

ClaireCJS commented 6 days ago

Amazing, that's what I thought.

I must have somehow not stumbled on that one in the VT100 or VT220 manuals when I read them. Or maybe overlooked them.

So let's say your example of OSC 2F is "zoom up".

It would be pretty amazing if that had the same effect as ctrl-scrollwheel-up one tick. (i.e. zoom up)

zadjii-msft commented 6 days ago

If I had to guess, mintty usually has "proprietary" codes for stuff like this. I'd check there first for prior art.

j4james commented 6 days ago

So let's say your example of OSC 2F is "zoom up".

It wouldn't be as easy as that though. You need to know the current size to begin with, and then set both the height and width of the font to something larger. It's not ideal for your use case.

If I had to guess, mintty usually has "proprietary" codes for stuff like this. I'd check there first for prior art.

Yeah, I'm not sure of the details, but I do know Mintty has an OSC 7770 that is supposed to be able to set (and I think also query) the font size.

ClaireCJS commented 5 days ago

I mean.... It already does something with the mouse wheel. So just do that thing? 😅