summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2025-07-03 11:38:25 +1000
committerMaxime Coste <mawww@kakoune.org>2025-07-03 11:38:25 +1000
commit0f47c28fe2ba7d8d0b6d8d1a904b4b261f8552dc (patch)
tree8252cdf429eb681a73df020f51a1dcb70d7830cf /src
parentb82267e886b362397d0ca41429596e390f8941f4 (diff)
Rework startup message
Link to `:doc changelog` in the title and link to startup-info there so that this information stays visible even if the changelog overflows the info box. Use format support for 0 padding instead of custom code
Diffstat (limited to 'src')
-rw-r--r--src/main.cc17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/main.cc b/src/main.cc
index 8f5d2ad6..0a2e68b0 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -70,11 +70,11 @@ struct {
};
static_assert(sizeof(version_notes) / sizeof(version_notes[0]) <= 4 - (version_notes[0].version != 0 ? 1 : 0),
- "Only 3 versions should be displayed in version notes, not including the development version");
+ "Maximum 3 versions should be displayed in version notes, not including the development version");
void show_startup_info(Client* local_client, int last_version)
{
- const Face version_face{Color::Default, Color::Default, Attribute::Bold};
+ const Face version_face{.attributes=Attribute::Bold};
DisplayLineList info;
for (auto [version, notes] : version_notes)
{
@@ -88,20 +88,17 @@ void show_startup_info(Client* local_client, int last_version)
const auto year = version / 10000;
const auto month = (version / 100) % 100;
const auto day = version % 100;
- info.push_back({format("• Kakoune v{}.{}{}.{}{}",
- year, month < 10 ? "0" : "", month, day < 10 ? "0" : "", day),
- version_face});
+ info.push_back({format("• Kakoune v{}.{:02}.{:02}", year, month, day), version_face});
}
for (auto&& line : notes | split<StringView>('\n'))
info.push_back(parse_display_line(line, GlobalScope::instance().faces()));
}
if (not info.empty())
- {
- info.push_back({"See the `:doc options startup-info` to control this message",
- Face{Color::Default, Color::Default, Attribute::Italic}});
- local_client->info_show({format("Kakoune {}", version), version_face}, info, {}, InfoStyle::Prompt);
- }
+ local_client->info_show({{{format("Kakoune {}", version), version_face},
+ {", more info at ", {}},
+ {":doc changelog", {.attributes=Attribute::Underline}}}},
+ std::move(info), {}, InfoStyle::Prompt);
}
inline void write_stdout(StringView str) { try { write(STDOUT_FILENO, str); } catch (runtime_error&) {} }