wezterm: fix scrolling and re-enable semantic prompt

This commit is contained in:
Daniel Lundin 2024-06-21 10:52:48 +02:00
parent 0e08bdacef
commit 6bf9bf1f47
No known key found for this signature in database
2 changed files with 72 additions and 13 deletions

View file

@ -0,0 +1,57 @@
#!/usr/bin/fish
# SPDX-License-Identifier: CC0-1.0
if status --is-interactive
set _fishprompt_aid "fish"$fish_pid
set _fishprompt_started 0
# empty if running; or a numeric exit code; or CANCEL
set _fishprompt_postexec ""
functions -c fish_prompt _fishprompt_saved_prompt
set _fishprompt_prompt_count 0
set _fishprompt_disp_count 0
function _fishprompt_start --on-event fish_prompt
set _fishprompt_prompt_count (math $_fishprompt_prompt_count + 1)
# don't use post-exec, because it is called *before* omitted-newline output
if [ -n "$_fishprompt_postexec" ]
printf "\033]133;D;%s;aid=%s\007" "$_fishprompt_postexec" $_fishprompt_aid
end
printf "\033]133;A;aid=%s;cl=m\007" $_fishprompt_aid
end
function fish_prompt
set _fishprompt_disp_count (math $_fishprompt_disp_count + 1)
printf "\033]133;P;k=i\007%b\033]133;B\007" (string join "\n" (_fishprompt_saved_prompt))
set _fishprompt_started 1
set _fishprompt_postexec ""
end
function _fishprompt_preexec --on-event fish_preexec
if [ "$_fishprompt_started" = 1 ]
printf "\033]133;C;\007"
end
set _fishprompt_started 0
end
function _fishprompt_postexec --on-event fish_postexec
set _fishprompt_postexec $status
_fishprompt_start
end
function __fishprompt_cancel --on-event fish_cancel
set _fishprompt_postexec CANCEL
_fishprompt_start
end
function _fishprompt_exit --on-process %self
if [ "$_fishprompt_started" = 1 ]
printf "\033]133;Z;aid=%s\007" $_fishprompt_aid
end
end
if functions -q fish_right_prompt
functions -c fish_right_prompt _fishprompt_saved_right_prompt
function fish_right_prompt
printf "\033]133;P;k=r\007%b\033]133;B\007" (string join "\n" (_fishprompt_saved_right_prompt))
end
end
end

View file

@ -162,16 +162,16 @@ config.font_rules = {
},
}
wezterm.on('window-config-reloaded', function(window, pane)
local overrides = window:get_config_overrides() or {}
local dpi = wezterm.gui.screens().active.effective_dpi
wezterm.on("window-config-reloaded", function(window, pane)
local overrides = window:get_config_overrides() or {}
local dpi = wezterm.gui.screens().active.effective_dpi
if dpi > 96 then
overrides.font_size = 15
else
overrides.font_size = 18
end
window:set_config_overrides(overrides)
if dpi > 96 then
overrides.font_size = 14
else
overrides.font_size = 18
end
window:set_config_overrides(overrides)
end)
config.warn_about_missing_glyphs = false
@ -250,6 +250,8 @@ config.keys = {
{ key = "0", mods = "CTRL", action = "ResetFontSize" },
{ key = "-", mods = "CTRL", action = "DecreaseFontSize" },
{ key = "=", mods = "CTRL", action = "IncreaseFontSize" },
{ key = "UpArrow", mods = "CTRL", action = act.ScrollToPrompt(-1) },
{ key = "DownArrow", mods = "CTRL", action = act.ScrollToPrompt(1) },
{ key = "UpArrow", mods = "SHIFT", action = act.ScrollByLine(-1) },
{ key = "DownArrow", mods = "SHIFT", action = act.ScrollByLine(1) },
{ key = "PageUp", mods = "SHIFT", action = act.ScrollByPage(-0.5) },
@ -276,20 +278,20 @@ config.mouse_bindings = {
{
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
mods = "SHIFT",
action = act.ScrollByLine(-1),
action = act.ScrollByLine(-5),
},
{
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
mods = "SHIFT",
action = act.ScrollByLine(1),
action = act.ScrollByLine(5),
},
{
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
action = act.ScrollByPage(-0.25),
action = act.ScrollByLine(-1),
},
{
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
action = act.ScrollByPage(0.25),
action = act.ScrollByLine(1),
},
}