Change window_range to emit each element as a separate string

This commit is contained in:
Maxime Coste 2023-11-13 19:19:53 +11:00
parent 2261b48e35
commit fc7be678ed
3 changed files with 28 additions and 25 deletions

View File

@ -5,6 +5,8 @@ released versions.
== Development version
* `%val{window_range}` elements are now emitted as different strings
* `+` only duplicates identical selections a single time to avoid surprising
and slow exponential growth in the number of selections.

View File

@ -1115,9 +1115,9 @@ private:
const String& line = m_line_editor.line();
m_completions = completer(context(), flags, line,
line.byte_count_to(m_line_editor.cursor_pos()));
const bool menu = (bool)(m_completions.flags & Completions::Flags::Menu);
if (context().has_client())
{
if (not context().has_client())
return;
if (m_completions.candidates.empty())
return context().client().menu_hide();
@ -1128,6 +1128,7 @@ private:
const auto menu_style = (m_flags & PromptFlags::Search) ? MenuStyle::Search : MenuStyle::Prompt;
context().client().menu_show(items, {}, menu_style);
const bool menu = (bool)(m_completions.flags & Completions::Flags::Menu);
if (menu)
context().client().menu_select(0);
@ -1140,7 +1141,6 @@ private:
}
else
m_prefix_in_completions = false;
}
} catch (runtime_error&) {}
}

View File

@ -46,6 +46,7 @@ struct {
StringView notes;
} constexpr version_notes[] = { {
0,
"» {+b}%val{window_range}{} is now emitted as separate strings\n"
"» {+b}+{} only duplicates identical selections a single time\n"
"» {+u}daemonize-session{} command\n"
}, {
@ -387,8 +388,8 @@ static const EnvVarDesc builtin_env_vars[] = { {
[](StringView name, const Context& context) -> Vector<String>
{
const auto& setup = context.window().last_display_setup();
return {format("{} {} {} {}", setup.first_line, setup.first_column,
setup.line_count, 0)};
return {to_string(setup.first_line), to_string(setup.first_column),
to_string(setup.line_count), to_string(0)};
}
}, {
"history", false,