summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buffer_manager.cc4
-rw-r--r--src/client_manager.cc16
2 files changed, 11 insertions, 9 deletions
diff --git a/src/buffer_manager.cc b/src/buffer_manager.cc
index 35f0fcde..8d2820b2 100644
--- a/src/buffer_manager.cc
+++ b/src/buffer_manager.cc
@@ -101,9 +101,7 @@ Buffer& BufferManager::get_buffer_matching(const Regex& regex)
Buffer& BufferManager::get_first_buffer()
{
if (all_of(m_buffers, [](auto& b) { return (b->flags() & Buffer::Flags::Debug); }))
- create_buffer("*scratch*", Buffer::Flags::None,
- {StringData::create("*** this is a *scratch* buffer which won't be automatically saved ***\n"),
- StringData::create("*** use it for notes or open a file buffer with the :edit command ***\n")},
+ create_buffer("*scratch*", Buffer::Flags::None, {StringData::create("\n")},
ByteOrderMark::None, EolFormat::Lf, {InvalidTime, {}, {}});
return *m_buffers.back();
diff --git a/src/client_manager.cc b/src/client_manager.cc
index 53caeea0..0ad5392f 100644
--- a/src/client_manager.cc
+++ b/src/client_manager.cc
@@ -64,24 +64,28 @@ Client* ClientManager::create_client(std::unique_ptr<UserInterface>&& ui, int pi
std::move(on_exit)};
m_clients.emplace_back(client);
+ auto& context = client->context();
+ if (buffer->name() == "*scratch*")
+ context.print_status({"This *scratch* buffer won't be automatically saved",
+ context.faces()["Information"]});
+
if (init_coord)
{
- auto& selections = client->context().selections_write_only();
+ auto& selections = context.selections_write_only();
selections = SelectionList(*buffer, buffer->clamp(*init_coord));
- client->context().window().center_line(init_coord->line);
+ context.window().center_line(init_coord->line);
}
try
{
- auto& context = client->context();
context.hooks().run_hook(Hook::ClientCreate, context.name(), context);
CommandManager::instance().execute(init_cmds, context);
}
catch (Kakoune::runtime_error& error)
{
- client->context().print_status({error.what().str(), client->context().faces()["Error"]});
- client->context().hooks().run_hook(Hook::RuntimeError, error.what(),
- client->context());
+ context.print_status({error.what().str(), context.faces()["Error"]});
+ context.hooks().run_hook(Hook::RuntimeError, error.what(),
+ context);
}
// Do not return the client if it already got moved to the trash