From e1a9d5f71e486f1c5f21e3a416ad57c6e5c9141d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 2 Apr 2014 22:33:52 +0100 Subject: [PATCH] Fix clang compilation --- src/buffer.cc | 2 +- src/client.cc | 2 +- src/commands.cc | 2 +- src/main.cc | 2 +- src/selection.hh | 1 + src/window.cc | 8 ++++---- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/buffer.cc b/src/buffer.cc index e6d8c1db..47c523d3 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -711,7 +711,7 @@ void Buffer::on_option_changed(const Option& option) void Buffer::run_hook_in_own_context(const String& hook_name, const String& param) { - InputHandler hook_handler(*this, SelectionList{ {} }); + InputHandler hook_handler(*this, { Selection{} }); m_hooks.run_hook(hook_name, param, hook_handler.context()); } diff --git a/src/client.cc b/src/client.cc index b6f63218..4f8dfbdf 100644 --- a/src/client.cc +++ b/src/client.cc @@ -125,7 +125,7 @@ void Client::check_buffer_fs_timestamp() "press r or y to reload, k or n to keep", pos, get_color("Information"), MenuStyle::Prompt); - m_input_handler.on_next_key([=, this](Key key, Context& context) { + m_input_handler.on_next_key([this, filename, ts](Key key, Context& context) { Buffer* buf = BufferManager::instance().get_buffer_ifp(filename); m_ui->info_hide(); // buffer got deleted while waiting for the key, do nothing diff --git a/src/commands.cc b/src/commands.cc index 316c4bc2..cf0c1142 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -918,7 +918,7 @@ void context_wrap(const ParametersParser& parser, Context& context, Func func) for (auto& name : names) { Buffer& buffer = BufferManager::instance().get_buffer(name); - InputHandler input_handler(buffer, SelectionList{ {} }); + InputHandler input_handler{buffer, ( Selection{} )}; func(parser, input_handler.context()); } return; diff --git a/src/main.cc b/src/main.cc index 1be2212b..a026f664 100644 --- a/src/main.cc +++ b/src/main.cc @@ -66,7 +66,7 @@ void register_env_vars() { return context.buffer().display_name(); } }, { "buffile", - [](const String& name, const Context& context) + [](const String& name, const Context& context) -> String { return context.buffer().name(); } }, { "timestamp", diff --git a/src/selection.hh b/src/selection.hh index 21cc73c2..0f30c937 100644 --- a/src/selection.hh +++ b/src/selection.hh @@ -11,6 +11,7 @@ using CaptureList = std::vector; // A selection is a Selection, associated with a CaptureList struct Selection { + Selection() = default; explicit Selection(BufferCoord pos) : Selection(pos,pos) {} Selection(BufferCoord anchor, BufferCoord cursor, CaptureList captures = {}) diff --git a/src/window.cc b/src/window.cc index db206469..9480422d 100644 --- a/src/window.cc +++ b/src/window.cc @@ -23,7 +23,7 @@ Window::Window(Buffer& buffer) m_options(buffer.options()), m_keymaps(buffer.keymaps()) { - InputHandler hook_handler{*m_buffer, SelectionList{ {} } }; + InputHandler hook_handler{*m_buffer, { Selection{} } }; hook_handler.context().set_window(*this); m_hooks.run_hook("WinCreate", buffer.name(), hook_handler.context()); m_options.register_watcher(*this); @@ -38,7 +38,7 @@ Window::Window(Buffer& buffer) Window::~Window() { - InputHandler hook_handler{*m_buffer, SelectionList{ {} } }; + InputHandler hook_handler{*m_buffer, { Selection{} } }; hook_handler.context().set_window(*this); m_hooks.run_hook("WinClose", buffer().name(), hook_handler.context()); m_options.unregister_watcher(*this); @@ -262,7 +262,7 @@ BufferCoord Window::offset_coord(BufferCoord coord, LineCount offset) lines.emplace_back(AtomList{ {buffer(), line, line+1} }); display_buffer.compute_range(); - InputHandler hook_handler{*m_buffer, SelectionList{ {} } }; + InputHandler hook_handler{*m_buffer, { Selection{} } }; hook_handler.context().set_window(*this); m_highlighters(hook_handler.context(), HighlightFlags::MoveOnly, display_buffer); m_builtin_highlighters(hook_handler.context(), HighlightFlags::MoveOnly, display_buffer); @@ -274,7 +274,7 @@ BufferCoord Window::offset_coord(BufferCoord coord, LineCount offset) void Window::on_option_changed(const Option& option) { String desc = option.name() + "=" + option.get_as_string(); - InputHandler hook_handler{*m_buffer, SelectionList{ {} } }; + InputHandler hook_handler{*m_buffer, { Selection{} } }; hook_handler.context().set_window(*this); m_hooks.run_hook("WinSetOption", desc, hook_handler.context());