Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/policies/resourceManagement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,17 @@ configuration:
- addLabel:
label: 'Needs-Attention :wave:'
description:
- if:
- payloadType: Issues
- and:
- isOpen
- not:
and:
- isAssignedToSomeone
- isLabeled
then:
- addLabel:
label: 'Needs-Triage :mag:'
description: 'Adding needs triage label to newly opened issues'
onFailure:
onSuccess:
2 changes: 1 addition & 1 deletion .github/workflows/IssuePreTriage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: do-work
run: |
Expand Down
2 changes: 1 addition & 1 deletion MockPSConsole/MockPSConsole.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.PowerShell.SDK" version="7.2.0" />
<PackageReference Include="Microsoft.PowerShell.SDK" version="7.2.13" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 12 additions & 0 deletions PSReadLine/Changes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
### [2.3.2-beta2] - 2023-08-17

- Work around `InvalidOperationException` from Console API (#3755) (Thanks @jazzdelightsme!)
- Add the `TerminateOrphanedConsoleApps` option on Windows to kill orphaned console-attached process that may mess up reading from Console input (#3764) (Thanks @jazzdelightsme!)
- Fix bot to add `needs-triage` label to newly opened issue (#3772)
- Update `actions/checkout` used in GitHub action to v3 (#3773)
- Supports the text-object command `diw` in the VI edit mode (#2059) (Thanks @springcomp!)
- Fix `NullReferenceException` when processing event subscribers (#3781)
- Point to `F7History` in the comment of the `F7` key-binding sample (#3782)

[2.3.2-beta2]: https://github.com/PowerShell/PSReadLine/compare/v2.3.1-beta1...v2.3.2-beta2

### [2.3.1-beta1] - 2023-05-03

- Append reset VT sequence before rendering the ineline prediction (#3669)
Expand Down
12 changes: 11 additions & 1 deletion PSReadLine/Cmdlets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public class PSConsoleReadLineOptions
public const int DefaultCompletionQueryItems = 100;

// Default includes all characters PowerShell treats like a dash - em dash, en dash, horizontal bar
public const string DefaultWordDelimiters = @";:,.[]{}()/\|^&*-=+'""" + "\u2013\u2014\u2015";
public const string DefaultWordDelimiters = @";:,.[]{}()/\|!?^&*-=+'""" + "\u2013\u2014\u2015";

/// <summary>
/// When ringing the bell, what should be done?
Expand Down Expand Up @@ -502,6 +502,8 @@ public object ListPredictionTooltipColor
set => _listPredictionTooltipColor = VTColorUtils.AsEscapeSequence(value);
}

public bool TerminateOrphanedConsoleApps { get; set; }

internal string _defaultTokenColor;
internal string _commentColor;
internal string _keywordColor;
Expand Down Expand Up @@ -808,6 +810,14 @@ public PredictionViewStyle PredictionViewStyle
[Parameter]
public Hashtable Colors { get; set; }

[Parameter]
public SwitchParameter TerminateOrphanedConsoleApps
{
get => _terminateOrphanedConsoleApps.GetValueOrDefault();
set => _terminateOrphanedConsoleApps = value;
}
internal SwitchParameter? _terminateOrphanedConsoleApps;

[ExcludeFromCodeCoverage]
protected override void EndProcessing()
{
Expand Down
18 changes: 18 additions & 0 deletions PSReadLine/KeyBindings.vi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ internal static ConsoleColor AlternateBackground(ConsoleColor bg)
private static Dictionary<PSKeyInfo, KeyHandler> _viChordCTable;
private static Dictionary<PSKeyInfo, KeyHandler> _viChordYTable;
private static Dictionary<PSKeyInfo, KeyHandler> _viChordDGTable;
private static Dictionary<PSKeyInfo, KeyHandler> _viChordDQuoteTable;

private static Dictionary<PSKeyInfo, KeyHandler> _viChordTextObjectsTable;

private static Dictionary<PSKeyInfo, Dictionary<PSKeyInfo, KeyHandler>> _viCmdChordTable;
private static Dictionary<PSKeyInfo, Dictionary<PSKeyInfo, KeyHandler>> _viInsChordTable;
Expand Down Expand Up @@ -216,6 +219,7 @@ private void SetDefaultViBindings()
{ Keys.Comma, MakeKeyHandler(RepeatLastCharSearchBackwards, "RepeatLastCharSearchBackwards") },
{ Keys.AltH, MakeKeyHandler(ShowParameterHelp, "ShowParameterHelp") },
{ Keys.F1, MakeKeyHandler(ShowCommandHelp, "ShowCommandHelp") },
{ Keys.DQuote, MakeKeyHandler(ViChord, "ChordFirstKey") },
};

// Some bindings are not available on certain platforms
Expand All @@ -238,6 +242,7 @@ private void SetDefaultViBindings()
{ Keys.ucG, MakeKeyHandler( DeleteEndOfBuffer, "DeleteEndOfBuffer") },
{ Keys.ucE, MakeKeyHandler( ViDeleteEndOfGlob, "ViDeleteEndOfGlob") },
{ Keys.H, MakeKeyHandler( BackwardDeleteChar, "BackwardDeleteChar") },
{ Keys.I, MakeKeyHandler( ViChordDeleteTextObject, "ChordViTextObject") },
{ Keys.J, MakeKeyHandler( DeleteNextLines, "DeleteNextLines") },
{ Keys.K, MakeKeyHandler( DeletePreviousLines, "DeletePreviousLines") },
{ Keys.L, MakeKeyHandler( DeleteChar, "DeleteChar") },
Expand Down Expand Up @@ -296,11 +301,23 @@ private void SetDefaultViBindings()
{ Keys.Percent, MakeKeyHandler( ViYankPercent, "ViYankPercent") },
};

_viChordTextObjectsTable = new Dictionary<PSKeyInfo, KeyHandler>
{
{ Keys.W, MakeKeyHandler(ViHandleTextObject, "WordTextObject")},
};

_viChordDGTable = new Dictionary<PSKeyInfo, KeyHandler>
{
{ Keys.G, MakeKeyHandler( DeleteRelativeLines, "DeleteRelativeLines") },
};

_viChordDQuoteTable = new Dictionary<PSKeyInfo, KeyHandler>
{
{ Keys.DQuote, MakeKeyHandler( ViSelectNamedRegister, "ViSelectNamedRegister" ) },
{ Keys.Plus, MakeKeyHandler( ViSelectNamedRegister, "ViSelectNamedRegister" ) },
{ Keys.Underbar, MakeKeyHandler( ViSelectNamedRegister, "ViSelectNamedRegister" ) },
};

_viCmdChordTable = new Dictionary<PSKeyInfo, Dictionary<PSKeyInfo, KeyHandler>>();
_viInsChordTable = new Dictionary<PSKeyInfo, Dictionary<PSKeyInfo, KeyHandler>>();

Expand All @@ -310,6 +327,7 @@ private void SetDefaultViBindings()
_viCmdChordTable[Keys.D] = _viChordDTable;
_viCmdChordTable[Keys.C] = _viChordCTable;
_viCmdChordTable[Keys.Y] = _viChordYTable;
_viCmdChordTable[Keys.DQuote] = _viChordDQuoteTable;

_normalCursorSize = _console.CursorSize;
if ((_normalCursorSize < 1) || (_normalCursorSize > 100))
Expand Down
18 changes: 18 additions & 0 deletions PSReadLine/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Management.Automation;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using Microsoft.PowerShell.PSReadLine;

Expand Down Expand Up @@ -167,6 +169,22 @@ private void SetOptionsInternal(SetPSReadLineOption options)
}
}
}
if (options._terminateOrphanedConsoleApps.HasValue)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Options.TerminateOrphanedConsoleApps = options.TerminateOrphanedConsoleApps;
PlatformWindows.SetTerminateOrphanedConsoleApps(Options.TerminateOrphanedConsoleApps);
}
else
{
throw new PlatformNotSupportedException(
string.Format(
CultureInfo.CurrentUICulture,
PSReadLineResources.OptionNotSupportedOnNonWindows,
nameof(Options.TerminateOrphanedConsoleApps)));
}
}
}

private void SetKeyHandlerInternal(string[] keys, Action<ConsoleKeyInfo?, object> handler, string briefDescription, string longDescription, ScriptBlock scriptBlock)
Expand Down
8 changes: 4 additions & 4 deletions PSReadLine/PSReadLine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<RootNamespace>Microsoft.PowerShell.PSReadLine</RootNamespace>
<AssemblyName>Microsoft.PowerShell.PSReadLine2</AssemblyName>
<NoWarn>$(NoWarn);CA1416</NoWarn>
<AssemblyVersion>2.3.1.0</AssemblyVersion>
<FileVersion>2.3.1</FileVersion>
<InformationalVersion>2.3.1-beta1</InformationalVersion>
<AssemblyVersion>2.3.2.0</AssemblyVersion>
<FileVersion>2.3.2</FileVersion>
<InformationalVersion>2.3.2-beta2</InformationalVersion>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
Expand All @@ -22,7 +22,7 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="System.Management.Automation" Version="7.2.0" />
<PackageReference Include="System.Management.Automation" Version="7.2.13" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions PSReadLine/PSReadLine.format.ps1xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ $d = [Microsoft.PowerShell.KeyHandler]::GetGroupingDescription($_.Group)
<ListItem>
<PropertyName>PredictionViewStyle</PropertyName>
</ListItem>
<ListItem>
<PropertyName>TerminateOrphanedConsoleApps</PropertyName>
</ListItem>
<ListItem>
<Label>CommandColor</Label>
<ScriptBlock>[Microsoft.PowerShell.VTColorUtils]::FormatColor($_.CommandColor)</ScriptBlock>
Expand Down
2 changes: 1 addition & 1 deletion PSReadLine/PSReadLine.psd1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@{
RootModule = 'PSReadLine.psm1'
NestedModules = @("Microsoft.PowerShell.PSReadLine2.dll")
ModuleVersion = '2.3.1'
ModuleVersion = '2.3.2'
GUID = '5714753b-2afd-4492-a5fd-01d9e2cff8b5'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Expand Down
11 changes: 11 additions & 0 deletions PSReadLine/PSReadLineResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions PSReadLine/PSReadLineResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -873,4 +873,7 @@ Or not saving history with:
<data name="UpcaseWordDescription" xml:space="preserve">
<value>Find the next word starting from the current position and then make it upper case.</value>
</data>
<data name="OptionNotSupportedOnNonWindows" xml:space="preserve">
<value>The '{0}' option is not supported on non-Windows platforms.</value>
</data>
</root>
Loading