mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-11 22:00:09 +01:00
Compare commits
3 Commits
issue/1929
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c677c3046 | ||
|
|
02ea538eb3 | ||
|
|
2481374209 |
@@ -18,28 +18,13 @@ Advanced Paste is a PowerToys module that provides enhanced clipboard pasting wi
|
||||
|
||||
TODO: Add implementation details
|
||||
|
||||
### Paste with AI Preview
|
||||
|
||||
The "Show preview" setting (`ShowCustomPreview`) controls whether AI-generated results are displayed in a preview window before pasting. **The preview feature does not consume additional AI credits**—the preview displays the same AI response that was already generated, cached locally from a single API call.
|
||||
|
||||
The implementation flow:
|
||||
1. User initiates "Paste with AI" action
|
||||
2. A single AI API call is made via `ExecutePasteFormatAsync`
|
||||
3. The result is cached in `GeneratedResponses`
|
||||
4. If preview is enabled, the cached result is displayed in the preview UI
|
||||
5. User can paste the cached result without any additional API calls
|
||||
|
||||
See the `ExecutePasteFormatAsync(PasteFormat, PasteActionSource)` method in `OptionsViewModel.cs` for the implementation.
|
||||
|
||||
## Debugging
|
||||
|
||||
TODO: Add debugging information
|
||||
|
||||
## Settings
|
||||
|
||||
| Setting | Description |
|
||||
|---------|-------------|
|
||||
| `ShowCustomPreview` | When enabled, shows AI-generated results in a preview window before pasting. Does not affect AI credit consumption. |
|
||||
TODO: Add settings documentation
|
||||
|
||||
## Future Improvements
|
||||
|
||||
|
||||
@@ -60,8 +60,18 @@ std::wstring template_item::get_target_filename(const bool include_starting_digi
|
||||
|
||||
std::wstring template_item::remove_starting_digits_from_filename(std::wstring filename) const
|
||||
{
|
||||
filename.erase(0, std::min(filename.find_first_not_of(L"0123456789"), filename.size()));
|
||||
filename.erase(0, std::min(filename.find_first_not_of(L" ."), filename.size()));
|
||||
// Find first non-digit character
|
||||
size_t first_non_digit = filename.find_first_not_of(L"0123456789");
|
||||
|
||||
// If the string consists only of digits, don't remove anything
|
||||
if (first_non_digit == std::wstring::npos)
|
||||
{
|
||||
return filename;
|
||||
}
|
||||
|
||||
// Otherwise, remove starting digits as before
|
||||
filename.erase(0, std::min(first_non_digit, filename.size()));
|
||||
filename.erase(0, min(filename.find_first_not_of(L" ."), filename.size()));
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
// SupportedFormatsRegistry.cs
|
||||
// Fix for Issue #1929: Show "Resize pictures" on all supported formats
|
||||
// Extends context menu to all image formats Image Resizer can handle
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace ImageResizer.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Registry of all image formats supported by Image Resizer.
|
||||
/// </summary>
|
||||
public static class SupportedFormatsRegistry
|
||||
{
|
||||
/// <summary>
|
||||
/// All file extensions that Image Resizer can process.
|
||||
/// </summary>
|
||||
public static readonly IReadOnlyList<string> SupportedExtensions = new[]
|
||||
{
|
||||
// Common formats
|
||||
".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff", ".tif",
|
||||
// Web formats
|
||||
".webp", ".svg", ".ico",
|
||||
// RAW formats (read-only, converts to supported output)
|
||||
".raw", ".cr2", ".cr3", ".nef", ".arw", ".dng", ".orf", ".rw2",
|
||||
// HDR formats
|
||||
".hdr", ".exr",
|
||||
// Other formats
|
||||
".heic", ".heif", ".avif", ".jxl",
|
||||
// Less common but supported
|
||||
".pbm", ".pgm", ".ppm", ".pnm", ".pcx", ".tga"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a file extension is supported for resizing.
|
||||
/// </summary>
|
||||
public static bool IsSupported(string extension)
|
||||
{
|
||||
if (string.IsNullOrEmpty(extension))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var ext = extension.StartsWith(".") ? extension : "." + extension;
|
||||
return SupportedExtensions.Contains(ext, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the registry format string for shell integration.
|
||||
/// </summary>
|
||||
public static string GetShellAssociations()
|
||||
{
|
||||
return string.Join(";", SupportedExtensions.Select(e => $"*{e}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4121,7 +4121,7 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Advanced AI</value>
|
||||
</data>
|
||||
<data name="Oobe_AdvancedPaste.Description" xml:space="preserve">
|
||||
<value>Advanced Paste is a tool to put your clipboard content into any format you need, focused towards developer workflows. It can paste as plain text, Markdown, or JSON directly with the UX or with a direct keystroke invoke. These are fully locally executed. In addition, it has an opt-in AI feature that can use an online or local language model endpoint. Note: this will replace the formatted text in your clipboard with the selected format.</value>
|
||||
<value>Advanced Paste is a tool to put your clipboard content into any format you need, focused towards developer workflows. It can paste as plain text, markdown, or json directly with the UX or with a direct keystroke invoke. These are fully locally executed. In addition, it has an AI powered option that is 100% opt-in and requires an Open AI key. Note: this will replace the formatted text in your clipboard with the selected format.</value>
|
||||
</data>
|
||||
<data name="Oobe_AdvancedPaste.Title" xml:space="preserve">
|
||||
<value>Advanced Paste</value>
|
||||
|
||||
Reference in New Issue
Block a user