Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added screen segments #24

Merged
merged 5 commits into from
Jul 31, 2017
Merged

added screen segments #24

merged 5 commits into from
Jul 31, 2017

Conversation

bmcfee
Copy link
Contributor

@bmcfee bmcfee commented Jul 31, 2017

This PR adds a segment for screen sessions, as accessed via the $STY variable.

@0rax
Copy link
Owner

0rax commented Jul 31, 2017

Nice, it seems to work fine, just two quick question:

  • For testing we should use a true session name (in the form PID.name), and test for both case:
    • 76230.test123
    • 69359.ttys001.Providence (on OSX)
    • 20424.pts-0.userctl (on Linux)
  • We might want to remove the PID from the name, as it is not of great interest IMHO (I do want to know what your though on that):
    • We can just do something like echo $STY | cut -d'.' -f2- to remove it though

@bmcfee
Copy link
Contributor Author

bmcfee commented Jul 31, 2017

We might want to remove the PID from the name, as it is not of great interest IMHO (I do want to know what your though on that):

I'd be fine with that. I often use PIDs as mnemonics for short-term multitasking, but pty/pts would work just as well.

@bmcfee
Copy link
Contributor Author

bmcfee commented Jul 31, 2017

Both of your points have been addressed, so I think it's good to go.

Copy link
Owner

@0rax 0rax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good, just need some fixes in the test file. Thanks a lot for your work ! This will be included in my own setup.

set -gx STY 76230.test123
__fishline_test STY

set -gx 69359.ttys001.Providence
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This result will not work (requires a variable name)


echo "Context: STY var is set to 'fishline_test'"
set -gx STY 76230.test123
__fishline_test STY
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are calling the STY segment when your segment is called SCREEN


if set -q STY
__fishline_segment $FLCLR_SCREEN_BG $FLCLR_SCREEN_FG
printf $FLSYM_SCREEN" "(echo $STY |cut -d'.' -f2-)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a space after the | (just for clarity)

@@ -36,6 +36,9 @@ set FLSYM_VFISH "\u2635"
# Symbol for CONDA segment
set FLSYM_CONDA "\U223F"

# Symbol for SCREEN segment
set FLSYM_SCREEN "\U239A"

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the lowercase \u as a prefix to stay consistent with the other symbols as they are 4 digit UTF-8 escape sentence (\uXXX vs \UXXXXXXXX which is 8 digit escape).

PS: did not notice for the FLSYM_CONDA that it was also in the \U form.


function fltest_screen

echo "Context: STY var is set to 'fishline_test'"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A context line should appear before each call to __fishline_test, here:

  • STY var is set to '76230.test123' (custom session name)
  • STY var is set to '69359.ttys001.Providence' (automated OSX style name)
  • STY var is set to '20424.pts-0.userctl' (automated Linux style name)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hah, thanks! I actually have no idea what i'm doing when it comes to writing tests for this kind of thing, but that makes sense. I'll correct.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a part of fishline that is currently broken / hard to explain. Its just a custom script that shows you all segment in their context. It broke in fish 2.6 due to a bug (which is fixed on master) (see fish-shell/fish-shell#4206). The thing is you should be able to test a segment by running test/run.fish screen and it will run this script in an enclosed fish session with fishline sourced from the git repository you are running test/run.fish from.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Probably worth documenting that somewhere (CONTRIBUTING.md?) but that's a separate issue.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, I need to update the documentation badly about all the internals and way to you can create and extend fishline.

A lot of the work done for Fishline 3.0 missed documentation and I wanted to wait before releasing it, but in the end I preferred to have it with out-of-date documentation as it was my vision of what fishline should have been from the get go and a lot of the people that are using fishline needed some of the change of v3.0.

I am taking note about that though, to add some note about the test runner.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, and all too familiar of a maintainer woe! FWIW, I ran the test locally (ubuntu fish2.6 build) and it crashed out with a segfault, but I'm pretty sure that's on fish itself and not these tests.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes thats the issue I linked in my other comment. Read broke in 2.6 and is no fix on master (but there is still another issue with printf on the latest master that wasnt there previously [starting a format string with "--" cause printf to try to use the full string as an argument now]).

This scripts tends to show me quite well if something "breaks" with the read & printf builtin.

@0rax
Copy link
Owner

0rax commented Jul 31, 2017

@bmcfee, I regularly use named screen thats why I am not really sure of the utility of the PID. And I do find that the automated name when I am not using a named screen are already quite useful. If you'd like to keep them why not, but I might just add a lot of bulk to the segment itself.

@0rax
Copy link
Owner

0rax commented Jul 31, 2017

Will be merging as is and updates the test file myself before releasing v3.1.0. This way I can release this new version tonight with the little fixes I've added to the tests.

Thanks a lot for this PR though, really enjoy seeing fishline be updated by other devs 👍

@0rax 0rax merged commit dcfcc87 into 0rax:dev Jul 31, 2017
@0rax 0rax mentioned this pull request Jul 31, 2017
@bmcfee
Copy link
Contributor Author

bmcfee commented Jul 31, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants