refactor(prompt): explicitly enable cursor positioning

This commit is contained in:
Jan De Dobbeleer 2024-07-06 20:47:47 +02:00 committed by Jan De Dobbeleer
parent a2ee64f3b9
commit b103581ed6
4 changed files with 39 additions and 39 deletions

View file

@ -77,7 +77,7 @@ func runInit(shellName string) {
for i, block := range cfg.Blocks {
// only fetch cursor position when relevant
if !cfg.DisableCursorPositioning && (i == 0 && block.Newline) {
if cfg.EnableCursorPositioning && (i == 0 && block.Newline) {
shell.CursorPositioning = true
}

View file

@ -35,7 +35,7 @@ type Config struct {
ShellIntegration bool `json:"shell_integration,omitempty" toml:"shell_integration,omitempty"`
PWD string `json:"pwd,omitempty" toml:"pwd,omitempty"`
Var map[string]any `json:"var,omitempty" toml:"var,omitempty"`
DisableCursorPositioning bool `json:"disable_cursor_positioning,omitempty" toml:"disable_cursor_positioning,omitempty"`
EnableCursorPositioning bool `json:"enable_cursor_positioning,omitempty" toml:"enable_cursor_positioning,omitempty"`
PatchPwshBleed bool `json:"patch_pwsh_bleed,omitempty" toml:"patch_pwsh_bleed,omitempty"`
DisableNotice bool `json:"disable_notice,omitempty" toml:"disable_notice,omitempty"`
AutoUpgrade bool `json:"auto_upgrade,omitempty" toml:"auto_upgrade,omitempty"`

View file

@ -4721,9 +4721,9 @@
"description": "https://ohmyposh.dev/docs/configuration/general#general-settings",
"default": true
},
"disable_cursor_positioning": {
"enable_cursor_positioning": {
"type": "boolean",
"title": "Disable Cursor Positioning",
"title": "Enable Cursor Positioning",
"description": "https://ohmyposh.dev/docs/configuration/general#general-settings",
"default": false
},

View file

@ -127,14 +127,14 @@ For example, the following is a valid `--config` flag:
## General Settings
| Name | Type | Description |
| ---------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| --------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `final_space` | `boolean` | when true adds a space at the end of the prompt |
| `pwd` | `string` | notify terminal of current working directory, values can be `osc99`, `osc7` or `osc51` depending on your terminal. Supports [templates][templates] |
| `terminal_background` | `string` | [color][colors] - terminal background color, set to your terminal's background color when you notice black elements in Windows Terminal or the Visual Studio Code integrated terminal |
| `accent_color` | `string` | [color][colors] - accent color, used as a fallback when the `accent` [color][accent] is not supported |
| `var` | `map[string]any` | config variables to use in [templates][templates]. Can be any value |
| `shell_integration` | `boolean` | enable shell integration using FinalTerm's OSC sequences. Works in bash, cmd (Clink v1.14.25+), fish, powershell and zsh |
| `disable_cursor_positioning` | `boolean` | disable fetching the cursor position in bash and zsh in case of unwanted side-effects |
| `enable_cursor_positioning` | `boolean` | enable fetching the cursor position in bash and zsh to allow automatic hiding of leading newlines when at the top of the shell |
| `patch_pwsh_bleed` | `boolean` | patch a PowerShell bug where the background colors bleed into the next line at the end of the buffer (can be removed when [this][pwsh-bleed] is merged) |
| `disable_notice` | `boolean` | disables the notice that a new upgrade is available when `auto_upgrade` is disabled, and the notice that no new upgrade is available when `auto_upgrade` is enabled |
| `auto_upgrade` | `boolean` | enable automatic upgrades for Oh My Posh (supports Windows, macOS and Linux) |