Commit graph

84 commits

Author SHA1 Message Date
James Cuzella
ccce2e1cfd
fix(termsupport): match all foot-like terminfo (#11868) 2023-08-31 23:35:33 +02:00
Marc Cornellà
cb8b677488
fix(termsupport): don't report current working directory in SSH sessions (#11703) 2023-06-11 17:02:48 +02:00
Marc Cornellà
50c678687e
fix(termsupport): fix pwd report for Konsole (#11730)
The Konsole terminal shows an error if the host is provided in the
OSC 7 sequence.

Fixes #11730
2023-06-08 18:48:32 +02:00
Alexander Schlarb
25c2c3a468
feat(lib): send OSC 7 on directory change for more supported terminals (#9914)
Previously this was only emitted on macOS with Apple's Terminal.app (and
compatible clones like iTerm2), but it is used by other terminal emulators
as well to obtain the actual current working directory wiht symlinks intact.
All non-supporting terminal emulators tested gracefully ignored this value,
so emit this on these as well in case they (or some other app masquarading
as them) add future support for this value.

Closes #9914

Co-authored-by: Marc Cornellà <hello@mcornella.com>
2023-04-05 00:20:10 +02:00
Christian Parpart
8d23fbd696
feat(termsupport): add contour terminal (#11599)
Signed-off-by: Christian Parpart <christian@parpart.family>
2023-04-04 16:47:13 +02:00
Marc Cornellà
17ea97332b Revert "fix(lib): send carriage return after title to fix #11314 (#11315)"
This reverts commit 3dd83a22a1.

See https://github.com/ohmyzsh/ohmyzsh/issues/11314#issuecomment-1379492472
2023-01-12 08:29:00 +01:00
Lawton Nichols
3dd83a22a1
fix(lib): send carriage return after title to fix #11314 (#11315)
Window and tab titles are changed by emitting an unprintable escape
sequence to the terminal. These escape sequences do not play nicely
with the TAB character on multiple terminal emulators--they create
un-deletable characters on the first line after command execution.
Sending "\r" after changing the window and tab titles allows all
characters on the first line to be deleted.

Fixes #11314
2023-01-11 19:44:29 +01:00
Markus (Vock) Arians
99460351eb
feat(lib): support auto title in foot terminal (#10735)
Co-authored-by: Markus Arians <markus.arians@andrena.de>
2022-02-25 13:29:22 +01:00
Paul Scott
0314604384
fix(lib): don't error if INSIDE_EMACS is not defined (#10443) 2021-11-25 23:55:21 +01:00
Marc Cornellà
a263cdac9c
fix(lib): fix potential command injection in title and spectrum functions
The `title` function unsafely prints its input without sanitization, which if used
with custom user code that calls it, it could trigger command injection.

The `spectrum_ls` and `spectrum_bls` could similarly be exploited if a variable is
changed in the user's shell environment with a carefully crafted value. This is
highly unlikely to occur (and if possible, other methods would be used instead),
but with this change the exploit of these two functions is now impossible.
2021-11-11 22:45:11 +01:00
Marc Cornellà
54e3e8ef54
fix(lib): fix automatic title abort inside Emacs (#10124)
Closes #10124

Co-authored-by: Paul Schorfheide <pschorf2@gmail.com>
Co-authored-by: Alastair Rankine <alastair@girtby.net>
2021-09-29 17:19:25 +02:00
Kyle Gerard Felker
c9bf8b4a84
fix(lib): update Emacs terminal detection in title function (#9577)
Environment variable EMACS was replaced by INSIDE_EMACS
2021-01-07 20:55:18 +01:00
Michele Bologna
58ff4e1d2e
lib: follow standards in window title (#9320)
In Ubuntu and Debian, in scp, and in rsync the prompt is by default specified as in

  user@hostname:/path/to/directory

while the previous title in ohmyzsh was

  user@hostname: /path/to/directory
2020-10-08 19:20:47 +02:00
Marc Cornellà
274df9dc29 lib: support simple terminal in title function
Fixes #9295
2020-09-29 18:34:35 +02:00
Marc Cornellà
4ec055b890 lib: support alacritty $TERM in title function 2020-09-28 22:25:10 +02:00
Marc Cornellà
765966606d lib: correct :q syntax in title function for clarity 2020-09-27 14:15:50 +02:00
Marc Cornellà
9521837240 lib: support mlterm-256color
Co-authored-by: Peter J. Schroeder <peterjschroeder@gmail.com>
2020-07-23 12:55:22 +02:00
Patrick Moore
e606ac7051
Handle unset variables in various parts of the codebase (#8944)
DISABLE_UNTRACKED_FILES_DIRTY, DISABLE_AUTO_TITLE, GIT_STATUS_IGNORE_SUBMODULES are not set
Handle these variables not being set with conditional access.

If the user has set -u option to report attempts to use undeclared / unassigned variable, accessing the variables needs to be conditional.
2020-06-30 18:54:27 +02:00
joshuashaffer
b706a91917
core: add title support for mlterm (#8303) 2020-06-19 23:16:31 +02:00
Marc Cornellà
2eb3e9d57c
lib: support konsole* $TERM in title function (#8035) 2020-03-05 17:26:16 +01:00
Marc Cornellà
b9d5ee7913
lib: automatic title: replace fg with description from jobs (#7982)
* Automatic title: Replace fg with description from jobs

* Avoid error messages when there is no job

* Use $jobstates and $jobtexts to look for jobs

`jobs %string` doesn't work correctly when run inside `$()`. `$jobstates` and
`$jobtexts` is available in the current shell process, so even though we need
to replicate a bit more logic, every type of `fg` invocation works correctly.

* lib: clean up termsupport.zsh

Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2020-03-03 20:21:29 +01:00
Marc Cornellà
02d1253809
lib: clean up termsupport.zsh 2020-03-03 20:17:01 +01:00
Marc Cornellà
d7825313cc
Use $jobstates and $jobtexts to look for jobs
`jobs %string` doesn't work correctly when run inside `$()`. `$jobstates` and
`$jobtexts` is available in the current shell process, so even though we need
to replicate a bit more logic, every type of `fg` invocation works correctly.
2020-03-03 20:10:43 +01:00
Stephen Heuer
a2cad16790
lib: urlencode hostname in update_terminalapp_cwd (#6245)
Apple's Terminal doesn't open a new tab in your current directory if your hostname has UTF-8 characters in it. Percent encoding the host in addition to the path in update_terminalapp_cwd appears to solve this issue.

Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2020-02-28 19:50:17 +01:00
Jacob Tomaw
1ba0af650a Use safer append to hook function arrays (#8406)
Use add-zsh-hook to add functions to hooks. That way they won't be added again
when doing `source ~/.zshrc` multiple times.

Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2019-11-19 18:47:12 +01:00
Erik Demaine
902e3172c9 Avoid error messages when there is no job 2019-07-07 10:48:36 -04:00
Erik Demaine
c1446b4750 Automatic title: Replace fg with description from jobs 2019-07-06 12:10:30 -04:00
Jeremy Armstrong
8aa8405ea2 termsupport: add support for tmux* $TERM values (#7622) 2019-03-21 20:41:55 +01:00
Janosch Schwalm
19b925e741 use https everywhere (#6574)
* use https everywhere

* use https links on the files that are left

Also, removed some broken links and updated redirections.
2018-08-07 20:42:01 +02:00
moyamo
71deb74552 Fix indentation 2015-12-14 13:05:51 +02:00
moyamo
d779750341 Default to using terminfo to set the terminal title
Currently, the title is only set on supported terminals (i.e. xterm,
urxvt, screen etc.). Using terminfo entries to set the terminal title
adds support for many more terminals.
2015-12-14 12:59:04 +02:00
Marc Cornellà
4e306887c2 Cleanup update_terminalapp_cwd function 2015-12-01 14:05:38 +01:00
Marc Cornellà
eca912e51a Quote all variables in if statements 2015-12-01 14:05:18 +01:00
Marc Cornellà
103eb32721 Use a case structure to id terminal types 2015-12-01 14:04:12 +01:00
Dawid Ferenczy
63d7500cf1 Added setting of the window title in Cygwin 2015-12-01 13:52:52 +01:00
Ionel Cristian Mărieș
d55111f200 Support all kinds of putty-like terminal strings. 2015-12-01 00:59:35 +02:00
Ionel Cristian Mărieș
711c1bcb40 Add support for "putty" $TERM in termsupport.zsh 2015-11-30 15:16:47 +02:00
Andrew Janke
f0981d564a termsupport: protect subshell with quotes 2015-11-27 15:58:06 +01:00
Andrew Janke
00eb465830 Merge branch 'master' into fold-terminalapp-plugin-into-termsupport 2015-08-17 20:59:39 -04:00
Andrew Janke
47d19cc564 Add defensive emulate -L zsh to termsupport functions 2015-08-17 20:55:41 -04:00
Robby Russell
7c60da9e1f Merge pull request #4233 from apjanke/apple-term-no-dupe-folder-in-title
termsupport: avoid repeated dir in window title in Terminal.app
2015-08-12 21:15:59 -07:00
Robby Russell
f6a2b97356 Merge pull request #4203 from apjanke/title-protect-promptsubst
termsupport: protect title() with `emulate -L zsh` for portability
2015-08-12 21:12:21 -07:00
Robby Russell
d1ea849fdd Merge pull request #2106 from adepasquale/master
Added ssh-like mosh window title
2015-08-12 21:01:00 -07:00
Andrew Janke
14b4ba83c3 Move urlencode/urldecode functions to core lib 2015-08-09 16:28:47 -04:00
Andrew Janke
17da983442 termsupport: avoid repeated dir in window title in Terminal.app 2015-08-09 15:15:12 -04:00
Andrew Janke
90ea67edf0 termsupport: protect title() with emulate -L zsh
This prevents it from malfunctioning when `setopt prompt_subst` is off.
2015-07-31 22:23:12 -04:00
Andrew Janke
88f42b6132 Add support for variant "utf8" locale suffix spelling. Fix dumb bug in iconv call that would cause it to hang. 2015-02-21 16:25:28 -05:00
Andrew Janke
cb37c934c0 Remove unnecessary braces. 2015-02-21 16:00:40 -05:00
Andrew Janke
187cf07c91 For unspecified encodings, assume it's UTF-8 or compatible (e.g. ASCII) and muddle through without character encoding conversion. 2015-02-17 00:54:54 -05:00
Andrew Janke
702ff1ca91 Add support for non-UTF-8 encodings in caller's locale. 2015-02-17 00:49:53 -05:00