mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-24 20:13:00 +03:00
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)
|
||||
{
|
||||
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);
|
||||
m_window->set_dimensions(ui().dimensions());
|
||||
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();
|
||||
WindowAndSelections ws = get_free_window(buffer);
|
||||
Client* client = new Client{std::move(ui), std::move(std::get<0>(ws)),
|
||||
std::move(std::get<1>(ws)), generate_name()};
|
||||
Client* client = new Client{std::move(ui), std::move(ws.window),
|
||||
std::move(ws.selections), generate_name()};
|
||||
m_clients.emplace_back(client);
|
||||
try
|
||||
{
|
||||
@ -86,7 +86,7 @@ WindowAndSelections ClientManager::get_free_window(Buffer& buffer)
|
||||
for (auto it = m_free_windows.begin(), end = m_free_windows.end();
|
||||
it != end; ++it)
|
||||
{
|
||||
auto& w = std::get<0>(*it);
|
||||
auto& w = it->window;
|
||||
if (&w->buffer() == &buffer)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
@ -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(),
|
||||
[&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());
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,11 @@ namespace Kakoune
|
||||
|
||||
struct client_removed{};
|
||||
|
||||
using WindowAndSelections = std::tuple<std::unique_ptr<Window>,
|
||||
DynamicSelectionList>;
|
||||
struct WindowAndSelections
|
||||
{
|
||||
std::unique_ptr<Window> window;
|
||||
DynamicSelectionList selections;
|
||||
};
|
||||
|
||||
class ClientManager : public Singleton<ClientManager>
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
struct Context;
|
||||
class Context;
|
||||
using CommandParameters = memoryview<String>;
|
||||
using Command = std::function<void (CommandParameters, 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)
|
||||
{
|
||||
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]);
|
||||
}
|
||||
|
||||
@ -533,7 +533,7 @@ KeymapMode parse_keymap_mode(const String& str)
|
||||
|
||||
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);
|
||||
KeymapMode keymap_mode = parse_keymap_mode(params[1]);
|
||||
|
@ -6,7 +6,7 @@
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
struct Context;
|
||||
class Context;
|
||||
|
||||
void register_commands();
|
||||
void exec_keys(const KeyList& keys, Context& context);
|
||||
|
@ -595,9 +595,9 @@ public:
|
||||
[](const Region& r, const BufferCoord& c) { return r.end < c; });
|
||||
auto end = std::lower_bound(begin, regions.end(), range.second,
|
||||
[](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)
|
||||
return BufferCoord{c.line+1, 0};
|
||||
return {c.line+1, 0};
|
||||
return c;
|
||||
};
|
||||
for (; begin != end; ++begin)
|
||||
|
@ -95,15 +95,15 @@ void register_env_vars()
|
||||
{ return context.options()[name.substr(4_byte)].get_as_string(); }
|
||||
}, {
|
||||
"reg_.+",
|
||||
[](const String& name, const Context& context)
|
||||
[](const String& name, const Context& context) -> String
|
||||
{ return RegisterManager::instance()[name[4]].values(context)[0]; }
|
||||
}, {
|
||||
"session",
|
||||
[](const String& name, const Context& context)
|
||||
[](const String& name, const Context& context) -> String
|
||||
{ return Server::instance().session(); }
|
||||
}, {
|
||||
"client",
|
||||
[](const String& name, const Context& context)
|
||||
[](const String& name, const Context& context) -> String
|
||||
{ return context.name(); }
|
||||
}, {
|
||||
"cursor_line",
|
||||
|
@ -1308,8 +1308,8 @@ KeyMap keymap =
|
||||
{ alt('a'), select_object<ObjectFlags::ToBegin | ObjectFlags::ToEnd> },
|
||||
{ ']', select_object<ObjectFlags::ToEnd> },
|
||||
{ '[', select_object<ObjectFlags::ToBegin> },
|
||||
{ '}', select_object<ObjectFlags::ToEnd, SelectMode::Extend> },
|
||||
{ '{', select_object<ObjectFlags::ToBegin, SelectMode::Extend> },
|
||||
{ '}', select_object<ObjectFlags::ToEnd, SelectMode::Extend> },
|
||||
|
||||
{ alt('j'), join },
|
||||
{ alt('J'), join_select_spaces },
|
||||
@ -1317,8 +1317,8 @@ KeyMap keymap =
|
||||
{ alt('k'), keep<true> },
|
||||
{ alt('K'), keep<false> },
|
||||
|
||||
{ '<', deindent },
|
||||
{ '>', indent },
|
||||
{ '<', deindent<true> },
|
||||
{ '>', indent<false> },
|
||||
{ alt('>'), indent<true> },
|
||||
{ alt('<'), deindent<false> },
|
||||
|
||||
|
@ -213,7 +213,7 @@ enum Direction { Forward, Backward };
|
||||
|
||||
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 matches;
|
||||
|
@ -9,7 +9,7 @@
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
struct Context;
|
||||
class Context;
|
||||
using EnvVarRetriever = std::function<String (const String& name, const Context&)>;
|
||||
using EnvVarMap = std::unordered_map<String, String>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user