mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-26 03:24:04 -08:00
refactor: align tooltip behaviors
This commit is contained in:
parent
9606d5a105
commit
fccdfe5306
|
@ -49,9 +49,9 @@ You need to extend or create a custom theme with your tooltips. For example:
|
|||
}
|
||||
```
|
||||
|
||||
This configuration will render a right-aligned git segment when you type `git` or `g` followed by a space. Keep in mind that
|
||||
this is a blocking call, meaning that if the segment renders slow, you can't type until it's visible. Optimizations in this space
|
||||
are being explored.
|
||||
This configuration will render a right-aligned git segment when you type `git` or `g` followed by a space.
|
||||
A tip should not include any leading or trailing space but an interpolated one can be used, e.g., `g s`.
|
||||
Keep in mind that this is a blocking call, meaning that if the segment renders slow, you can't type until it's visible. Optimizations in this space are being explored.
|
||||
|
||||
## Enable the feature
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@ New-Module -Name "oh-my-posh-core" -ScriptBlock {
|
|||
$command = $null
|
||||
$cursor = $null
|
||||
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$command, [ref]$cursor)
|
||||
$command = ($command -split " ")[0]
|
||||
$standardOut = @(Start-Utf8Process $script:OMPExecutable @("print", "tooltip", "--pwd=$cleanPWD", "--pswd=$cleanPSWD", "--config=$env:POSH_THEME", "--command=$command", "--shell-version=$script:PSVersion"))
|
||||
Write-Host $standardOut -NoNewline
|
||||
$host.UI.RawUI.CursorPosition = $position
|
||||
|
|
|
@ -42,7 +42,7 @@ if [ "$TERM" != "linux" ]; then
|
|||
_install-omp-hooks
|
||||
fi
|
||||
|
||||
function self-insert() {
|
||||
function _render_tooltip() {
|
||||
# ignore an empty buffer
|
||||
if [[ -z "$BUFFER" ]]; then
|
||||
zle .self-insert
|
||||
|
@ -58,7 +58,8 @@ function self-insert() {
|
|||
}
|
||||
|
||||
function enable_poshtooltips() {
|
||||
zle -N self-insert
|
||||
zle -N _render_tooltip
|
||||
bindkey " " _render_tooltip
|
||||
}
|
||||
|
||||
_posh-zle-line-init() {
|
||||
|
|
Loading…
Reference in a new issue