Compare commits

..

9 Commits
3.4.0 ... 3.4.1

Author SHA1 Message Date
David Adam
7489ab9d5b Release 3.4.1 2022-03-26 00:22:53 +08:00
Fabian Homborg
625d9e05d8 completions/nmcli: Exit if networkmanager isn't running
These printed an error on load if networkmanager isn't running.

Since at that point it's not useful to complete anything, just try the
first call and if that fails exit.

(cherry picked from commit b6f47f76f0)
2022-03-25 16:19:25 +01:00
Fabian Homborg
8f11ebb9d4 completions/csharp: Fix syntax error
(cherry picked from commit 4c40283d00)
2022-03-25 16:19:25 +01:00
Fabian Homborg
27c41ba74a CHANGELOG 3.4.1 2022-03-24 20:19:41 +01:00
Fabian Homborg
12cfaec0c9 Put funcsave long option back
This reverts ed8c78c0ea, emphatically.

Fixes #8830

(cherry picked from commit 2c702de52c)
2022-03-24 20:12:44 +01:00
Fabian Homborg
e458bf5763 Let nextd-or-forward-word binding move like normal forward_word
Broken in #8358, this caused nextd-or-forward-word to actually be
nextd-or-forward-bigword.

See #8790.

(cherry picked from commit 2101dd4add)
2022-03-22 22:11:43 +01:00
Fabian Homborg
07543ff881 Use old-school "()" command substitution in fish_title
Because we reload changed function files, a common issue on upgrading
to 3.4.0 is that fish_title causes errors.

So we simply use the oldschool syntax.

(cherry picked from commit c5a8764db1)
2022-03-14 18:16:37 +01:00
Fabian Homborg
0314cb662f Fix build on NetBSD
This missed a change to "dir_remoteness_t" from bool

Fixes #8788

(cherry picked from commit 695e20c47f)
2022-03-14 18:16:20 +01:00
Fabian Homborg
8c13f5894b Fix tparm kludge
This just defines a constant to whichever tparm implementation we're
using (either the actual, working one the system provides, or our
kludge to paper over Solaris' inadequacies).

This means that there won't be so much ping-ponging of what "tparm"
stands for. "tparm" is the system's function. Only we don't use it,
just like we don't use wcstod directly.

Fixes #8780

(cherry picked from commit a76ed9942d)
2022-03-14 18:16:20 +01:00
13 changed files with 48 additions and 36 deletions

View File

@@ -1,3 +1,18 @@
fish 3.4.1 (released March 25, 2022)
====================================
This release of fish fixes the following problems identified in fish 3.4.0:
- An error printed after upgrading, where old instances could pick up a newer version of the ``fish_title`` function, has been fixed (:issue:`8778`)
- fish builds correctly on NetBSD (:issue:`8788`) and OpenIndiana (:issue:`8780`).
- ``nextd-or-forward-word``, bound to :kbd:`Alt-Right Arrow` by default, was inadvertently changed to move like ``forward-bigword``. This has been corrected (:issue:`8790`).
- ``funcsave -q`` and ``funcsave --quiet`` now work correctly (:issue:`8830`).
- Issues with the ``csharp`` and ``nmcli`` completions were corrected.
If you are upgrading from version 3.3.1 or before, please also review the release notes for 3.4.0 (included below).
--------------
fish 3.4.0 (released March 12, 2022)
====================================

View File

@@ -9,7 +9,7 @@ Synopsis
.. synopsis::
funcsave FUNCTION_NAME
funcsave [-q] [(-d | --directory) DIR] FUNCTION_NAME
funcsave [-q | --quiet] [(-d | --directory) DIR] FUNCTION_NAME
Description

View File

@@ -1,4 +1,3 @@
complete -c csharp -l attach -f -r -a '(ps -A | awk \'NR > 1 { printf "%s\t%s\n", $1, $4 }\')' -d
'Inject into other processes'
complete -c csharp -l attach -f -r -a '(ps -A | awk \'NR > 1 { printf "%s\t%s\n", $1, $4 }\')' -d 'Inject into other processes'
complete -c csharp -s e -f -r -d 'Specify expression to execute'
complete -c csharp -s s -r -d 'Use file to execute'

View File

@@ -1,4 +1,6 @@
set -l cname (string escape -- (nmcli -g NAME connection show --active)\t"Active connection")
set -l nmoutput (nmcli -g NAME connection show --active 2>/dev/null)
or exit # networkmanager isn't running, no point in completing
set -l cname (string escape -- $nmoutput\t"Active connection")
set -a cname (string escape -- (nmcli -g NAME connection show)\t"Connection")
set -l ifname (string escape -- (nmcli -g DEVICE device status)\t"Interface name")
set -l ssid (string escape -- (nmcli -g SSID device wifi list)\t"SSID")

View File

@@ -4,7 +4,7 @@ function fish_title
# If we're connected via ssh, we print the hostname.
set -l ssh
set -q SSH_TTY
and set ssh "[$(prompt_hostname | string sub -l 10)]"
and set ssh "["(prompt_hostname | string sub -l 10 | string collect)"]"
# An override for the current command is passed as the first parameter.
# This is used by `fg` to show the true process name, among others.
if set -q argv[1]

View File

@@ -1,5 +1,5 @@
function funcsave --description "Save the current definition of all specified functions to file"
set -l options q h/help d/directory=
set -l options q/quiet h/help d/directory=
argparse -n funcsave $options -- $argv
or return

View File

@@ -38,7 +38,7 @@ static void print_modifiers(outputter_t &outp, bool bold, bool underline, bool i
bool reverse, rgb_color_t bg) {
if (bold && enter_bold_mode) {
// These casts are needed to work with different curses implementations.
writembs_nofail(outp, tparm(const_cast<char *>(enter_bold_mode)));
writembs_nofail(outp, fish_tparm(const_cast<char *>(enter_bold_mode)));
}
if (underline && enter_underline_mode) {
@@ -59,7 +59,7 @@ static void print_modifiers(outputter_t &outp, bool bold, bool underline, bool i
writembs_nofail(outp, enter_standout_mode);
}
if (!bg.is_none() && bg.is_normal()) {
writembs_nofail(outp, tparm(const_cast<char *>(exit_attribute_mode)));
writembs_nofail(outp, fish_tparm(const_cast<char *>(exit_attribute_mode)));
}
}
@@ -79,7 +79,7 @@ static void print_colors(io_streams_t &streams, bool bold, bool underline, bool
if (!bg.is_none()) {
// If we have a background, stop it after the color
// or it goes to the end of the line and looks ugly.
writembs_nofail(outp, tparm(const_cast<char *>(exit_attribute_mode)));
writembs_nofail(outp, fish_tparm(const_cast<char *>(exit_attribute_mode)));
}
outp.writech(L'\n');
} // conveniently, 'normal' is always the last color so we don't need to reset here
@@ -233,12 +233,12 @@ maybe_t<int> builtin_set_color(parser_t &parser, io_streams_t &streams, const wc
print_modifiers(outp, bold, underline, italics, dim, reverse, bg);
if (bgcolor != nullptr && bg.is_normal()) {
writembs_nofail(outp, tparm(const_cast<char *>(exit_attribute_mode)));
writembs_nofail(outp, fish_tparm(const_cast<char *>(exit_attribute_mode)));
}
if (!fg.is_none()) {
if (fg.is_normal() || fg.is_reset()) {
writembs_nofail(outp, tparm(const_cast<char *>(exit_attribute_mode)));
writembs_nofail(outp, fish_tparm(const_cast<char *>(exit_attribute_mode)));
} else {
if (!outp.write_color(fg, true /* is_fg */)) {
// We need to do *something* or the lack of any output messes up

View File

@@ -44,16 +44,10 @@
#include "fallback.h" // IWYU pragma: keep
#if defined(TPARM_SOLARIS_KLUDGE)
#undef tparm
char *tparm_solaris_kludge(char *str, long p1, long p2, long p3, long p4, long p5, long p6, long p7,
long p8, long p9) {
return tparm(str, p1, p2, p3, p4, p5, p6, p7, p8, p9);
}
// Re-defining just to make sure nothing breaks further down in this file.
#define tparm tparm_solaris_kludge
#endif
int fish_mkstemp_cloexec(char *name_template) {

View File

@@ -68,9 +68,11 @@ struct winsize {
#if defined(TPARM_SOLARIS_KLUDGE)
/// Solaris tparm has a set fixed of parameters in its curses implementation, work around this here.
#define tparm tparm_solaris_kludge
#define fish_tparm tparm_solaris_kludge
char *tparm_solaris_kludge(char *str, long p1 = 0, long p2 = 0, long p3 = 0, long p4 = 0,
long p5 = 0, long p6 = 0, long p7 = 0, long p8 = 0, long p9 = 0);
#else
#define fish_tparm tparm
#endif
/// These functions are missing from Solaris 10, and only accessible from

View File

@@ -36,7 +36,7 @@
/// Whether term256 and term24bit are supported.
static color_support_t color_support = 0;
/// Returns true if we think tparm can handle outputting a color index
/// Returns true if we think fish_tparm can handle outputting a color index
static bool term_supports_color_natively(unsigned int c) {
return static_cast<unsigned>(max_colors) >= c + 1;
}
@@ -54,8 +54,8 @@ unsigned char index_for_color(rgb_color_t c) {
static bool write_color_escape(outputter_t &outp, const char *todo, unsigned char idx, bool is_fg) {
if (term_supports_color_natively(idx)) {
// Use tparm to emit color escape.
writembs(outp, tparm(const_cast<char *>(todo), idx));
// Use fish_tparm to emit color escape.
writembs(outp, fish_tparm(const_cast<char *>(todo), idx));
return true;
}
@@ -116,7 +116,7 @@ bool outputter_t::write_color(rgb_color_t color, bool is_fg) {
return (is_fg ? write_foreground_color : write_background_color)(*this, idx);
}
// 24 bit! No tparm here, just ANSI escape sequences.
// 24 bit! No fish_tparm here, just ANSI escape sequences.
// Foreground: ^[38;2;<r>;<g>;<b>m
// Background: ^[48;2;<r>;<g>;<b>m
color24_t rgb = color.to_color24();
@@ -242,7 +242,7 @@ void outputter_t::set_color(rgb_color_t fg, rgb_color_t bg) {
// Lastly, we set bold, underline, italics, dim, and reverse modes correctly.
if (is_bold && !was_bold && enter_bold_mode && enter_bold_mode[0] != '\0' && !bg_set) {
// The unconst cast is for NetBSD's benefit. DO NOT REMOVE!
writembs_nofail(*this, tparm(const_cast<char *>(enter_bold_mode)));
writembs_nofail(*this, fish_tparm(const_cast<char *>(enter_bold_mode)));
was_bold = is_bold;
}
@@ -304,7 +304,7 @@ int outputter_t::term_puts(const char *str, int affcnt) {
scoped_push<outputter_t *> push(&s_tputs_receiver, this);
s_tputs_receiver->begin_buffering();
// On some systems, tputs takes a char*, on others a const char*.
// Like tparm, we just cast it to unconst, that should work everywhere.
// Like fish_tparm, we just cast it to unconst, that should work everywhere.
int res = tputs(const_cast<char *>(str), affcnt, tputs_writer);
s_tputs_receiver->end_buffering();
return res;

View File

@@ -134,7 +134,7 @@ static dir_remoteness_t path_remoteness(const wcstring &path) {
// In practice the only system to use this path is NetBSD.
struct statvfs buf {};
if (statvfs(narrow.c_str(), &buf) < 0) return dir_remoteness_t::unknown;
return (buf.f_flag & ST_LOCAL) ? false : true;
return (buf.f_flag & ST_LOCAL) ? dir_remoteness_t::local : dir_remoteness_t::remote;
#elif defined(MNT_LOCAL)
struct statfs buf {};
if (statfs(narrow.c_str(), &buf) < 0) return dir_remoteness_t::unknown;

View File

@@ -3543,7 +3543,7 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat
}
auto move_style =
(c == rl::backward_word) ? move_word_style_punctuation : move_word_style_whitespace;
(c != rl::backward_bigword) ? move_word_style_punctuation : move_word_style_whitespace;
move_word(active_edit_line(), MOVE_DIR_LEFT, false /* do not erase */, move_style,
false);
break;
@@ -3561,7 +3561,7 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat
}
auto move_style =
(c == rl::forward_word) ? move_word_style_punctuation : move_word_style_whitespace;
(c != rl::forward_bigword) ? move_word_style_punctuation : move_word_style_whitespace;
editable_line_t *el = active_edit_line();
if (el->position() < el->size()) {
move_word(el, MOVE_DIR_RIGHT, false /* do not erase */, move_style, false);

View File

@@ -258,10 +258,10 @@ static bool is_visual_escape_seq(const wchar_t *code, size_t *resulting_length)
for (auto p : esc2) {
if (!p) continue;
// Test both padded and unpadded version, just to be safe. Most versions of tparm don't
// Test both padded and unpadded version, just to be safe. Most versions of fish_tparm don't
// actually seem to do anything these days.
size_t esc_seq_len =
std::max(try_sequence(tparm(const_cast<char *>(p)), code), try_sequence(p, code));
std::max(try_sequence(fish_tparm(const_cast<char *>(p)), code), try_sequence(p, code));
if (esc_seq_len) {
*resulting_length = esc_seq_len;
return true;
@@ -632,7 +632,7 @@ void screen_t::move(int new_x, int new_y) {
bool use_multi = multi_str != nullptr && multi_str[0] != '\0' &&
abs(x_steps) * std::strlen(str) > std::strlen(multi_str);
if (use_multi && cur_term) {
char *multi_param = tparm(const_cast<char *>(multi_str), abs(x_steps));
char *multi_param = fish_tparm(const_cast<char *>(multi_str), abs(x_steps));
writembs(outp, multi_param);
} else {
for (i = 0; i < abs(x_steps); i++) {
@@ -1288,7 +1288,7 @@ void screen_t::reset_abandoning_line(int screen_width) {
if (screen_width > non_space_width) {
bool justgrey = true;
if (cur_term && enter_dim_mode) {
std::string dim = tparm(const_cast<char *>(enter_dim_mode));
std::string dim = fish_tparm(const_cast<char *>(enter_dim_mode));
if (!dim.empty()) {
// Use dim if they have it, so the color will be based on their actual normal
// color and the background of the termianl.
@@ -1300,24 +1300,24 @@ void screen_t::reset_abandoning_line(int screen_width) {
if (max_colors >= 238) {
// draw the string in a particular grey
abandon_line_string.append(
str2wcstring(tparm(const_cast<char *>(set_a_foreground), 237)));
str2wcstring(fish_tparm(const_cast<char *>(set_a_foreground), 237)));
} else if (max_colors >= 9) {
// bright black (the ninth color, looks grey)
abandon_line_string.append(
str2wcstring(tparm(const_cast<char *>(set_a_foreground), 8)));
str2wcstring(fish_tparm(const_cast<char *>(set_a_foreground), 8)));
} else if (max_colors >= 2 && enter_bold_mode) {
// we might still get that color by setting black and going bold for bright
abandon_line_string.append(
str2wcstring(tparm(const_cast<char *>(enter_bold_mode))));
str2wcstring(fish_tparm(const_cast<char *>(enter_bold_mode))));
abandon_line_string.append(
str2wcstring(tparm(const_cast<char *>(set_a_foreground), 0)));
str2wcstring(fish_tparm(const_cast<char *>(set_a_foreground), 0)));
}
}
abandon_line_string.append(get_omitted_newline_str());
if (cur_term && exit_attribute_mode) {
abandon_line_string.append(str2wcstring(tparm(
abandon_line_string.append(str2wcstring(fish_tparm(
const_cast<char *>(exit_attribute_mode)))); // normal text ANSI escape sequence
}