mirror of
https://github.com/junegunn/fzf
synced 2026-08-10 20:01:42 +00:00
Escape trailing semicolon in tmux command argument
tmux ends a command at an argument whose last character is ';', so a --border-label ending in one was stored truncated. escapeTmuxSeparator only covered a value that was exactly ';'. fzf --popup --border-label 'foo;' -> @fzf-border-label was 'foo'
This commit is contained in:
+4
-4
@@ -46,11 +46,11 @@ func tmuxFloatingPaneInfo() (int, int, bool) {
|
||||
return width, height, true
|
||||
}
|
||||
|
||||
// A lone ';' argument is a command separator to tmux, aborting the whole
|
||||
// command at parse time
|
||||
// tmux ends a command at an argument ending in ';', so a trailing one is
|
||||
// escaped. Elsewhere it is not special
|
||||
func escapeTmuxSeparator(str string) string {
|
||||
if str == ";" {
|
||||
return `\;`
|
||||
if strings.HasSuffix(str, ";") {
|
||||
return str[:len(str)-1] + `\;`
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user