Skip to content

Commit 0f47c28

Browse files
committed
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
1 parent b82267e commit 0f47c28

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

doc/pages/changelog.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
= Changelog
22

3+
To control the startup info message, see <<options#startup-info,`:doc options startup-info`>>
4+
35
This changelog contains major and/or breaking changes to Kakoune between
46
released versions.
57

src/main.cc

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ struct {
7070
};
7171

7272
static_assert(sizeof(version_notes) / sizeof(version_notes[0]) <= 4 - (version_notes[0].version != 0 ? 1 : 0),
73-
"Only 3 versions should be displayed in version notes, not including the development version");
73+
"Maximum 3 versions should be displayed in version notes, not including the development version");
7474

7575
void show_startup_info(Client* local_client, int last_version)
7676
{
77-
const Face version_face{Color::Default, Color::Default, Attribute::Bold};
77+
const Face version_face{.attributes=Attribute::Bold};
7878
DisplayLineList info;
7979
for (auto [version, notes] : version_notes)
8080
{
@@ -88,20 +88,17 @@ void show_startup_info(Client* local_client, int last_version)
8888
const auto year = version / 10000;
8989
const auto month = (version / 100) % 100;
9090
const auto day = version % 100;
91-
info.push_back({format("• Kakoune v{}.{}{}.{}{}",
92-
year, month < 10 ? "0" : "", month, day < 10 ? "0" : "", day),
93-
version_face});
91+
info.push_back({format("• Kakoune v{}.{:02}.{:02}", year, month, day), version_face});
9492
}
9593

9694
for (auto&& line : notes | split<StringView>('\n'))
9795
info.push_back(parse_display_line(line, GlobalScope::instance().faces()));
9896
}
9997
if (not info.empty())
100-
{
101-
info.push_back({"See the `:doc options startup-info` to control this message",
102-
Face{Color::Default, Color::Default, Attribute::Italic}});
103-
local_client->info_show({format("Kakoune {}", version), version_face}, info, {}, InfoStyle::Prompt);
104-
}
98+
local_client->info_show({{{format("Kakoune {}", version), version_face},
99+
{", more info at ", {}},
100+
{":doc changelog", {.attributes=Attribute::Underline}}}},
101+
std::move(info), {}, InfoStyle::Prompt);
105102
}
106103

107104
inline void write_stdout(StringView str) { try { write(STDOUT_FILENO, str); } catch (runtime_error&) {} }

0 commit comments

Comments
 (0)