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

Ability to save selected text as a sendInput action #12857

Closed
Tracked by #13000
zadjii-msft opened this issue Apr 8, 2022 · 2 comments · Fixed by #16513
Closed
Tracked by #13000

Ability to save selected text as a sendInput action #12857

zadjii-msft opened this issue Apr 8, 2022 · 2 comments · Fixed by #16513
Assignees
Labels
Area-Settings Issues related to settings and customizability, for console or terminal good first issue This is a fix that might be easier for someone to do as a first contribution Help Wanted We encourage anyone to jump in on these. In-PR This issue has a related PR Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.

Comments

@zadjii-msft
Copy link
Member

zadjii-msft commented Apr 8, 2022

I write some long command. I need to use this frequently (or infrequently), but I don't want to have to remember all the args. I want to be able to pull it up straight from the command palette. So I want to write the command once, select it, and {perform some action}1 that lets me save it as a sendInput action.

The action should

  • immediately save it.
  • provide a UI2 for immediately editing3 the name, contents of this action, because Send "git log --graph --abbrev-commit --decorate..." to the Terminal is not useful to anyone.

Just doing the immediate save would be a good enough start on this, to the point I'd consider that an easy starter. The UI - that's Hard, for reasons listed below.

Note

Walkthrough

As an initial version of this, it's more than good enough to just save the selected text as an action without the UI. We can iterate on the UI in follow-ups.

  • Probably start with something like dev/migrie/fhl/save-command
  • We probably want to skip all the AppCommandlineArgs stuff for now. That's spicier.
  • in TerminalPage::_HandleSaveTask, we will want to try and save the current selection as a sendInput action, if there's no commandline specified.
  • AppActionHandlers.cpp has plenty of examples of getting the active control. Should be easy enough to get the selected text from it.
  • We'll probably want to generate the name of this action (without a commandline) as "Save Task..."
  • Over and above: It would be valuable to Toast the user with a message "Saved selected text as a new action". TerminalPage::IdentifyWindow has an example of a Toast

Footnotes

  1. Obviously, easiest way is via cmdpal or keybinding. Also consider a right-click context menu entry, Request: Right-click menu inside TerminalControl (w/ Copy & Paste?) #3337

  2. This has it's own challenges. It can't be a ContentDialog (https://github.com/microsoft/microsoft-ui-xaml/issues/3804). It could be nested in a Flyout, maybe. Hopefully the dialog thing is limited just to ContentDialogs and not all Flyouts. It probably shouldn't be a TeachingTip (Auto-focus window renamer textbox on open #12798). We could roll our own ContentDialog for this of course (Warn before the user runs a new commandline elevated #11308).

  3. Might be tricky - we'd have to hand on to an instance of the actual Command itself, so we can edit it... in place? and hopefully writing to the settings would then just refresh all the other name->command maps instantly.

@zadjii-msft zadjii-msft added Help Wanted We encourage anyone to jump in on these. Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal. Issue-Task It's a feature request, but it doesn't really need a major design. good first issue This is a fix that might be easier for someone to do as a first contribution labels Apr 8, 2022
@zadjii-msft zadjii-msft added this to the Backlog milestone Apr 8, 2022
@ghost ghost added the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Apr 8, 2022
@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Apr 8, 2022
@zadjii-msft zadjii-msft moved this to Should be written in Terminal Walkthroughs Feb 6, 2023
@zadjii-msft zadjii-msft moved this from Should be written to Walkthrough in issue in Terminal Walkthroughs Jul 10, 2023
@shubhamvrs
Copy link

/assign

@Ben-EJ
Copy link

Ben-EJ commented Dec 4, 2023

Can I work on this? : )

@zadjii-msft zadjii-msft added the In-PR This issue has a related PR label May 28, 2024
@zadjii-msft zadjii-msft modified the milestones: Backlog, Terminal v1.22 Jun 11, 2024
github-merge-queue bot pushed a commit that referenced this issue Jun 22, 2024
This specs out a lot of plans for snippets. We've already got these in
the sxnui as "tasks", but we can do so very much more.

This spec is a few years old now, but it's time for it to get promoted
out of my draft branch.

References: 
* #1595
* #7039
* #3121
* #10436
* #12927
* #12857
* #5790
* #15845

---------

Co-authored-by: Dustin L. Howett <duhowett@microsoft.com>
github-merge-queue bot pushed a commit that referenced this issue Jul 2, 2024
Hi wanted to make an attempt at
[12857](#12857). This still
needs work but I think the initial version is ready to be reviewed.

## Summary of the Pull Request

Mostly copied from:
6f5b9fb...1cde67a

- Save to disk
- If command line is empty use selection
- Show toast
- No UI.  Trying out the different options now.

## PR Checklist
- [ ] Closes #12857
- [ ] Tests added/passed
- [ ] Documentation updated
- If checked, please file a pull request on [our docs
repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
- [ ] Schema updated (if necessary)

---------

Co-authored-by: Mike Griese <migrie@microsoft.com>
@github-project-automation github-project-automation bot moved this from Walkthrough in issue to Done in Terminal Walkthroughs Jul 2, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal good first issue This is a fix that might be easier for someone to do as a first contribution Help Wanted We encourage anyone to jump in on these. In-PR This issue has a related PR Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants