Skip to content

Allow customization of ^C with a new color variable#3963

Closed
frangio wants to merge 3 commits into
fish-shell:masterfrom
frangio:cancel-color
Closed

Allow customization of ^C with a new color variable#3963
frangio wants to merge 3 commits into
fish-shell:masterfrom
frangio:cancel-color

Conversation

@frangio
Copy link
Copy Markdown
Contributor

@frangio frangio commented Apr 17, 2017

Description

I've modified the __fish_cancel_commandline function to print ^C using a color defined in a new fish_color_cancel variable.

I've set the default value of this variable to -r to match the current behaviour.

Please let me know if there's anywhere I should add documentation. I looked but didn't find the other color variables documented anywhere.

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.md

@frangio frangio changed the title Cancel color Allow customization of ^C with a new color variable Apr 17, 2017
echo -ns (set_color -r) "^C" (set_color normal) (tput el; or tput ce)
else
echo -n "^C"
# Clear to EOL (to erase any autosuggestion).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is orthogonal to the documented reason for this change and is going to be controversial.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is it possible you misconstrued the diff? This feature was present before too; check out the comment at old line 10.

I just extracted the ^C echoing out of the conditional statement since it's independent of tput availability. It was apparently written that way initially because tput was used instead of set_color, but it was changed in 1fb92b6.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, you are correct. I was misreading the diff.

else
echo -n "^C"
# Clear to EOL (to erase any autosuggestion).
echo -n (tput el; or tput ce)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be echo -n (tput el ^/dev/null; or tput ce)? After all, if el isn't legal an error is going to be written to stderr.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think so... I'm not familiar with terminfo, though.

@krader1961
Copy link
Copy Markdown
Contributor

See the file doc_src/index.hdr.in for where the color vars are documented.

@krader1961
Copy link
Copy Markdown
Contributor

Squash merged as commit 349eff0. Thanks.

@zanchey zanchey added this to the fish 2.6.0 milestone Aug 19, 2017
@frangio frangio deleted the cancel-color branch May 9, 2018 00:50
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants