mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-06 11:20:11 +01:00
Compare commits
3 Commits
issue/2543
...
issue/1930
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20be935677 | ||
|
|
87c65f9eec | ||
|
|
971c7e9fba |
@@ -18,13 +18,28 @@ 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
|
||||
|
||||
TODO: Add settings documentation
|
||||
| Setting | Description |
|
||||
|---------|-------------|
|
||||
| `ShowCustomPreview` | When enabled, shows AI-generated results in a preview window before pasting. Does not affect AI credit consumption. |
|
||||
|
||||
## Future Improvements
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
// ImageSizeReorderHelper.cs
|
||||
// Fix for Issue #1930: Allow reordering the default sizes in Image Resizer
|
||||
// Provides drag-drop reordering support for size presets
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace ImageResizer.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper for reordering Image Resizer size presets.
|
||||
/// </summary>
|
||||
public static class ImageSizeReorderHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Moves an item in the collection from one index to another.
|
||||
/// </summary>
|
||||
public static void MoveItem<T>(ObservableCollection<T> collection, int fromIndex, int toIndex)
|
||||
{
|
||||
if (collection == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(collection));
|
||||
}
|
||||
|
||||
if (fromIndex < 0 || fromIndex >= collection.Count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(fromIndex));
|
||||
}
|
||||
|
||||
if (toIndex < 0 || toIndex >= collection.Count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(toIndex));
|
||||
}
|
||||
|
||||
if (fromIndex == toIndex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var item = collection[fromIndex];
|
||||
collection.RemoveAt(fromIndex);
|
||||
collection.Insert(toIndex, item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves an item up in the list (decreases index).
|
||||
/// </summary>
|
||||
public static bool MoveUp<T>(ObservableCollection<T> collection, int index)
|
||||
{
|
||||
if (index <= 0 || index >= collection.Count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
MoveItem(collection, index, index - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves an item down in the list (increases index).
|
||||
/// </summary>
|
||||
public static bool MoveDown<T>(ObservableCollection<T> collection, int index)
|
||||
{
|
||||
if (index < 0 || index >= collection.Count - 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
MoveItem(collection, index, index + 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,7 @@ namespace CentralizedKeyboardHook
|
||||
.win = (GetAsyncKeyState(VK_LWIN) & 0x8000) || (GetAsyncKeyState(VK_RWIN) & 0x8000),
|
||||
.ctrl = static_cast<bool>(GetAsyncKeyState(VK_CONTROL) & 0x8000),
|
||||
.shift = static_cast<bool>(GetAsyncKeyState(VK_SHIFT) & 0x8000),
|
||||
.alt = (GetAsyncKeyState(VK_MENU) & 0x8000) || (GetAsyncKeyState(VK_LMENU) & 0x8000) || (GetAsyncKeyState(VK_RMENU) & 0x8000),
|
||||
.alt = static_cast<bool>(GetAsyncKeyState(VK_MENU) & 0x8000),
|
||||
.key = static_cast<unsigned char>(keyPressInfo.vkCode)
|
||||
};
|
||||
|
||||
|
||||
@@ -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 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>
|
||||
<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>
|
||||
</data>
|
||||
<data name="Oobe_AdvancedPaste.Title" xml:space="preserve">
|
||||
<value>Advanced Paste</value>
|
||||
|
||||
Reference in New Issue
Block a user