-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Set the cursor to the place where a user hits tab key #7299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| } | ||
| if (scrollRows > 0) | ||
| { | ||
| // The following can be possibly replaced by Console.Write ("\x1b[" + scrollRows + "S"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on PowerShell/PSReadLine#724, I'd remove this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
BrucePay
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| // 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add comment why did change was made?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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