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

introduce optional separator #8

Merged
merged 4 commits into from
Sep 29, 2016
Merged

Conversation

ethagnawl
Copy link
Contributor

Addresses #7.

(e.g. `| ^B |`)

```tmux.conf
set -g @prefix_highlight_separator '|'
Copy link
Collaborator

@erickpintor erickpintor Sep 27, 2016

Choose a reason for hiding this comment

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

What do you think about defining a prefix and suffix rather than a separator and two flags to control their position?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@erickpintor Sure, that sounds reasonable. It's also a bit more flexible. If I find some time, I'll take a pass at that tomorrow.

Copy link
Collaborator

@erickpintor erickpintor left a comment

Choose a reason for hiding this comment

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

It is looking very good. I just have a few more considerations regarding extra spaces.

They tend to increase and decrease the size of the status bar if we're not careful with them. It's not a big deal, it's mostly cosmetic but, some people can get annoyed with it.

local copy_with_optional_affixes="Copy"

if [[ "off" != "$output_prefix" ]]; then
local prefix_with_optional_affixes="$output_prefix $prefix_with_optional_affixes"
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is looking very good! My only observation is to not add any extra space here or on the lines below.
Some people may use an emoji or a special character as a separator and they might want to control the spacing by themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough.

if [[ "on" = "$show_copy_mode" ]]; then
local -r fallback="${copy_highlight}#{?pane_in_mode,Copy,}"
local -r fallback="${copy_highlight}#{?pane_in_mode, $copy_with_optional_affixes, }"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I remember when we added the Copy mode we didn't add a space before the word because copy has the exact same size as the prefix. It avoid increasing the size of the status bar when we enter copy mode.

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. I'll remove the extra space.

else
local -r fallback=""
fi

local -r highlight_on_prefix="${prefix_highlight}#{?client_prefix, $prefix ,$fallback}#[default]"
local -r highlight_on_prefix="${prefix_highlight}#{?client_prefix, $prefix_with_optional_affixes, $fallback}#[default]"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure. But I think the space before $fallback will be considered too. We may want to avoid it.

Copy link
Contributor Author

@ethagnawl ethagnawl Sep 29, 2016

Choose a reason for hiding this comment

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

It looks like the spacing used on the old line 46 (?client_prefix, $prefix ,$fallback) contains an additional space. I can either revert to using that and we can take up the spacing problem (if it is one ...) in another issue or address it here by removing all of the spaces. In the latter scenario, the string would be: "${prefix_highlight}#{?client_prefix,$prefix_with_optional_affixes,$fallback}#[default]"

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can remove all spaces and since we now have prefix and suffix properties, people can add them back if they feel like it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps we make the default prefix and suffix as a single space? Just to keep backwards compatibility? It's up to you. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps we make the default prefix and suffix as a single space? Just to keep backwards compatibility?

That's a great idea. It also removes the need for some of the conditionals and variable re-assignment I was using.

Copy link
Collaborator

@erickpintor erickpintor left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks a lot for your contribution!

@erickpintor erickpintor merged commit 34f7125 into tmux-plugins:master Sep 29, 2016
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.

2 participants