Set the cursor to the place where a user hits tab key#7299
Set the cursor to the place where a user hits tab key#7299adityapatwardhan merged 2 commits intoPowerShell:masterfrom
Conversation
There was a problem hiding this comment.
Based on PowerShell/PSReadLine#724, I'd remove this comment.
There was a problem hiding this comment.
Removed the comment. Thanks.
|
@jianyunt I do not have the ability to check this on Unix, but definitely we have to do many manual tests to make sure everything works without regression. |
| // Only generate these exceptions if a pipeline has already been declared as the 'writing' pipeline. | ||
| // Otherwise, these are probably infrastructure messages and can be ignored. | ||
| if (this.PipelineProcessor._permittedToWrite != null) | ||
| if (this.PipelineProcessor?._permittedToWrite != null) |
There was a problem hiding this comment.
Could you add comment why did change was made?
There was a problem hiding this comment.
The line 2249 has
if (this.PipelineProcessor == null || _thisCommand != this.PipelineProcessor._permittedToWrite ...
When I debug the code, i saw nullref exceptions here.
Yes the change has nothing to do with the cursor position. But it's good to get rid of it.
There was a problem hiding this comment.
@adityapatwardhan In this case I don't think any comments are needed.
|
@adityapatwardhan This looks ready for merge. |
PR Summary
To address the issue #7022, the changes are among the following repos:
For example, in the cloudshell, when a user types
get-azurermvmacand then hitstab, we reach out to Azure to fetch the data and pwsh will show progress in the meantime, which in turn changes the cursor position. That requires PSReadLine to adjust the cursor position after calling GetCompletions().$ProgressPreference ='SilentlyContinue'at the AzurePSDrive module level for nested case, see For nested write-progress, we suppress the progress in the azurepsdrive. AzurePSDrive#53.With that, we can still show the fetching Azure data progress written by SHiPS, suppress the progress in the Get-AzureRmWebApp , but it does not change the ProgressPreference setting in the cloudshell. This means when a user type Azure cmdlet, the progress will still show. That is the behavior we want.
Please note that we cannot use `$ProgressPreference ='SilentlyContinue' for both SHiPS and its provider AzurePSDrive because fetching data from Azure can take really long time. Showing progress is needed but keep (try keeping) one progress only. Thus the above fixes are all needed.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests