mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-28 17:13:00 +03:00
Only touch new clients selections when target coord are explicit
Do not implicitely change new clients selections to target coordinates when the user did not specify them, so that we can re-use the selections from the found free window, which is the generally desired behaviour.
This commit is contained in:
parent
c61aae0722
commit
6f4515f005
@ -55,6 +55,8 @@ Client::~Client()
|
||||
{
|
||||
m_window->options().unregister_watcher(*this);
|
||||
m_window->set_client(nullptr);
|
||||
ClientManager::instance().add_free_window(std::move(m_window),
|
||||
std::move(context().selections()));
|
||||
}
|
||||
|
||||
bool Client::process_pending_inputs()
|
||||
|
@ -19,11 +19,11 @@ ClientManager::~ClientManager()
|
||||
|
||||
void ClientManager::clear()
|
||||
{
|
||||
m_free_windows.clear();
|
||||
// So that clients destructor find the client manager empty
|
||||
// so that local UI does not fork.
|
||||
ClientList clients = std::move(m_clients);
|
||||
m_client_trash.clear();
|
||||
m_free_windows.clear();
|
||||
}
|
||||
|
||||
String ClientManager::generate_name() const
|
||||
@ -38,7 +38,7 @@ String ClientManager::generate_name() const
|
||||
|
||||
Client* ClientManager::create_client(std::unique_ptr<UserInterface>&& ui,
|
||||
EnvVarMap env_vars, StringView init_cmds,
|
||||
BufferCoord init_coord)
|
||||
Optional<BufferCoord> init_coord)
|
||||
{
|
||||
Buffer& buffer = BufferManager::instance().get_first_buffer();
|
||||
WindowAndSelections ws = get_free_window(buffer);
|
||||
@ -47,9 +47,12 @@ Client* ClientManager::create_client(std::unique_ptr<UserInterface>&& ui,
|
||||
generate_name()};
|
||||
m_clients.emplace_back(client);
|
||||
|
||||
auto& selections = client->context().selections_write_only();
|
||||
selections = SelectionList(buffer, buffer.clamp(init_coord));
|
||||
client->context().window().center_line(init_coord.line);
|
||||
if (init_coord)
|
||||
{
|
||||
auto& selections = client->context().selections_write_only();
|
||||
selections = SelectionList(buffer, buffer.clamp(*init_coord));
|
||||
client->context().window().center_line(init_coord->line);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
|
||||
Client* create_client(std::unique_ptr<UserInterface>&& ui,
|
||||
EnvVarMap env_vars, StringView init_cmds,
|
||||
BufferCoord init_coord);
|
||||
Optional<BufferCoord> init_coord);
|
||||
|
||||
bool empty() const { return m_clients.empty(); }
|
||||
size_t count() const { return m_clients.size(); }
|
||||
|
Loading…
Reference in New Issue
Block a user