Skip to content

Commit 411c602

Browse files
committed
Merge branch 'master' of https://github.com/PowerShell/PSReadLine into sqliteHistory
2 parents e8d89a9 + 5863e8d commit 411c602

File tree

5 files changed

+123
-7
lines changed

5 files changed

+123
-7
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ PSReadline.zip
99
[Oo]bj/
1010
.ionide/
1111

12-
# VSCode directories that are not at the repository root
13-
/**/.vscode/
14-
1512
# mstest test results
1613
TestResults
1714
FakesAssemblies/

.vscode/launch.json

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,24 @@
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7-
7+
{
8+
"name": "Launch PSReadLine",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"program": "pwsh",
12+
"args": [
13+
"-NonInteractive",
14+
"-NoProfile",
15+
"-NoExit",
16+
"-Command",
17+
"Import-Module '${workspaceFolder}/PSReadLine/bin/Debug/netstandard2.0/PSReadLine.psd1'"
18+
],
19+
"console": "integratedTerminal",
20+
"justMyCode": false,
21+
"suppressJITOptimizations": true,
22+
"enableStepFiltering": false,
23+
"preLaunchTask": "Build",
24+
},
825
{
926
"name": ".NET Core Attach",
1027
"type": "coreclr",
@@ -16,4 +33,4 @@
1633
}
1734
}
1835
]
19-
}
36+
}

.vscode/tasks.json

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Bootstrap",
6+
"type": "shell",
7+
"command": "pwsh",
8+
"args": [
9+
"./build.ps1",
10+
"-Bootstrap"
11+
],
12+
"group": "build",
13+
"detail": "Install build prerequisites (InvokeBuild, .NET SDK)"
14+
},
15+
{
16+
"label": "Build",
17+
"type": "shell",
18+
"command": "pwsh",
19+
"args": [
20+
"./build.ps1",
21+
"-Configuration",
22+
"${input:configuration}"
23+
],
24+
"group": {
25+
"kind": "build",
26+
"isDefault": true
27+
},
28+
"problemMatcher": [
29+
"$msCompile"
30+
],
31+
"detail": "Build with user-selected configuration"
32+
},
33+
{
34+
"label": "Run Tests",
35+
"type": "shell",
36+
"command": "pwsh",
37+
"args": [
38+
"./build.ps1",
39+
"-Test",
40+
"-Configuration",
41+
"${input:configuration}",
42+
"-Framework",
43+
"${input:framework}"
44+
],
45+
"group": {
46+
"kind": "test",
47+
"isDefault": true
48+
},
49+
"presentation": {
50+
"focus": true,
51+
"panel": "dedicated",
52+
"clear": true
53+
},
54+
"detail": "Run unit tests with selected configuration and framework"
55+
},
56+
{
57+
"label": "Clean",
58+
"type": "shell",
59+
"command": "pwsh",
60+
"args": [
61+
"./build.ps1",
62+
"-Clean"
63+
],
64+
"group": "build",
65+
"detail": "Clean build artifacts"
66+
}
67+
],
68+
"inputs": [
69+
{
70+
"id": "configuration",
71+
"description": "Build Configuration",
72+
"type": "pickString",
73+
"options": [
74+
"Debug",
75+
"Release"
76+
],
77+
"default": "Debug"
78+
},
79+
{
80+
"id": "framework",
81+
"description": "Target Framework",
82+
"type": "pickString",
83+
"options": [
84+
"net472",
85+
"net6.0"
86+
],
87+
"default": "net6.0"
88+
}
89+
]
90+
}

PSReadLine/ReadLine.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,16 +1047,28 @@ public static void DigitArgument(ConsoleKeyInfo? key = null, object arg = null)
10471047
public static void InvokePrompt(ConsoleKeyInfo? key = null, object arg = null)
10481048
{
10491049
var console = _singleton._console;
1050-
console.CursorVisible = false;
10511050

10521051
if (arg is int newY)
10531052
{
1053+
if (newY < 0 || newY >= console.BufferHeight)
1054+
{
1055+
throw new ArgumentOutOfRangeException(nameof(arg));
1056+
}
1057+
1058+
console.CursorVisible = false;
10541059
console.SetCursorPosition(0, newY);
10551060
}
10561061
else
10571062
{
10581063
newY = _singleton._initialY - _singleton._options.ExtraPromptLineCount;
10591064

1065+
// Silently return if user has implicitly requested an impossible prompt invocation.
1066+
if (newY < 0)
1067+
{
1068+
return;
1069+
}
1070+
1071+
console.CursorVisible = false;
10601072
console.SetCursorPosition(0, newY);
10611073

10621074
// We need to rewrite the prompt, so blank out everything from a previous prompt invocation

PSReadLine/SamplePSReadLineProfile.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ Set-PSReadLineKeyHandler -Key F1 `
522522

523523
#
524524
# Ctrl+Shift+j then type a key to mark the current directory.
525-
# Ctrj+j then the same key will change back to that directory without
525+
# Ctrl+j then the same key will change back to that directory without
526526
# needing to type cd and won't change the command line.
527527

528528
#

0 commit comments

Comments
 (0)