terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Implement InitialPosition and CenterOnLaunch in the SUI

Open PankajBhojwani opened this issue 3 years ago • 7 comments
trafficstars

Summary of the Pull Request

InitialPosition and CenterOnLaunch can now be edited in the SUI

PR Checklist

  • [x] Closes #9075
  • [x] CLA signed. If not, go over here and sign the CLA
  • [ ] Tests added/passed
  • [ ] Documentation updated. If checked, please file a pull request on our docs repo and link it here: #xxx
  • [ ] Schema updated.
  • [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

InitialPosition follows the same style as LaunchSize, with a number box for the x coordinate and a number box for the y coordinate. When there is no value for either of these coordinates, the respective number box is empty (and displays the text Undefined).

Validation Steps Performed

They work

PankajBhojwani avatar Jul 26 '22 20:07 PankajBhojwani

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view or the :scroll:action log for details.

Unrecognized words (2)

XBox YBox

Previously acknowledged words that are now absent AOn AStomps Childitem
To accept :heavy_check_mark: these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the [email protected]:microsoft/terminal.git repository on the dev/pabhoj/dxd_sui branch (:information_source: how do I use this?):

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spelling/expect/alphabet.txt
.github/actions/spelling/expect/expect.txt
.github/actions/spelling/expect/web.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect/6c2316df44779deb9480c769e3354187660e6736.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
-H "Content-Type: application/json" \
"https://api.github.com/repos/microsoft/terminal/issues/comments/1195971564" > "$comment_json"
comment_body=$(mktemp)
jq -r ".body // empty" "$comment_json" | tr -d "\\r" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")

patch_add=$(perl -e '$/=undef; $_=<>; if (m{Unrecognized words[^<]*</summary>\n*```\n*([^<]*)```\n*</details>$}m) { print "$1" } elsif (m{Unrecognized words[^<]*\n\n((?:\w.*\n)+)\n}m) { print "$1" };' < "$comment_body")

update_files
rm $comment_body
git add -u

Available dictionaries could cover words not in the dictionary

This includes both expected items (2856) from .github/actions/spelling/expect/alphabet.txt .github/actions/spelling/expect/expect.txt .github/actions/spelling/expect/web.txt and unrecognized words (2)

cspell:filetypes/filetypes.txt (337) covers 36 of them cspell:django/django.txt (2342) covers 23 of them cspell:html/html.txt (542) covers 22 of them cspell:aws/aws.txt (1485) covers 20 of them cspell:fullstack/fullstack.txt (181) covers 19 of them

Consider adding them using (in .github/workflows/spelling2.yml):

      with:
        extra_dictionaries:
          cspell:filetypes/filetypes.txt
          cspell:django/django.txt
          cspell:html/html.txt
          cspell:aws/aws.txt
          cspell:fullstack/fullstack.txt

To stop checking additional dictionaries, add:

      with:
        check_extra_dictionaries: ''
:pencil2: Contributor please read this

By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.

:warning: The command is written for posix shells. If it doesn't work for you, you can manually add (one word per line) / remove items to expect.txt and the excludes.txt files.

If the listed items are:

  • ... misspelled, then please correct them instead of using the command.
  • ... names, please add them to .github/actions/spelling/allow/names.txt.
  • ... APIs, you can add them to a file in .github/actions/spelling/allow/.
  • ... just things you're using, please add them to an appropriate file in .github/actions/spelling/expect/.
  • ... tokens you only need in one place and shouldn't generally be used, you can add an item in an appropriate file in .github/actions/spelling/patterns/.

See the README.md in each directory for more information.

:microscope: You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. :wink:

:clamp: If the flagged items are false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Jul 26 '22 20:07 github-actions[bot]

screenshot: image

PankajBhojwani avatar Jul 26 '22 20:07 PankajBhojwani

Should we put Center on Launch inside the expander for position? it's categorically related

DHowett avatar Jul 26 '22 21:07 DHowett

Consensus from discussion:

  • Remove CenterOnLaunch as a setting in the UI, add it as an enum option to LaunchMode and the VM can handle the backend of mapping that enum to our internal CenterOnLaunch
  • Combine the LaunchMode combo box and the LaunchPosition number boxes into one expander

Follow up in a future PR:

  • Add a button Use current position that will populate the fields according to the Terminal's current position

PankajBhojwani avatar Aug 01 '22 21:08 PankajBhojwani

(Given the consensus opinion, How do you propose to have "centered focus mode" as a launch mode in the drop-down?)

DHowett avatar Aug 01 '22 22:08 DHowett

How do you propose to have "centered focus mode" as a launch mode in the drop-down?

Okay fine, we need "Centered focus mode" in there too. But "Centered Maximized*" seemed viable to leave out. Technically yea you can have it launch centered (and maximize itself), and then restore down to centered. This design occludes that particular combination of settings for presenting the user something more sensible.

If we're dead set on including that as a separate toggle, I'd instead propose:

A set of controls under the Launch Positioning expander.

  • The "launch mode" dropdown
  • Positioning radio buttons
    • Position manually
      • An X/Y input
        • The "use current position" button
    • Use system default
  • A toggle for "center on launch

Heck, it doesn't even need to be one expando then. Could be three:

  • mode
  • position (with the system default checkbox, ala the "desktopBackground" checkbox in the profile appearance page, and eventually the "use current pos" button)
  • center on launch

Maybe we hoped on the "add center to the dropdown" crazy idea train too fast. <discuss more>

zadjii-msft avatar Aug 02 '22 12:08 zadjii-msft

PXL_20220912_211433391

zadjii-msft avatar Sep 12 '22 22:09 zadjii-msft

updated screenshots:

image image

PankajBhojwani avatar Sep 27 '22 18:09 PankajBhojwani

Hello @PankajBhojwani!

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.

ghost avatar Oct 05 '22 19:10 ghost

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

Handy links:

ghost avatar Jan 24 '23 18:01 ghost