fix broken completion of screen on osx, test on ubuntu and mac#3271
fix broken completion of screen on osx, test on ubuntu and mac#3271floam merged 6 commits intofish-shell:masterfrom
Conversation
|
Can you post an example of the output? Ideally, this'd be switched over to our |
|
Hm, one can adjust screen -list
There are screens on:
32189.pts-3.aaron (08/01/2016 08:45:00 AM) (Attached)
…
begin; set -lx LC_TIME en_DK.UTF-8; screen -list; end
There are screens on:
32189.pts-3.aaron (2016-08-01 08:45:01) (Attached)
…
begin; set -lx LC_TIME POSIX; screen -list; end
There are screens on:
32189.pts-3.aaron (08/01/16 08:45:01) (Attached) |
|
Wow! |
| function __fish_detect_screen_socket_dir --description "Detect which folder screen uses" | ||
| set screen_bin screen | ||
| if not set -q __fish_screen_socket_dir | ||
| set -g __fish_screen_socket_dir (eval $screen_bin -ls __fish_i_don_t_think_this_will_be_matched | string match -r "(?<=No Sockets found in ).*(?=\.)") |
There was a problem hiding this comment.
Looking over Apple's released screen code, while the per-user TMPDIR thing is an Apple addition, I don't think it's the case that only Macs will have an old screen with no date output (I could be wrong?).
I worry checking for this specific string might break for localizations. Could we try to detect the path whether or not there were attached screens? -q -list and exit status might help but probably isn't necessary.
There was a problem hiding this comment.
The socket directory is a compiler option so we could't know the path of a screen binary before it is run. Also, TMPDIR is used by the builtin screen on mac (not those installed with brew which use /tmp/uscreens/S-$USER, not even others). So I have to tell which path current screen command of current user is using If we want to steal the time from those socket files.
And we also could not know whether a screen on other platform shows time or not before there are sessions.
-q -ls can only tell whether there are sockets matched in the SockDir.
-list Do nothing, just list our SockDir [on possible matches].
-q Suppress printing of error messages. In combination with "-ls" the exit value
is as follows: 9 indicates a directory without sessions. 10 indicates a direc-
tory with running but not attachable sessions. 11 (or more) indicates 1 (or
more) usable sessions.
So as far as I see, the only way to get the sockdir is to run screen -ls.
Localization is a big problem. However, think about it: they could translate "Detached" to "分离" while they translate "No Socket in ..." into "没有..." . We can not prevent anyone from doing this.
So I think it is not strictly necessary to consider localization.
|
Setting They just behave the same way. I use a trick for I have these screen sockets in socket directory. They are all detached. And then I change the file permission of one of them. The 90843.test is attached now without executing Thus I change the list function for mac by using It relies on I'm sorry I have no time to come up with another good idea. |
share/completions/screen.fish
Outdated
| stat -f "%Lp %Sm %N" -t "%D %T" $__fish_screen_socket_dir/* | string match -r '^7\d{2} .*$' | string replace -r '^7\d{2} (\S* \S*) \S*/(\S+)' '$2\t$1 Attached' | ||
| pushd $__fish_screen_socket_dir > /dev/null | ||
| ls | ||
| set sockets (ls) |
…shell#3271) * fixes broken completion of screen on osx, test on ubuntu and mac with fish 2.3.1 * replaces sed, __fish_sgrep with fish builtin string * add completion for `screen -x` * adjust format (e.g. 12345.socket\t01/01/16 09:55:00 Detached)


Description
Change sed expression of function '__fish_complete_screen' in share/completion/screen.fish to support completion on both mac and linux.
I have tested on my mac and ubuntu server.
Fixes issue #
fish does not complete
screen -rwhen tapping Tab on mac (both GNU and FAU version)Output example
on mac:
~/W/G/f/s/completions (master)$ screen -r 819 81930.test1 (Screen: Detached) 81951.test3 (Screen: Detached) 81940.test2 (Screen: Detached) 81961.test4 (Screen: Detached)on linux (ubuntu):
You will find that they are a little different because
screen -liston mac doesn't show time.