mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-25 06:41:15 -03:00
Test balloon for ST OSC terminator
Use \e\\ as sequence terminator for the first OSC 133 prompt start marker. The intention is to find out if a terminal fails to parse this. If needed, the user can turn it off by adding "no-mark-prompt" to their feature flags; but the shell is still usable without this. Part of #12032
This commit is contained in:
@@ -8,6 +8,7 @@ while others enable optional features and may be ignored by the terminal.
|
||||
The terminal must be able to parse Control Sequence Introducer (CSI) commands, Operating System Commands (OSC) and :ref:`optionally <term-compat-dcs-gnu-screen>` Device Control Strings (DCS).
|
||||
These are defined by ECMA-48.
|
||||
If a valid CSI, OSC or DCS sequence does not represent a command implemented by the terminal, the terminal must ignore it.
|
||||
For historical reasons, OSC sequences may be terminated with ``\x07`` instead of ``\e\\``.
|
||||
|
||||
Control sequences are denoted in a fish-like syntax.
|
||||
Special characters other than ``\`` are not escaped.
|
||||
@@ -216,13 +217,13 @@ Optional Commands
|
||||
- Disable bracketed paste.
|
||||
* - .. _term-compat-osc-0:
|
||||
|
||||
``\e]0; Pt \x07``
|
||||
``\e]0; Pt \e\\``
|
||||
- ts
|
||||
- Set terminal window title (OSC 0). Used in :doc:`fish_title <cmds/fish_title>`.
|
||||
* - ``\e]2; Pt \x07``
|
||||
* - ``\e]2; Pt \e\\``
|
||||
- ts
|
||||
- Set terminal tab title (OSC 1). Used in :doc:`fish_tab_title <cmds/fish_tab_title>`.
|
||||
* - ``\e]7;file:// Pt / Pt \x07``
|
||||
* - ``\e]7;file:// Pt / Pt \e\\``
|
||||
-
|
||||
- Report working directory (OSC 7).
|
||||
Since the terminal may be running on a different system than a (remote) shell,
|
||||
@@ -235,20 +236,20 @@ Optional Commands
|
||||
This is used in fish's man pages.
|
||||
* - .. _term-compat-osc-52:
|
||||
|
||||
``\e]52;c; Pt \x07``
|
||||
``\e]52;c; Pt \e\\``
|
||||
-
|
||||
- Copy to clipboard (OSC 52). Used by :doc:`fish_clipboard_copy <cmds/fish_clipboard_copy>`.
|
||||
* - .. _term-compat-osc-133:
|
||||
|
||||
``\e]133;A; click_events=1\x07``
|
||||
``\e]133;A; click_events=1\e\\``
|
||||
-
|
||||
- Mark prompt start (OSC 133), with kitty's ``click_events`` extension.
|
||||
The ``click_events`` extension enables mouse clicks to move the cursor or select pager items,
|
||||
assuming that :ref:`cursor position reporting <term-compat-cursor-position-report>` is available.
|
||||
* - ``\e]133;C; cmdline_url= Pt \x07``
|
||||
* - ``\e]133;C; cmdline_url= Pt \e\\``
|
||||
-
|
||||
- Mark command start (OSC 133), with kitty's ``cmdline_url`` extension whose parameter is the URL-encoded command line.
|
||||
* - ``\e]133;D; Ps \x07``
|
||||
* - ``\e]133;D; Ps \e\\``
|
||||
-
|
||||
- Mark command end (OSC 133); Ps is the exit status.
|
||||
* - .. _term-compat-xtgettcap:
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
use crate::threads::MainThread;
|
||||
use crate::wchar::prelude::*;
|
||||
use bitflags::bitflags;
|
||||
use once_cell::sync::OnceCell;
|
||||
use std::cell::{RefCell, RefMut};
|
||||
use std::env;
|
||||
use std::ffi::{CStr, CString};
|
||||
@@ -384,7 +385,12 @@ fn osc_133_prompt_start(out: &mut impl Output) -> bool {
|
||||
if !future_feature_flags::test(FeatureFlag::mark_prompt) {
|
||||
return false;
|
||||
}
|
||||
write_to_output!(out, "\x1b]133;A;click_events=1\x07");
|
||||
static TEST_BALLOON: OnceCell<()> = OnceCell::new();
|
||||
if TEST_BALLOON.set(()).is_ok() {
|
||||
write_to_output!(out, "\x1b]133;A;click_events=1\x1b\\");
|
||||
} else {
|
||||
write_to_output!(out, "\x1b]133;A;click_events=1\x07");
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user