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

Introduce read-only panes #8867

Merged
24 commits merged into from Feb 8, 2021
Merged

Introduce read-only panes #8867

24 commits merged into from Feb 8, 2021

Conversation

Don-Vito
Copy link
Contributor

Summary of the Pull Request

Introduces read-only panes.
When pane is marked as read-only:

  1. Attempt to provide user input results in a warning
  2. Attempt to close pane - shows dialog
  3. Attempt to close hosting tab shows dialog
  4. The hosting tab has no close button

PR Checklist

Detailed Description of the Pull Request / Additional comments

  1. The readonly logic implemented in TermControl
    (and prevents any send input)
  2. Special handling is required to allow key-bindings
  3. The "close-readonly" protections are in TerminalPage.
  4. The indication that the pane is readonly is done using lock glyph
  5. The indication that the tab contains readonly pane
    is done by hiding the close button of the tab
  6. The readonly mode is enabled by keyboard shortcut
    (the followup might add this to the context menu)

Validation Steps Performed

@ghost ghost added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. labels Jan 24, 2021
@Don-Vito
Copy link
Contributor Author

ReadOnlyPanes2

Some highlights:
image

image

image

@Don-Vito Don-Vito changed the title Introduce Read-Only Panes Introduce read-only panes Jan 24, 2021
Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

Some other notes:

  • mildly concerned if "Close anyway" should be the primary button
  • mildly concerned about some of the async changes to closing tabs
    So, honestly, I'd want a design signoff from @cinnamon-msft and a closer look from @zadjii-msft (or @DHowett) for async tab closing.

Mostly nits, and I don't see any real issues, so I'm approving.

src/cascadia/TerminalSettingsModel/ActionAndArgs.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalControl/TermControl.h Show resolved Hide resolved
src/cascadia/TerminalApp/TerminalTab.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/Pane.h Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/Resources/en-US/Resources.resw Outdated Show resolved Hide resolved
@Don-Vito
Copy link
Contributor Author

Some other notes:

* [ ]  mildly concerned if "Close anyway" should be the primary button

* [ ]  mildly concerned about some of the async changes to closing tabs
  So, honestly, I'd want a design signoff from @cinnamon-msft and a closer look from @zadjii-msft (or @DHowett) for async tab closing.

Mostly nits, and I don't see any real issues, so I'm approving.

Yeah. I am mostly worried about the async nature of remove tab. Hope I didn't miss anything.
Regarding the primary button - I absolutely agree and will change it!

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

This mostly seems fine to me. I'm a little worried about the race in closing a pane. Hopefully if we move that logic within the tab itself, we can mitigate that.

src/cascadia/TerminalControl/TermControl.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalControl/TermControl.idl Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/TerminalPage.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/TerminalPage.cpp Show resolved Hide resolved
src/cascadia/TerminalApp/TerminalPage.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/TerminalPage.cpp Show resolved Hide resolved
@zadjii-msft zadjii-msft assigned Don-Vito and unassigned zadjii-msft Jan 27, 2021
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

Okay I found an unrelated crash while playing with this, but this seems good to me. Thanks! @cinnamon-msft will come around later to write up a docs page for this

src/cascadia/TerminalApp/TerminalPage.cpp Show resolved Hide resolved
Comment on lines +1597 to +1612
ContentDialogResult warningResult = co_await _ShowCloseReadOnlyDialog();

// The primary action is canceling the action
if (warningResult == ContentDialogResult::Primary)
{
co_return;
}

// Clean read-only mode to prevent additional prompt if closing the pane triggers closing of a hosting tab
if (control.ReadOnly())
{
control.ToggleReadOnly();
}
}

pane->Close();
Copy link
Member

Choose a reason for hiding this comment

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

Note to self: what happens if we run sleep 5 ; exit, then during the sleep mark a pane as read-only, then try to close the pane, then wait before confirming. We'll get the dialog, then the pane will close on its own, then we'll try to close it again. Is that fine (probably)?

Copy link
Member

Choose a reason for hiding this comment

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

Yea probably, because of the atomic added in Pane

Copy link
Member

Choose a reason for hiding this comment

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

Yea, this was fine. Nothing to worry about here.

@zadjii-msft zadjii-msft removed their assignment Feb 3, 2021
@cinnamon-msft
Copy link
Contributor

I could see this in the Panes page of our docs, and also in our Tips and Tricks page. :)

I'm happy to write up the docs for the 1.7 release with this!

@Don-Vito
Copy link
Contributor Author

Don-Vito commented Feb 4, 2021

@zadjii-msft - what are the next steps here? I am worried about conflicts with #9024 😊

@Don-Vito
Copy link
Contributor Author

Don-Vito commented Feb 4, 2021

I could see this in the Panes page of our docs, and also in our Tips and Tricks page. :)

I'm happy to write up the docs for the 1.7 release with this!

I have created an issue in the docs repo: MicrosoftDocs/terminal#241

@PankajBhojwani
Copy link
Contributor

PankajBhojwani commented Feb 4, 2021

what are the next steps here? I am worried about conflicts with #9024 😊

I anticipate that #9024 is going to take a while to both be finished and get signoffs, so my opinion is that we should merge this first and I'll deal with the conflicts over there

@Don-Vito
Copy link
Contributor Author

Don-Vito commented Feb 8, 2021

@zadjii-msft - can I somehow help moving this forward? Actually there is a conflict..

@zadjii-msft
Copy link
Member

Whoops, that's my B for not slapping automerge on this. I've resolved the conflict with #9034, and hopefully that will automerge itself in ~15 minutes. Sorry about that!

@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Feb 8, 2021
@ghost
Copy link

ghost commented Feb 8, 2021

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@Don-Vito
Copy link
Contributor Author

Don-Vito commented Feb 8, 2021

@zadjii-msft - there was some build error, so I re-merged. And now it is not auto-merge anymore 😊

@ghost ghost removed the AutoMerge Marked for automatic merge by the bot when requirements are met label Feb 8, 2021
@Don-Vito
Copy link
Contributor Author

Don-Vito commented Feb 8, 2021

Seems to be building now 😛

@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Feb 8, 2021
@ghost ghost merged commit 3230b18 into microsoft:main Feb 8, 2021
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

Well done. Thanks!

@rluvaton
Copy link

Great feature! In which version this will be available?

@DHowett
Copy link
Member

DHowett commented Feb 27, 2021

Any feature pull request that is merged will be available in the preview build that comes out after it was merged. Usually. :)

@rluvaton
Copy link

Any feature pull request that is merged will be available in the preview build that comes out after it was merged. Usually. :)

Yeah, but I don't see it in the release notes

@DHowett
Copy link
Member

DHowett commented Feb 27, 2021

Preview version 1.7 hasn’t been released yet, so I am not sure what release notes you’re talking about 😄

@rluvaton
Copy link

rluvaton commented Feb 27, 2021

@DHowett Ohh, thanks! by the way, this is the BEST terminal I ever use! thank you so much for the active development and bringing cool and useful features in no time!

Can't wait for this to be the default terminal.
Don't know how I used such bad terminals before!

@Don-Vito Don-Vito deleted the 6981-readonly-tabs branch February 28, 2021 17:13
@ghost
Copy link

ghost commented Mar 1, 2021

🎉Windows Terminal Preview v1.7.572.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read-only session mode to prevent accidentally killing a long-lived process
7 participants