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

console.lua: save commands in history after autocompletion #15371

Merged
merged 2 commits into from
Nov 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions player/lua/console.lua
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,8 @@ local function format_table(list, width_max, rows_max)
or '%-' .. math.min(column_widths[column], 99) .. 's'
columns[column] = ass_escape(string.format(format_string, list[i]))

if i == selected_suggestion_index then
if i == selected_suggestion_index or
(i == 1 and selected_suggestion_index == 0) then
columns[column] = styles.selected_suggestion .. columns[column]
.. '{\\b0}'.. styles.suggestion
end
Expand Down Expand Up @@ -808,9 +809,6 @@ local function handle_enter()
if line == '' and input_caller == nil then
return
end
if history[#history] ~= line and line ~= '' then
history_add(line)
end

if selectable_items then
if #matches > 0 then
Expand All @@ -836,6 +834,10 @@ local function handle_enter()
end
end

if history[#history] ~= line and line ~= '' then
history_add(line)
end

clear()
end

Expand Down