Terminal.Gui icon indicating copy to clipboard operation
Terminal.Gui copied to clipboard

Support ANSI Operating System Commands (OSCs)

Open tig opened this issue 2 years ago • 2 comments

See https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC

OSC (Operating system commands)
Note. These codes may ends with ‘ESC\’ (two symbols - ESC and BackSlash) or ‘BELL’ (symbol with code \x07, same as ‘^a’ in *nix). For simplifying, endings in the following table marked as ‘ST’.

Sequence	Description
ESC ] 0..2 ; “txt” ST	Set console window title to txt.
ConEmu specific OSC
Sequence	Description
ESC ] 9 ; 1 ; ms ST	Sleep. ms - number, milliseconds.
ESC ] 9 ; 2 ; ”txt“ ST	Show GUI MessageBox ( txt ) for any purposes.
ESC ] 9 ; 3 ; ”txt“ ST	Change ConEmu Tab to txt. Set empty string to return original Tab text.
ESC ] 9 ; 4 ; st ; pr ST	Set progress state on Windows 7 taskbar and ConEmu title. When st is 0: remove progress. When st is 1: set progress value to pr (number, 0-100). When st is 2: set error state in progress on Windows 7 taskbar, pr is optional. When st is 3: set indeterminate state. When st is 4: set paused state, pr is optional.
ESC ] 9 ; 5 ST	Wait for Enter/Space/Esc. Set environment variable “ConEmuWaitKey” to “ENTER”/”SPACE”/”ESC” on exit.
ESC ] 9 ; 6 ; ”txt“ ST	Execute GuiMacro ( txt ). Set EnvVar “ConEmuMacroResult” on exit.
ESC ] 9 ; 7 ; ”cmd“ ST	Run some process with arguments.
ESC ] 9 ; 8 ; “env” ST	Output value of environment variable.
ESC ] 9 ; 9 ; “cwd” ST	Inform ConEmu about shell current working directory.
ESC ] 9 ; 10 ST	Request xterm keyboard and output emulation.
ESC ] 9 ; 10 ; n ST	When n is 0 turn off xterm keyboard and output emulation. When n is 1 turn on xterm keyboard and output emulation. When n is 2 turn off xterm output emulation. When n is 3 turn on xterm output emulation.
ESC ] 9 ; 11; “txt” ST	Just a ‘comment’, skip it.
ESC ] 9 ; 12 ST	Let ConEmu treat current cursor position as prompt start. Useful with PS1.

These are the most interesting and we should consider allowing Terminal.Gui apps to take advantage of them.

  • ESC ] 0..2; "txt" ST is supported by most terminals. I've tested Console.Out.Write ("\x1b]0;{0}\x07", "Terminal.Gui"); with the WindowsDriver and it works.
  • ESC ] 9 ; 2 ; ”txt“ ST does not work on Windows Term (but does on conemu).
  • ESC ] 9 ; 4 ; st ; pr ST works on Windows Terminal - We should add an option to ProgressBar to have it use this!!!

tig avatar Jan 23 '23 22:01 tig