summaryrefslogtreecommitdiff
path: root/src/client_manager.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2022-12-06 17:48:42 +1100
committerMaxime Coste <mawww@kakoune.org>2022-12-06 17:48:42 +1100
commit933e4a599cfd3fc09edd67a024b8af08bbec7c01 (patch)
tree5fd476b2a808cffed01ae3adfaecab0f35755281 /src/client_manager.cc
parente7e46ef76a374b9e4a1c48d068023a393d78601c (diff)
Load buffer in command line order
Pass the first buffer on the the command line explicitely to client creation. This ensure the buffer list matches the command line, which makes buffer-next/buffer-previous a bit more useful. Fixes #2705
Diffstat (limited to 'src/client_manager.cc')
-rw-r--r--src/client_manager.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client_manager.cc b/src/client_manager.cc
index 25d96c4d..5453f02c 100644
--- a/src/client_manager.cc
+++ b/src/client_manager.cc
@@ -47,10 +47,12 @@ String ClientManager::generate_name() const
Client* ClientManager::create_client(std::unique_ptr<UserInterface>&& ui, int pid,
String name, EnvVarMap env_vars, StringView init_cmds,
- Optional<BufferCoord> init_coord,
+ StringView init_buffer, Optional<BufferCoord> init_coord,
Client::OnExitCallback on_exit)
{
- Buffer& buffer = BufferManager::instance().get_first_buffer();
+ Buffer& buffer = init_buffer.empty() ? BufferManager::instance().get_first_buffer()
+ : BufferManager::instance().get_buffer(init_buffer);
+
WindowAndSelections ws = get_free_window(buffer);
Client* client = new Client{std::move(ui), std::move(ws.window),
std::move(ws.selections), pid,