Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions builtin/settingtypes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,10 @@ chat_weblink_color (Weblink color) string #8888FF
# Value 0 will use the default font size.
chat_font_size (Chat font size) int 0 0 72

# Append characters after autocompleting a player name.
# This is triggered by using the Tab key.
# The string must be surrounded with quotation marks (").
chat_autocomplete_append (Autocomplete append string) string " "

[**Content Repository]

Expand Down
17 changes: 14 additions & 3 deletions src/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,21 @@ void ChatPrompt::nickCompletion(const std::set<std::string> &names)
}

if (completions.size() == 1) {
if (prefix.size() == line.size())
if (prefix.size() == line.size()) {
shortest.append(L": ");
else if (prefix_end == line.size())
shortest.append(L" ");
} else if (prefix_end == line.size()) {
bool is_valid = false;
auto what = trim(g_settings->get("chat_autocomplete_append"));
if (what.size() >= 2) {
if (what[0] == '"' && what[what.size() - 1] == '"') {
what.remove_prefix(1);
what.remove_suffix(1);
is_valid = true;
}
}

shortest.append(is_valid ? utf8_to_wide(what) : L" ");
}
}

makeLineRef().replace(prefix_start, prefix_end - prefix_start, shortest);
Expand Down
1 change: 1 addition & 0 deletions src/defaultsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ void set_default_settings()
settings->setDefault("occlusion_culler", "bfs");
settings->setDefault("enable_raytraced_culling", "true");
settings->setDefault("chat_weblink_color", "#8888FF");
settings->setDefault("chat_autocomplete_append", "\" \"");

// Keymap
settings->setDefault("keymap_forward", "SYSTEM_SCANCODE_26|GAMEPAD_AXIS_MINUS_1"); // KEY_KEY_W|Left Joystick
Expand Down
Loading