Change window_range to emit each element as a separate string
This commit is contained in:
parent
2261b48e35
commit
fc7be678ed
|
@ -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.
|
||||
|
||||
|
|
|
@ -1115,32 +1115,32 @@ private:
|
|||
const String& line = m_line_editor.line();
|
||||
m_completions = completer(context(), flags, line,
|
||||
line.byte_count_to(m_line_editor.cursor_pos()));
|
||||
if (not context().has_client())
|
||||
return;
|
||||
|
||||
if (m_completions.candidates.empty())
|
||||
return context().client().menu_hide();
|
||||
|
||||
Vector<DisplayLine> items;
|
||||
for (auto& candidate : m_completions.candidates)
|
||||
items.push_back({ candidate, {} });
|
||||
|
||||
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 (context().has_client())
|
||||
if (menu)
|
||||
context().client().menu_select(0);
|
||||
|
||||
auto prefix = line.substr(m_completions.start, m_completions.end - m_completions.start);
|
||||
if (not menu and not contains(m_completions.candidates, prefix))
|
||||
{
|
||||
if (m_completions.candidates.empty())
|
||||
return context().client().menu_hide();
|
||||
|
||||
Vector<DisplayLine> items;
|
||||
for (auto& candidate : m_completions.candidates)
|
||||
items.push_back({ candidate, {} });
|
||||
|
||||
const auto menu_style = (m_flags & PromptFlags::Search) ? MenuStyle::Search : MenuStyle::Prompt;
|
||||
context().client().menu_show(items, {}, menu_style);
|
||||
|
||||
if (menu)
|
||||
context().client().menu_select(0);
|
||||
|
||||
auto prefix = line.substr(m_completions.start, m_completions.end - m_completions.start);
|
||||
if (not menu and not contains(m_completions.candidates, prefix))
|
||||
{
|
||||
m_current_completion = m_completions.candidates.size();
|
||||
m_completions.candidates.push_back(prefix.str());
|
||||
m_prefix_in_completions = true;
|
||||
}
|
||||
else
|
||||
m_prefix_in_completions = false;
|
||||
m_current_completion = m_completions.candidates.size();
|
||||
m_completions.candidates.push_back(prefix.str());
|
||||
m_prefix_in_completions = true;
|
||||
}
|
||||
else
|
||||
m_prefix_in_completions = false;
|
||||
} catch (runtime_error&) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user