Fix compilation with clang 3.4
This commit is contained in:
parent
2dd4761f89
commit
e364137196
|
@ -64,7 +64,9 @@ DisplayLine Client::generate_mode_line() const
|
||||||
void Client::change_buffer(Buffer& buffer)
|
void Client::change_buffer(Buffer& buffer)
|
||||||
{
|
{
|
||||||
ClientManager::instance().add_free_window(std::move(m_window), std::move(context().selections()));
|
ClientManager::instance().add_free_window(std::move(m_window), std::move(context().selections()));
|
||||||
std::tie(m_window, context().m_selections) = ClientManager::instance().get_free_window(buffer);
|
WindowAndSelections ws = ClientManager::instance().get_free_window(buffer);
|
||||||
|
m_window = std::move(ws.window);
|
||||||
|
context().m_selections = std::move(ws.selections);
|
||||||
context().set_window(*m_window);
|
context().set_window(*m_window);
|
||||||
m_window->set_dimensions(ui().dimensions());
|
m_window->set_dimensions(ui().dimensions());
|
||||||
m_window->hooks().run_hook("WinDisplay", buffer.name(), context());
|
m_window->hooks().run_hook("WinDisplay", buffer.name(), context());
|
||||||
|
|
|
@ -29,8 +29,8 @@ Client* ClientManager::create_client(std::unique_ptr<UserInterface>&& ui,
|
||||||
{
|
{
|
||||||
Buffer& buffer = **BufferManager::instance().begin();
|
Buffer& buffer = **BufferManager::instance().begin();
|
||||||
WindowAndSelections ws = get_free_window(buffer);
|
WindowAndSelections ws = get_free_window(buffer);
|
||||||
Client* client = new Client{std::move(ui), std::move(std::get<0>(ws)),
|
Client* client = new Client{std::move(ui), std::move(ws.window),
|
||||||
std::move(std::get<1>(ws)), generate_name()};
|
std::move(ws.selections), generate_name()};
|
||||||
m_clients.emplace_back(client);
|
m_clients.emplace_back(client);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ WindowAndSelections ClientManager::get_free_window(Buffer& buffer)
|
||||||
for (auto it = m_free_windows.begin(), end = m_free_windows.end();
|
for (auto it = m_free_windows.begin(), end = m_free_windows.end();
|
||||||
it != end; ++it)
|
it != end; ++it)
|
||||||
{
|
{
|
||||||
auto& w = std::get<0>(*it);
|
auto& w = it->window;
|
||||||
if (&w->buffer() == &buffer)
|
if (&w->buffer() == &buffer)
|
||||||
{
|
{
|
||||||
w->forget_timestamp();
|
w->forget_timestamp();
|
||||||
|
@ -101,7 +101,7 @@ WindowAndSelections ClientManager::get_free_window(Buffer& buffer)
|
||||||
void ClientManager::add_free_window(std::unique_ptr<Window>&& window, SelectionList selections)
|
void ClientManager::add_free_window(std::unique_ptr<Window>&& window, SelectionList selections)
|
||||||
{
|
{
|
||||||
Buffer& buffer = window->buffer();
|
Buffer& buffer = window->buffer();
|
||||||
m_free_windows.emplace_back(std::move(window), DynamicSelectionList{ buffer, std::move(selections) });
|
m_free_windows.push_back({ std::move(window), DynamicSelectionList{ buffer, std::move(selections) } });
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientManager::ensure_no_client_uses_buffer(Buffer& buffer)
|
void ClientManager::ensure_no_client_uses_buffer(Buffer& buffer)
|
||||||
|
@ -131,7 +131,7 @@ void ClientManager::ensure_no_client_uses_buffer(Buffer& buffer)
|
||||||
}
|
}
|
||||||
auto end = std::remove_if(m_free_windows.begin(), m_free_windows.end(),
|
auto end = std::remove_if(m_free_windows.begin(), m_free_windows.end(),
|
||||||
[&buffer](const WindowAndSelections& ws)
|
[&buffer](const WindowAndSelections& ws)
|
||||||
{ return &std::get<0>(ws)->buffer() == &buffer; });
|
{ return &ws.window->buffer() == &buffer; });
|
||||||
m_free_windows.erase(end, m_free_windows.end());
|
m_free_windows.erase(end, m_free_windows.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,11 @@ namespace Kakoune
|
||||||
|
|
||||||
struct client_removed{};
|
struct client_removed{};
|
||||||
|
|
||||||
using WindowAndSelections = std::tuple<std::unique_ptr<Window>,
|
struct WindowAndSelections
|
||||||
DynamicSelectionList>;
|
{
|
||||||
|
std::unique_ptr<Window> window;
|
||||||
|
DynamicSelectionList selections;
|
||||||
|
};
|
||||||
|
|
||||||
class ClientManager : public Singleton<ClientManager>
|
class ClientManager : public Singleton<ClientManager>
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Context;
|
class Context;
|
||||||
using CommandParameters = memoryview<String>;
|
using CommandParameters = memoryview<String>;
|
||||||
using Command = std::function<void (CommandParameters, Context& context)>;
|
using Command = std::function<void (CommandParameters, Context& context)>;
|
||||||
using CommandCompleter = std::function<Completions (const Context& context,
|
using CommandCompleter = std::function<Completions (const Context& context,
|
||||||
|
|
|
@ -314,7 +314,7 @@ void add_hook(CommandParameters params, Context& context)
|
||||||
|
|
||||||
void rm_hooks(CommandParameters params, Context& context)
|
void rm_hooks(CommandParameters params, Context& context)
|
||||||
{
|
{
|
||||||
ParametersParser parser(params, {}, ParametersParser::Flags::None, 2, 2);
|
ParametersParser parser(params, OptionMap{}, ParametersParser::Flags::None, 2, 2);
|
||||||
get_hook_manager(parser[0], context).remove_hooks(parser[1]);
|
get_hook_manager(parser[0], context).remove_hooks(parser[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ KeymapMode parse_keymap_mode(const String& str)
|
||||||
|
|
||||||
void map_key(CommandParameters params, Context& context)
|
void map_key(CommandParameters params, Context& context)
|
||||||
{
|
{
|
||||||
ParametersParser parser(params, {}, ParametersParser::Flags::None, 4, 4);
|
ParametersParser parser(params, OptionMap{}, ParametersParser::Flags::None, 4, 4);
|
||||||
|
|
||||||
KeymapManager& keymaps = get_keymap_manager(params[0], context);
|
KeymapManager& keymaps = get_keymap_manager(params[0], context);
|
||||||
KeymapMode keymap_mode = parse_keymap_mode(params[1]);
|
KeymapMode keymap_mode = parse_keymap_mode(params[1]);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Context;
|
class Context;
|
||||||
|
|
||||||
void register_commands();
|
void register_commands();
|
||||||
void exec_keys(const KeyList& keys, Context& context);
|
void exec_keys(const KeyList& keys, Context& context);
|
||||||
|
|
|
@ -595,9 +595,9 @@ public:
|
||||||
[](const Region& r, const BufferCoord& c) { return r.end < c; });
|
[](const Region& r, const BufferCoord& c) { return r.end < c; });
|
||||||
auto end = std::lower_bound(begin, regions.end(), range.second,
|
auto end = std::lower_bound(begin, regions.end(), range.second,
|
||||||
[](const Region& r, const BufferCoord& c) { return r.begin < c; });
|
[](const Region& r, const BufferCoord& c) { return r.begin < c; });
|
||||||
auto correct = [&](const BufferCoord& c) {
|
auto correct = [&](const BufferCoord& c) -> BufferCoord {
|
||||||
if (buffer[c.line].length() == c.column)
|
if (buffer[c.line].length() == c.column)
|
||||||
return BufferCoord{c.line+1, 0};
|
return {c.line+1, 0};
|
||||||
return c;
|
return c;
|
||||||
};
|
};
|
||||||
for (; begin != end; ++begin)
|
for (; begin != end; ++begin)
|
||||||
|
|
|
@ -95,15 +95,15 @@ void register_env_vars()
|
||||||
{ return context.options()[name.substr(4_byte)].get_as_string(); }
|
{ return context.options()[name.substr(4_byte)].get_as_string(); }
|
||||||
}, {
|
}, {
|
||||||
"reg_.+",
|
"reg_.+",
|
||||||
[](const String& name, const Context& context)
|
[](const String& name, const Context& context) -> String
|
||||||
{ return RegisterManager::instance()[name[4]].values(context)[0]; }
|
{ return RegisterManager::instance()[name[4]].values(context)[0]; }
|
||||||
}, {
|
}, {
|
||||||
"session",
|
"session",
|
||||||
[](const String& name, const Context& context)
|
[](const String& name, const Context& context) -> String
|
||||||
{ return Server::instance().session(); }
|
{ return Server::instance().session(); }
|
||||||
}, {
|
}, {
|
||||||
"client",
|
"client",
|
||||||
[](const String& name, const Context& context)
|
[](const String& name, const Context& context) -> String
|
||||||
{ return context.name(); }
|
{ return context.name(); }
|
||||||
}, {
|
}, {
|
||||||
"cursor_line",
|
"cursor_line",
|
||||||
|
|
|
@ -1308,8 +1308,8 @@ KeyMap keymap =
|
||||||
{ alt('a'), select_object<ObjectFlags::ToBegin | ObjectFlags::ToEnd> },
|
{ alt('a'), select_object<ObjectFlags::ToBegin | ObjectFlags::ToEnd> },
|
||||||
{ ']', select_object<ObjectFlags::ToEnd> },
|
{ ']', select_object<ObjectFlags::ToEnd> },
|
||||||
{ '[', select_object<ObjectFlags::ToBegin> },
|
{ '[', select_object<ObjectFlags::ToBegin> },
|
||||||
{ '}', select_object<ObjectFlags::ToEnd, SelectMode::Extend> },
|
|
||||||
{ '{', select_object<ObjectFlags::ToBegin, SelectMode::Extend> },
|
{ '{', select_object<ObjectFlags::ToBegin, SelectMode::Extend> },
|
||||||
|
{ '}', select_object<ObjectFlags::ToEnd, SelectMode::Extend> },
|
||||||
|
|
||||||
{ alt('j'), join },
|
{ alt('j'), join },
|
||||||
{ alt('J'), join_select_spaces },
|
{ alt('J'), join_select_spaces },
|
||||||
|
@ -1317,8 +1317,8 @@ KeyMap keymap =
|
||||||
{ alt('k'), keep<true> },
|
{ alt('k'), keep<true> },
|
||||||
{ alt('K'), keep<false> },
|
{ alt('K'), keep<false> },
|
||||||
|
|
||||||
{ '<', deindent },
|
{ '<', deindent<true> },
|
||||||
{ '>', indent },
|
{ '>', indent<false> },
|
||||||
{ alt('>'), indent<true> },
|
{ alt('>'), indent<true> },
|
||||||
{ alt('<'), deindent<false> },
|
{ alt('<'), deindent<false> },
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ enum Direction { Forward, Backward };
|
||||||
|
|
||||||
using MatchResults = boost::match_results<BufferIterator>;
|
using MatchResults = boost::match_results<BufferIterator>;
|
||||||
|
|
||||||
static bool find_last_match(BufferIterator begin, const BufferIterator& end,
|
inline bool find_last_match(BufferIterator begin, const BufferIterator& end,
|
||||||
MatchResults& res, const Regex& regex)
|
MatchResults& res, const Regex& regex)
|
||||||
{
|
{
|
||||||
MatchResults matches;
|
MatchResults matches;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
|
|
||||||
struct Context;
|
class Context;
|
||||||
using EnvVarRetriever = std::function<String (const String& name, const Context&)>;
|
using EnvVarRetriever = std::function<String (const String& name, const Context&)>;
|
||||||
using EnvVarMap = std::unordered_map<String, String>;
|
using EnvVarMap = std::unordered_map<String, String>;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user