mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-11 01:37:41 +03:00
Apply clang-tidy modernize to the codebase
This commit is contained in:
parent
9dfd17a5bc
commit
dcd8f6ef01
@ -44,7 +44,7 @@ Vector<StringView> AliasRegistry::aliases_for(StringView command) const
|
||||
for (auto& alias : m_aliases)
|
||||
{
|
||||
if (alias.value == command)
|
||||
res.push_back(alias.key);
|
||||
res.emplace_back(alias.key);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -11,7 +11,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
# include <stdlib.h>
|
||||
# include <cstdlib>
|
||||
#endif
|
||||
|
||||
namespace Kakoune
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "value.hh"
|
||||
#include "vector.hh"
|
||||
|
||||
#include <time.h>
|
||||
#include <ctime>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
@ -118,7 +118,7 @@ public:
|
||||
timespec fs_timestamp = InvalidTime);
|
||||
Buffer(const Buffer&) = delete;
|
||||
Buffer& operator= (const Buffer&) = delete;
|
||||
~Buffer();
|
||||
~Buffer() override;
|
||||
|
||||
Flags flags() const { return m_flags; }
|
||||
Flags& flags() { return m_flags; }
|
||||
|
@ -12,9 +12,11 @@
|
||||
#include "user_interface.hh"
|
||||
#include "window.hh"
|
||||
|
||||
#include <signal.h>
|
||||
#include <csignal>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
@ -26,7 +28,7 @@ Client::Client(std::unique_ptr<UserInterface>&& ui,
|
||||
: m_ui{std::move(ui)}, m_window{std::move(window)},
|
||||
m_input_handler{std::move(selections), Context::Flags::None,
|
||||
std::move(name)},
|
||||
m_env_vars(env_vars)
|
||||
m_env_vars(std::move(env_vars))
|
||||
{
|
||||
m_window->set_client(this);
|
||||
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
SelectionList selections,
|
||||
EnvVarMap env_vars,
|
||||
String name);
|
||||
~Client();
|
||||
~Client() override;
|
||||
|
||||
Client(Client&&) = delete;
|
||||
|
||||
|
@ -635,7 +635,7 @@ Completions CommandManager::complete(const Context& context,
|
||||
for (auto it = tokens.begin() + cmd_idx + 1; it != tokens.end(); ++it)
|
||||
params.push_back(it->content());
|
||||
if (tok_idx == tokens.size())
|
||||
params.push_back("");
|
||||
params.emplace_back("");
|
||||
Completions completions = offset_pos(command_it->second.completer(
|
||||
context, flags, params, tok_idx - cmd_idx - 1,
|
||||
cursor_pos_in_token), start);
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "window.hh"
|
||||
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@ -121,8 +122,8 @@ static Completions complete_buffer_name(const Context& context, CompletionFlags
|
||||
{
|
||||
struct RankedMatchAndBuffer : RankedMatch
|
||||
{
|
||||
RankedMatchAndBuffer(const RankedMatch& m, const Buffer* b)
|
||||
: RankedMatch{m}, buffer{b} {}
|
||||
RankedMatchAndBuffer(RankedMatch m, const Buffer* b)
|
||||
: RankedMatch{std::move(m)}, buffer{b} {}
|
||||
|
||||
using RankedMatch::operator==;
|
||||
using RankedMatch::operator<;
|
||||
@ -976,7 +977,7 @@ void define_command(const ParametersParser& parser, Context& context, const Shel
|
||||
shell_context).first;
|
||||
candidates.clear();
|
||||
for (auto c : output | split<StringView>('\n'))
|
||||
candidates.push_back({c.str(), used_letters(c)});
|
||||
candidates.emplace_back(c.str(), used_letters(c));
|
||||
token = token_to_complete;
|
||||
}
|
||||
|
||||
@ -1330,7 +1331,7 @@ const CommandDesc declare_option_cmd = {
|
||||
if (parser[0] == "int")
|
||||
opt = ®.declare_option<int>(parser[1], docstring, 0, flags);
|
||||
else if (parser[0] == "bool")
|
||||
opt = ®.declare_option<bool>(parser[1], docstring, 0, flags);
|
||||
opt = ®.declare_option<bool>(parser[1], docstring, false, flags);
|
||||
else if (parser[0] == "str")
|
||||
opt = ®.declare_option<String>(parser[1], docstring, "", flags);
|
||||
else if (parser[0] == "regex")
|
||||
|
@ -164,7 +164,7 @@ void DisplayLine::push_back(DisplayAtom atom)
|
||||
|
||||
DisplayLine::iterator DisplayLine::erase(iterator beg, iterator end)
|
||||
{
|
||||
iterator res = m_atoms.erase(beg, end);
|
||||
auto res = m_atoms.erase(beg, end);
|
||||
compute_range();
|
||||
return res;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <functional>
|
||||
|
||||
#include <sys/select.h>
|
||||
#include <signal.h>
|
||||
#include <csignal>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ namespace Kakoune
|
||||
|
||||
struct exception
|
||||
{
|
||||
virtual ~exception() {}
|
||||
virtual ~exception() = default;
|
||||
virtual StringView what() const;
|
||||
};
|
||||
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include "string.hh"
|
||||
#include "unicode.hh"
|
||||
|
||||
#include <errno.h>
|
||||
#include <cerrno>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
#include <sys/select.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
@ -470,7 +470,7 @@ CandidateList complete_command(StringView prefix, ByteCount cursor_pos)
|
||||
return candidates(matches, dirname);
|
||||
}
|
||||
|
||||
typedef decltype(stat::st_mtim) TimeSpec;
|
||||
using TimeSpec = decltype(stat::st_mtim);
|
||||
|
||||
struct CommandCache
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ using HighlighterAndId = std::pair<String, std::unique_ptr<Highlighter>>;
|
||||
|
||||
struct Highlighter
|
||||
{
|
||||
virtual ~Highlighter() {}
|
||||
virtual ~Highlighter() = default;
|
||||
virtual void highlight(const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer, BufferRange range) = 0;
|
||||
|
||||
virtual bool has_children() const { return false; }
|
||||
@ -48,7 +48,7 @@ template<typename Func>
|
||||
struct SimpleHighlighter : public Highlighter
|
||||
{
|
||||
SimpleHighlighter(Func func) : m_func(std::move(func)) {}
|
||||
virtual void highlight(const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer, BufferRange range) override
|
||||
void highlight(const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer, BufferRange range) override
|
||||
{
|
||||
m_func(context, flags, display_buffer, range);
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ public:
|
||||
m_face_getter(std::move(face_getter)),
|
||||
m_highlighter(Regex{}, FacesSpec{}) {}
|
||||
|
||||
void highlight(const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer, BufferRange range)
|
||||
void highlight(const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer, BufferRange range) override
|
||||
{
|
||||
if (flags != HighlightFlags::Highlight)
|
||||
return;
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include <utility>
|
||||
|
||||
#include "input_handler.hh"
|
||||
|
||||
#include "buffer_manager.hh"
|
||||
@ -21,7 +23,7 @@ class InputMode : public RefCountable
|
||||
{
|
||||
public:
|
||||
InputMode(InputHandler& input_handler) : m_input_handler(input_handler) {}
|
||||
virtual ~InputMode() {}
|
||||
~InputMode() override = default;
|
||||
InputMode(const InputMode&) = delete;
|
||||
InputMode& operator=(const InputMode&) = delete;
|
||||
|
||||
@ -282,13 +284,13 @@ public:
|
||||
AtomList atoms = { { to_string(context().selections().size()) + " sel", get_face("StatusLineInfo") } };
|
||||
if (m_params.count != 0)
|
||||
{
|
||||
atoms.push_back({ " param=", get_face("StatusLineInfo") });
|
||||
atoms.push_back({ to_string(m_params.count), get_face("StatusLineValue") });
|
||||
atoms.emplace_back(" param=", get_face("StatusLineInfo"));
|
||||
atoms.emplace_back(to_string(m_params.count), get_face("StatusLineValue"));
|
||||
}
|
||||
if (m_params.reg)
|
||||
{
|
||||
atoms.push_back({ " reg=", get_face("StatusLineInfo") });
|
||||
atoms.push_back({ StringView(m_params.reg).str(), get_face("StatusLineValue") });
|
||||
atoms.emplace_back(" reg=", get_face("StatusLineInfo"));
|
||||
atoms.emplace_back(StringView(m_params.reg).str(), get_face("StatusLineValue"));
|
||||
}
|
||||
return atoms;
|
||||
}
|
||||
@ -513,7 +515,7 @@ public:
|
||||
Menu(InputHandler& input_handler, Vector<DisplayLine> choices,
|
||||
MenuCallback callback)
|
||||
: InputMode(input_handler),
|
||||
m_callback(callback), m_choices(choices.begin(), choices.end()),
|
||||
m_callback(std::move(callback)), m_choices(choices.begin(), choices.end()),
|
||||
m_selected(m_choices.begin())
|
||||
{
|
||||
if (not context().has_client())
|
||||
@ -677,7 +679,7 @@ public:
|
||||
String initstr, Face face, PromptFlags flags,
|
||||
Completer completer, PromptCallback callback)
|
||||
: InputMode(input_handler), m_prompt(prompt.str()), m_prompt_face(face),
|
||||
m_flags(flags), m_completer(completer), m_callback(callback),
|
||||
m_flags(flags), m_completer(std::move(completer)), m_callback(std::move(callback)),
|
||||
m_autoshowcompl{context().options()["autoshowcompl"].get<bool>()}
|
||||
{
|
||||
m_history_it = ms_history[m_prompt].end();
|
||||
@ -1009,7 +1011,7 @@ public:
|
||||
get_face("Error") });
|
||||
}
|
||||
|
||||
~Insert()
|
||||
~Insert() override
|
||||
{
|
||||
auto& selections = context().selections();
|
||||
for (auto& sel : selections)
|
||||
@ -1057,7 +1059,7 @@ public:
|
||||
if (sel.cursor() == BufferCoord{0,0})
|
||||
continue;
|
||||
auto pos = sel.cursor();
|
||||
sels.push_back({ buffer.char_prev(pos) });
|
||||
sels.emplace_back(buffer.char_prev(pos));
|
||||
}
|
||||
if (not sels.empty())
|
||||
SelectionList{buffer, std::move(sels)}.erase();
|
||||
@ -1066,7 +1068,7 @@ public:
|
||||
{
|
||||
Vector<Selection> sels;
|
||||
for (auto& sel : context().selections())
|
||||
sels.push_back({ sel.cursor() });
|
||||
sels.emplace_back(sel.cursor());
|
||||
SelectionList{buffer, std::move(sels)}.erase();
|
||||
}
|
||||
else if (key == Key::Left)
|
||||
@ -1315,8 +1317,7 @@ InputHandler::InputHandler(SelectionList selections, Context::Flags flags, Strin
|
||||
current_mode().on_enabled();
|
||||
}
|
||||
|
||||
InputHandler::~InputHandler()
|
||||
{}
|
||||
InputHandler::~InputHandler() = default;
|
||||
|
||||
void InputHandler::push_mode(InputMode* new_mode)
|
||||
{
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "user_interface.hh"
|
||||
|
||||
#include <numeric>
|
||||
#include <utility>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
@ -113,8 +114,8 @@ InsertCompletion complete_word(const SelectionList& sels, const OptionManager& o
|
||||
|
||||
struct RankedMatchAndBuffer : RankedMatch
|
||||
{
|
||||
RankedMatchAndBuffer(const RankedMatch& m, const Buffer* b)
|
||||
: RankedMatch{m}, buffer{b} {}
|
||||
RankedMatchAndBuffer(RankedMatch m, const Buffer* b)
|
||||
: RankedMatch{std::move(m)}, buffer{b} {}
|
||||
|
||||
using RankedMatch::operator==;
|
||||
using RankedMatch::operator<;
|
||||
@ -400,11 +401,11 @@ void InsertCompleter::select(int offset, Vector<Key>& keystrokes)
|
||||
}
|
||||
|
||||
for (auto i = 0_byte; i < prefix_len; ++i)
|
||||
keystrokes.push_back(Key::Backspace);
|
||||
keystrokes.emplace_back(Key::Backspace);
|
||||
for (auto i = 0_byte; i < suffix_len; ++i)
|
||||
keystrokes.push_back(Key::Delete);
|
||||
keystrokes.emplace_back(Key::Delete);
|
||||
for (auto& c : candidate.completion)
|
||||
keystrokes.push_back(c);
|
||||
keystrokes.emplace_back(c);
|
||||
}
|
||||
|
||||
void InsertCompleter::update()
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
InsertCompleter(Context& context);
|
||||
InsertCompleter(const InsertCompleter&) = delete;
|
||||
InsertCompleter& operator=(const InsertCompleter&) = delete;
|
||||
~InsertCompleter();
|
||||
~InsertCompleter() override;
|
||||
|
||||
void select(int offset, Vector<Key>& keystrokes);
|
||||
void update();
|
||||
|
@ -64,14 +64,14 @@ KeyList parse_keys(StringView str)
|
||||
{
|
||||
if (*it != '<')
|
||||
{
|
||||
result.push_back({Key::Modifiers::None, *it});
|
||||
result.emplace_back(Key::Modifiers::None, *it);
|
||||
continue;
|
||||
}
|
||||
|
||||
Utf8It end_it = std::find(it, str_end, '>');
|
||||
if (end_it == str_end)
|
||||
{
|
||||
result.push_back({Key::Modifiers::None, *it});
|
||||
result.emplace_back(Key::Modifiers::None, *it);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -95,12 +95,12 @@ KeyList parse_keys(StringView str)
|
||||
if (name_it != end(keynamemap))
|
||||
result.push_back(canonicalize_ifn({ modifier, name_it->key }));
|
||||
else if (desc.char_length() == 1)
|
||||
result.push_back(Key{ modifier, desc[0_char] });
|
||||
result.emplace_back(modifier, desc[0_char]);
|
||||
else if (to_lower(desc[0_byte]) == 'f' and desc.length() <= 3)
|
||||
{
|
||||
int val = str_to_int(desc.substr(1_byte));
|
||||
if (val >= 1 and val <= 12)
|
||||
result.push_back(Key{ modifier, Key::F1 + (val - 1) });
|
||||
result.emplace_back(modifier, Key::F1 + (val - 1));
|
||||
else
|
||||
throw runtime_error("Only F1 through F12 are supported");
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ std::unique_ptr<UserInterface> create_local_ui(UIType ui_type)
|
||||
});
|
||||
}
|
||||
|
||||
~LocalUI()
|
||||
~LocalUI() override
|
||||
{
|
||||
set_signal_handler(SIGHUP, m_old_sighup);
|
||||
set_signal_handler(SIGTSTP, m_old_sigtstp);
|
||||
@ -733,7 +733,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
Vector<String> params;
|
||||
for (size_t i = 1; i < argc; ++i)
|
||||
params.push_back(argv[i]);
|
||||
params.emplace_back(argv[i]);
|
||||
|
||||
const ParameterDesc param_desc{
|
||||
SwitchMap{ { "c", { true, "connect to given session" } },
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <ncurses.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <csignal>
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
@ -17,7 +17,7 @@ class NCursesUI : public UserInterface
|
||||
{
|
||||
public:
|
||||
NCursesUI();
|
||||
~NCursesUI();
|
||||
~NCursesUI() override;
|
||||
|
||||
NCursesUI(const NCursesUI&) = delete;
|
||||
NCursesUI& operator=(const NCursesUI&) = delete;
|
||||
|
@ -609,8 +609,8 @@ void paste_all(Context& context, NormalParams params)
|
||||
ByteCount pos = 0;
|
||||
for (auto offset : offsets)
|
||||
{
|
||||
result.push_back({ buffer.advance(ins_pos, pos),
|
||||
buffer.advance(ins_pos, offset-1) });
|
||||
result.emplace_back(buffer.advance(ins_pos, pos),
|
||||
buffer.advance(ins_pos, offset-1));
|
||||
pos = offset;
|
||||
}
|
||||
}
|
||||
@ -819,7 +819,7 @@ void join_lines_select_spaces(Context& context, NormalParams)
|
||||
{
|
||||
auto begin = buffer.iterator_at({line, buffer[line].length()-1});
|
||||
auto end = std::find_if_not(begin+1, buffer.end(), is_horizontal_blank);
|
||||
selections.push_back({begin.coord(), (end-1).coord()});
|
||||
selections.emplace_back(begin.coord(), (end-1).coord());
|
||||
}
|
||||
}
|
||||
if (selections.empty())
|
||||
@ -905,7 +905,7 @@ void indent(Context& context, NormalParams)
|
||||
for (auto line = std::max(last_line, sel.min().line); line < sel.max().line+1; ++line)
|
||||
{
|
||||
if (indent_empty or buffer[line].length() > 1)
|
||||
sels.push_back({line, line});
|
||||
sels.emplace_back(line, line);
|
||||
}
|
||||
// avoid reindenting the same line if multiple selections are on it
|
||||
last_line = sel.max().line+1;
|
||||
@ -946,12 +946,12 @@ void deindent(Context& context, NormalParams)
|
||||
else
|
||||
{
|
||||
if (deindent_incomplete and width != 0)
|
||||
sels.push_back({ line, BufferCoord{line, column-1} });
|
||||
sels.emplace_back(line, BufferCoord{line, column-1});
|
||||
break;
|
||||
}
|
||||
if (width == indent_width)
|
||||
{
|
||||
sels.push_back({ line, BufferCoord{line, column} });
|
||||
sels.emplace_back(line, BufferCoord{line, column});
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1367,8 +1367,8 @@ void tabs_to_spaces(Context& context, NormalParams params)
|
||||
{
|
||||
ColumnCount col = get_column(buffer, opt_tabstop, it.coord());
|
||||
ColumnCount end_col = (col / tabstop + 1) * tabstop;
|
||||
tabs.push_back({ it.coord() });
|
||||
spaces.push_back(String{ ' ', end_col - col });
|
||||
tabs.emplace_back(it.coord());
|
||||
spaces.emplace_back(' ', end_col - col);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1399,9 +1399,9 @@ void spaces_to_tabs(Context& context, NormalParams params)
|
||||
++col;
|
||||
}
|
||||
if ((col % tabstop) == 0)
|
||||
spaces.push_back({spaces_beg.coord(), (spaces_end-1).coord()});
|
||||
spaces.emplace_back(spaces_beg.coord(), (spaces_end-1).coord());
|
||||
else if (spaces_end != end and *spaces_end == '\t')
|
||||
spaces.push_back({spaces_beg.coord(), spaces_end.coord()});
|
||||
spaces.emplace_back(spaces_beg.coord(), spaces_end.coord());
|
||||
it = spaces_end;
|
||||
}
|
||||
else
|
||||
|
@ -71,7 +71,7 @@ protected:
|
||||
class OptionManagerWatcher
|
||||
{
|
||||
public:
|
||||
virtual ~OptionManagerWatcher() {}
|
||||
virtual ~OptionManagerWatcher() = default;
|
||||
|
||||
virtual void on_option_changed(const Option& option) = 0;
|
||||
};
|
||||
@ -80,7 +80,7 @@ class OptionManager : private OptionManagerWatcher
|
||||
{
|
||||
public:
|
||||
OptionManager(OptionManager& parent);
|
||||
~OptionManager();
|
||||
~OptionManager() override;
|
||||
|
||||
Option& operator[] (StringView name);
|
||||
const Option& operator[] (StringView name) const;
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include "assert.hh"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
|
@ -16,7 +16,7 @@ class Context;
|
||||
class Register
|
||||
{
|
||||
public:
|
||||
virtual ~Register() {}
|
||||
virtual ~Register() = default;
|
||||
virtual Register& operator=(ConstArrayView<String> values) = 0;
|
||||
|
||||
virtual ConstArrayView<String> values(const Context& context) = 0;
|
||||
|
@ -186,7 +186,7 @@ public:
|
||||
{
|
||||
T object;
|
||||
alignas(T) char data[sizeof(T)];
|
||||
U() {}
|
||||
U() {};
|
||||
~U() { object.~T(); }
|
||||
} u;
|
||||
read(u.data, sizeof(T));
|
||||
@ -297,7 +297,7 @@ class RemoteUI : public UserInterface
|
||||
{
|
||||
public:
|
||||
RemoteUI(int socket, DisplayCoord dimensions);
|
||||
~RemoteUI();
|
||||
~RemoteUI() override;
|
||||
|
||||
void menu_show(ConstArrayView<DisplayLine> choices,
|
||||
DisplayCoord anchor, Face fg, Face bg,
|
||||
@ -654,7 +654,7 @@ private:
|
||||
auto init_cmds = m_reader.read<String>();
|
||||
auto dimensions = m_reader.read<DisplayCoord>();
|
||||
auto env_vars = m_reader.read_idmap<String, MemoryDomain::EnvVars>();
|
||||
RemoteUI* ui = new RemoteUI{sock, dimensions};
|
||||
auto* ui = new RemoteUI{sock, dimensions};
|
||||
if (auto* client = ClientManager::instance().create_client(
|
||||
std::unique_ptr<UserInterface>(ui),
|
||||
std::move(env_vars), init_cmds, {}))
|
||||
|
@ -277,9 +277,9 @@ Vector<Selection> compute_modified_ranges(Buffer& buffer, size_t timestamp)
|
||||
for (; change_it != forward_end; ++change_it)
|
||||
{
|
||||
if (change_it->type == Buffer::Change::Insert)
|
||||
ranges.push_back({ change_it->begin, change_it->end });
|
||||
ranges.emplace_back(change_it->begin, change_it->end);
|
||||
else
|
||||
ranges.push_back({ change_it->begin });
|
||||
ranges.emplace_back(change_it->begin);
|
||||
changes_tracker.update(*change_it);
|
||||
}
|
||||
}
|
||||
@ -298,9 +298,9 @@ Vector<Selection> compute_modified_ranges(Buffer& buffer, size_t timestamp)
|
||||
change.end = changes_tracker.get_new_coord(change.end);
|
||||
|
||||
if (change.type == Buffer::Change::Insert)
|
||||
ranges.push_back({ change.begin, change.end });
|
||||
ranges.emplace_back(change.begin, change.end);
|
||||
else
|
||||
ranges.push_back({ change.begin });
|
||||
ranges.emplace_back(change.begin);
|
||||
changes_tracker.update(change);
|
||||
}
|
||||
change_it = backward_end;
|
||||
|
@ -185,7 +185,7 @@ Selection select_matching(const Buffer& buffer, const Selection& selection)
|
||||
{
|
||||
Vector<Codepoint> matching_pairs = { '(', ')', '{', '}', '[', ']', '<', '>' };
|
||||
Utf8Iterator it{buffer.iterator_at(selection.cursor()), buffer};
|
||||
Vector<Codepoint>::iterator match = matching_pairs.end();
|
||||
auto match = matching_pairs.end();
|
||||
while (not is_eol(*it))
|
||||
{
|
||||
match = std::find(matching_pairs.begin(), matching_pairs.end(), *it);
|
||||
|
@ -35,7 +35,7 @@ struct StringData : UseMemoryDomain<MemoryDomain::SharedString>
|
||||
{
|
||||
const int len = (int)str.length() + (back != 0 ? 1 : 0);
|
||||
void* ptr = StringData::operator new(sizeof(StringData) + len + 1);
|
||||
StringData* res = new (ptr) StringData(0, len);
|
||||
auto* res = new (ptr) StringData(0, len);
|
||||
std::copy(str.begin(), str.end(), res->data());
|
||||
if (back != 0)
|
||||
res->data()[len-1] = back;
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
extern char **environ;
|
||||
|
||||
@ -24,7 +24,7 @@ ShellManager::ShellManager()
|
||||
{
|
||||
// Get a guaranteed to be POSIX shell binary
|
||||
{
|
||||
auto size = confstr(_CS_PATH, 0, 0);
|
||||
auto size = confstr(_CS_PATH, nullptr, 0);
|
||||
String path; path.resize(size-1, 0);
|
||||
confstr(_CS_PATH, path.data(), size);
|
||||
for (auto dir : StringView{path} | split<StringView>(':'))
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "utf8.hh"
|
||||
#include "vector.hh"
|
||||
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
#include <climits>
|
||||
|
||||
namespace Kakoune
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef unicode_hh_INCLUDED
|
||||
#define unicode_hh_INCLUDED
|
||||
|
||||
#include <wctype.h>
|
||||
#include <wchar.h>
|
||||
#include <cwctype>
|
||||
#include <cwchar>
|
||||
#include <locale>
|
||||
|
||||
#include "units.hh"
|
||||
|
@ -39,7 +39,7 @@ using OnKeyCallback = std::function<void(Key key)>;
|
||||
class UserInterface
|
||||
{
|
||||
public:
|
||||
virtual ~UserInterface() {}
|
||||
virtual ~UserInterface() = default;
|
||||
|
||||
virtual void menu_show(ConstArrayView<DisplayLine> choices,
|
||||
DisplayCoord anchor, Face fg, Face bg,
|
||||
|
@ -52,7 +52,7 @@ struct Value
|
||||
private:
|
||||
struct Concept
|
||||
{
|
||||
virtual ~Concept() {}
|
||||
virtual ~Concept() = default;
|
||||
virtual const std::type_info& type() const = 0;
|
||||
};
|
||||
|
||||
|
@ -16,7 +16,7 @@ class Window : public SafeCountable, public OptionManagerWatcher, public Scope
|
||||
{
|
||||
public:
|
||||
Window(Buffer& buffer);
|
||||
~Window();
|
||||
~Window() override;
|
||||
|
||||
const DisplayCoord& position() const { return m_position; }
|
||||
void set_position(DisplayCoord position);
|
||||
|
@ -17,7 +17,7 @@ class WordDB : public OptionManagerWatcher
|
||||
{
|
||||
public:
|
||||
WordDB(const Buffer& buffer);
|
||||
~WordDB();
|
||||
~WordDB() override;
|
||||
WordDB(const WordDB&) = delete;
|
||||
WordDB(WordDB&&);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user