Repository: terminal
Issue: Terminal: add support for Window Manipulation (CSI t, resize), or reject it explicitly (and force a client resize)
Labels: Area-VT,Product-Terminal,Issue-Task,In-PR,Priority-2

Notes from @j4james:

> Note that this is a problem for all the VT resizing sequences too. For example, you'll get the same problem resizing the screen from within a bash shell like this:
> 
> ```
>     printf "\e[8;10;10t"
> ```
> 
> And if you want to make `mode` work, then you'll probably want to start with the VT sequences first, because ultimately that's how you're going to have to communicate this information to the Terminal.
> 
> The real issue, though, is deciding how the Terminal should deal with a resize request. When you've got multiple tabs, each potentially requesting a different size, you can't satisfy all of them at once. I've been thinking about this for a while, and there were three approaches that I considered:
> 
> 1. Ignore the size request, as we are doing now. But for this to work, it's vital that the Terminal communicate back to the host that the request has failed. If you don't do that, the Terminal and conhost get out of sync, and the renderer goes barmy..
> 
> 2. Accept the requested size as a kind of virtual window, similar to the way conhost works when the buffer width and window width are different. If the virtual window is larger than the actual window, you'll need to be able to scroll across the viewport, both horizontally and vertically (the latter being kind of tricky to differentiate from the scrollback).
> 
> 3. Accept the requested size and actually resize the whole Terminal window to fit, but only if the tab making the request is currently focused. A background tab shouldn't be able to change the size. And as with option 1, it's vital that the resulting sizes are communicated back to the different hosts for each tab.
> 
> Personally I'm in favor of option 3, but I suspect others will disagree, and it may need to be a configurable preference. It's also possible there are other better approaches that I haven't thought of.

Notes from @egmontkob:

> On a more important note, I believe that this escape sequence with a fixed size is borderline problematic/harmful, whereas this one with the "maximized" value, and other nearby escape sequences, are straight harmful (just like when webpages that are allowed to move/resize the browser window – everyone hates that, right?) and terminals should deliberately refuse to implement.

Notes from @DHowett-MSFT:
We should choose one of the above options and stick to our guns.

<hr>

More notes:

* option 4: Only allow a resize like this if there's a single pane. If there's two panes, we'll do the thing from option 1, and ignore it.  
* We're probably gonna just go with option 4
* We'll add a `compatibility.allowWindowResizing` defaulted to `true` to let people fully disable this
* If there's multiple tabs, then inactive tabs won't notice the current tabs new size till they get focused (and the control is re-added to the UI tree). 
  * theoretically, one app could ask for 30x80 and another tab 45x120 and switching back and forth would keep resizing the window
* if a inactive tab gets a resize request... then we need to somehow mark that tab asked for a new size, and allow the resize, and resize the `Terminal` & buffer, but only resize the window when it gets activated.
* This probably needs to be handled as a core->control->app request, so the app can allow/reject