diff --git a/src/command_manager.cc b/src/command_manager.cc index 1f199fd0..2255b7c4 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -23,7 +23,7 @@ void CommandManager::register_command(String command_name, m_commands[command_name] = { std::move(command), std::move(completer) }; } -void CommandManager::register_commands(const memoryview& command_names, +void CommandManager::register_commands(memoryview command_names, Command command, CommandCompleter completer) { @@ -247,7 +247,7 @@ struct command_not_found : runtime_error : runtime_error(command + " : no such command") {} }; -void CommandManager::execute_single_command(const CommandParameters& params, +void CommandManager::execute_single_command(CommandParameters params, Context& context) const { if (params.empty()) @@ -262,7 +262,7 @@ void CommandManager::execute_single_command(const CommandParameters& params, void CommandManager::execute(const String& command_line, Context& context, - const memoryview& shell_params, + memoryview shell_params, const EnvVarMap& env_vars) { TokenList tokens = parse(command_line); @@ -368,7 +368,7 @@ Completions CommandManager::complete(const Context& context, } CandidateList PerArgumentCommandCompleter::operator()(const Context& context, - const CommandParameters& params, + CommandParameters params, size_t token_to_complete, ByteCount pos_in_token) const { diff --git a/src/command_manager.hh b/src/command_manager.hh index 2c272f03..c63633ef 100644 --- a/src/command_manager.hh +++ b/src/command_manager.hh @@ -21,10 +21,10 @@ struct parse_error : runtime_error struct Context; using CommandParameters = memoryview; -using Command = std::function; using CommandCompleter = std::function; class PerArgumentCommandCompleter @@ -34,11 +34,11 @@ public: const String&, ByteCount)>; using ArgumentCompleterList = memoryview; - PerArgumentCommandCompleter(const ArgumentCompleterList& completers) + PerArgumentCommandCompleter(ArgumentCompleterList completers) : m_completers(completers.begin(), completers.end()) {} CandidateList operator()(const Context& context, - const CommandParameters& params, + CommandParameters params, size_t token_to_complete, ByteCount pos_in_token) const; @@ -50,7 +50,7 @@ class CommandManager : public Singleton { public: void execute(const String& command_line, Context& context, - const memoryview& shell_params = {}, + memoryview shell_params = {}, const EnvVarMap& env_vars = EnvVarMap{}); Completions complete(const Context& context, @@ -62,12 +62,12 @@ public: Command command, CommandCompleter completer = CommandCompleter()); - void register_commands(const memoryview& command_names, + void register_commands(memoryview command_names, Command command, CommandCompleter completer = CommandCompleter()); private: - void execute_single_command(const CommandParameters& params, + void execute_single_command(CommandParameters params, Context& context) const; struct CommandDescriptor { diff --git a/src/commands.cc b/src/commands.cc index 82d0cbc3..0b27d278 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -86,7 +86,7 @@ Buffer* open_fifo(const String& name , const String& filename, Context& context) } template -void edit(const CommandParameters& params, Context& context) +void edit(CommandParameters params, Context& context) { ParametersParser parser(params, { { "scratch", false }, { "fifo", true } }, @@ -134,7 +134,7 @@ void edit(const CommandParameters& params, Context& context) } } -void write_buffer(const CommandParameters& params, Context& context) +void write_buffer(CommandParameters params, Context& context) { if (params.size() > 1) throw wrong_argument_count(); @@ -153,7 +153,7 @@ void write_buffer(const CommandParameters& params, Context& context) buffer.notify_saved(); } -void write_all_buffers(const CommandParameters& params, Context& context) +void write_all_buffers(CommandParameters params, Context& context) { if (params.size() != 0) throw wrong_argument_count(); @@ -169,7 +169,7 @@ void write_all_buffers(const CommandParameters& params, Context& context) } template -void quit(const CommandParameters& params, Context& context) +void quit(CommandParameters params, Context& context) { if (params.size() != 0) throw wrong_argument_count(); @@ -200,13 +200,13 @@ void quit(const CommandParameters& params, Context& context) } template -void write_and_quit(const CommandParameters& params, Context& context) +void write_and_quit(CommandParameters params, Context& context) { write_buffer(params, context); quit(CommandParameters(), context); } -void show_buffer(const CommandParameters& params, Context& context) +void show_buffer(CommandParameters params, Context& context) { if (params.size() != 1) throw wrong_argument_count(); @@ -223,7 +223,7 @@ void show_buffer(const CommandParameters& params, Context& context) } template -void delete_buffer(const CommandParameters& params, Context& context) +void delete_buffer(CommandParameters params, Context& context) { if (params.size() > 1) throw wrong_argument_count(); @@ -239,7 +239,7 @@ void delete_buffer(const CommandParameters& params, Context& context) manager.delete_buffer(buffer); } -void set_buffer_name(const CommandParameters& params, Context& context) +void set_buffer_name(CommandParameters params, Context& context) { ParametersParser parser(params, OptionMap{}, ParametersParser::Flags::None, 1, 1); @@ -258,7 +258,7 @@ Group& get_group(Group& root, const String& group_path) return group; } -void add_highlighter(const CommandParameters& params, Context& context) +void add_highlighter(CommandParameters params, Context& context) { ParametersParser parser(params, { { "group", true } }, ParametersParser::Flags::None, 1); HighlighterRegistry& registry = HighlighterRegistry::instance(); @@ -278,7 +278,7 @@ void add_highlighter(const CommandParameters& params, Context& context) group.append(factory(highlighter_params, window)); } -void rm_highlighter(const CommandParameters& params, Context& context) +void rm_highlighter(CommandParameters params, Context& context) { ParametersParser parser(params, { { "group", true } }, ParametersParser::Flags::None, 1, 1); @@ -290,7 +290,7 @@ void rm_highlighter(const CommandParameters& params, Context& context) group.remove(parser[0]); } -void add_filter(const CommandParameters& params, Context& context) +void add_filter(CommandParameters params, Context& context) { ParametersParser parser(params, { { "group", true } }, ParametersParser::Flags::None, 1); @@ -311,7 +311,7 @@ void add_filter(const CommandParameters& params, Context& context) group.append(factory(filter_params)); } -void rm_filter(const CommandParameters& params, Context& context) +void rm_filter(CommandParameters params, Context& context) { ParametersParser parser(params, { { "group", true } }, ParametersParser::Flags::None, 1, 1); @@ -334,7 +334,7 @@ static HookManager& get_hook_manager(const String& scope, Context& context) throw runtime_error("error: no such hook container " + scope); } -void add_hook(const CommandParameters& params, Context& context) +void add_hook(CommandParameters params, Context& context) { ParametersParser parser(params, { { "id", true } }, ParametersParser::Flags::None, 4, 4); // copy so that the lambda gets a copy as well @@ -349,13 +349,13 @@ void add_hook(const CommandParameters& params, Context& context) get_hook_manager(parser[0], context).add_hook(parser[1], id, hook_func); } -void rm_hooks(const CommandParameters& params, Context& context) +void rm_hooks(CommandParameters params, Context& context) { ParametersParser parser(params, {}, ParametersParser::Flags::None, 2, 2); get_hook_manager(parser[0], context).remove_hooks(parser[1]); } -EnvVarMap params_to_env_var_map(const CommandParameters& params) +EnvVarMap params_to_env_var_map(CommandParameters params) { std::unordered_map vars; char param_name[] = "param0"; @@ -367,7 +367,7 @@ EnvVarMap params_to_env_var_map(const CommandParameters& params) return vars; } -void define_command(const CommandParameters& params, Context& context) +void define_command(CommandParameters params, Context& context) { ParametersParser parser(params, { { "env-params", false }, @@ -389,20 +389,20 @@ void define_command(const CommandParameters& params, Context& context) Command cmd; if (parser.has_option("env-params")) { - cmd = [=](const CommandParameters& params, Context& context) { + cmd = [=](CommandParameters params, Context& context) { CommandManager::instance().execute(commands, context, {}, params_to_env_var_map(params)); }; } if (parser.has_option("shell-params")) { - cmd = [=](const CommandParameters& params, Context& context) { + cmd = [=](CommandParameters params, Context& context) { CommandManager::instance().execute(commands, context, params); }; } else { - cmd = [=](const CommandParameters& params, Context& context) { + cmd = [=](CommandParameters params, Context& context) { if (not params.empty()) throw wrong_argument_count(); CommandManager::instance().execute(commands, context); @@ -412,7 +412,7 @@ void define_command(const CommandParameters& params, Context& context) CommandCompleter completer; if (parser.has_option("file-completion")) { - completer = [](const Context& context, const CommandParameters& params, + completer = [](const Context& context, CommandParameters params, size_t token_to_complete, ByteCount pos_in_token) { const String& prefix = token_to_complete < params.size() ? @@ -423,7 +423,7 @@ void define_command(const CommandParameters& params, Context& context) else if (parser.has_option("shell-completion")) { String shell_cmd = parser.option_value("shell-completion"); - completer = [=](const Context& context, const CommandParameters& params, + completer = [=](const Context& context, CommandParameters params, size_t token_to_complete, ByteCount pos_in_token) { EnvVarMap vars = { @@ -437,7 +437,7 @@ void define_command(const CommandParameters& params, Context& context) CommandManager::instance().register_command(cmd_name, cmd, completer); } -void echo_message(const CommandParameters& params, Context& context) +void echo_message(CommandParameters params, Context& context) { ParametersParser parser(params, { { "color", true } }, ParametersParser::Flags::OptionsOnlyAtStart); @@ -449,7 +449,7 @@ void echo_message(const CommandParameters& params, Context& context) context.print_status({ std::move(message), color } ); } -void write_debug_message(const CommandParameters& params, Context&) +void write_debug_message(CommandParameters params, Context&) { String message; for (auto& param : params) @@ -457,7 +457,7 @@ void write_debug_message(const CommandParameters& params, Context&) write_debug(message); } -void exec_commands_in_file(const CommandParameters& params, +void exec_commands_in_file(CommandParameters params, Context& context) { if (params.size() != 1) @@ -467,7 +467,7 @@ void exec_commands_in_file(const CommandParameters& params, CommandManager::instance().execute(file_content, context); } -void set_global_option(const CommandParameters& params, Context& context) +void set_global_option(CommandParameters params, Context& context) { ParametersParser parser(params, { { "add", false } }, ParametersParser::Flags::OptionsOnlyAtStart, @@ -480,7 +480,7 @@ void set_global_option(const CommandParameters& params, Context& context) opt.set_from_string(parser[1]); } -void set_buffer_option(const CommandParameters& params, Context& context) +void set_buffer_option(CommandParameters params, Context& context) { ParametersParser parser(params, { { "buffer", true}, { "add", false } }, ParametersParser::Flags::OptionsOnlyAtStart, @@ -497,7 +497,7 @@ void set_buffer_option(const CommandParameters& params, Context& context) opt.set_from_string(parser[1]); } -void set_window_option(const CommandParameters& params, Context& context) +void set_window_option(CommandParameters params, Context& context) { ParametersParser parser(params, { { "add", false } }, ParametersParser::Flags::OptionsOnlyAtStart, @@ -510,7 +510,7 @@ void set_window_option(const CommandParameters& params, Context& context) opt.set_from_string(parser[1]); } -void declare_option(const CommandParameters& params, Context& context) +void declare_option(CommandParameters params, Context& context) { if (params.size() != 2 and params.size() != 3) throw wrong_argument_count(); @@ -538,7 +538,7 @@ void declare_option(const CommandParameters& params, Context& context) } template -void context_wrap(const CommandParameters& params, Context& context, Func func) +void context_wrap(CommandParameters params, Context& context, Func func) { ParametersParser parser(params, { { "client", true }, { "draft", false }}, ParametersParser::Flags::OptionsOnlyAtStart, 1); @@ -562,7 +562,7 @@ void context_wrap(const CommandParameters& params, Context& context, Func func) real_context.window().forget_timestamp(); } -void exec_string(const CommandParameters& params, Context& context) +void exec_string(CommandParameters params, Context& context) { context_wrap(params, context, [](const ParametersParser& parser, Context& context) { KeyList keys; @@ -575,7 +575,7 @@ void exec_string(const CommandParameters& params, Context& context) }); } -void eval_string(const CommandParameters& params, Context& context) +void eval_string(CommandParameters params, Context& context) { context_wrap(params, context, [](const ParametersParser& parser, Context& context) { String command; @@ -585,7 +585,7 @@ void eval_string(const CommandParameters& params, Context& context) }); } -void menu(const CommandParameters& params, Context& context) +void menu(CommandParameters params, Context& context) { ParametersParser parser(params, { { "auto-single", false }, { "select-cmds", false } }); @@ -694,7 +694,7 @@ static String assist(String message, CharCount maxWidth) } -void info(const CommandParameters& params, Context& context) +void info(CommandParameters params, Context& context) { ParametersParser parser(params, { { "anchor", true }, { "assist", false } }, ParametersParser::Flags::None, 0, 1); @@ -724,7 +724,7 @@ void info(const CommandParameters& params, Context& context) } } -void try_catch(const CommandParameters& params, Context& context) +void try_catch(CommandParameters params, Context& context) { if (params.size() != 3) throw wrong_argument_count(); @@ -742,7 +742,7 @@ void try_catch(const CommandParameters& params, Context& context) } } -void define_color_alias(const CommandParameters& params, Context& context) +void define_color_alias(CommandParameters params, Context& context) { ParametersParser parser(params, OptionMap{}, ParametersParser::Flags::None, 2, 2); @@ -750,7 +750,7 @@ void define_color_alias(const CommandParameters& params, Context& context) parser[0], parser[1], true); } -void set_client_name(const CommandParameters& params, Context& context) +void set_client_name(CommandParameters params, Context& context) { ParametersParser parser(params, OptionMap{}, ParametersParser::Flags::None, 1, 1); @@ -758,7 +758,7 @@ void set_client_name(const CommandParameters& params, Context& context) manager.set_client_name(manager.get_client(context), params[0]); } -void set_register(const CommandParameters& params, Context& context) +void set_register(CommandParameters params, Context& context) { if (params.size() != 2) throw wrong_argument_count(); @@ -768,7 +768,7 @@ void set_register(const CommandParameters& params, Context& context) RegisterManager::instance()[params[0][0]] = memoryview(params[1]); } -void change_working_directory(const CommandParameters& params, Context&) +void change_working_directory(CommandParameters params, Context&) { if (params.size() != 1) throw wrong_argument_count(); @@ -780,7 +780,7 @@ void change_working_directory(const CommandParameters& params, Context&) template CommandCompleter group_rm_completer(GetRootGroup get_root_group) { - return [=](const Context& context, const CommandParameters& params, + return [=](const Context& context, CommandParameters params, size_t token_to_complete, ByteCount pos_in_token) { auto& root_group = get_root_group(context); const String& arg = token_to_complete < params.size() ? @@ -796,7 +796,7 @@ CommandCompleter group_rm_completer(GetRootGroup get_root_group) template CommandCompleter group_add_completer(GetRootGroup get_root_group) { - return [=](const Context& context, const CommandParameters& params, + return [=](const Context& context, CommandParameters params, size_t token_to_complete, ByteCount pos_in_token) { auto& root_group = get_root_group(context); const String& arg = token_to_complete < params.size() ? @@ -842,7 +842,7 @@ public: void print_status(const DisplayLine&) override {} void draw(const DisplayBuffer&, const DisplayLine&) override {} - void menu_show(const memoryview&, + void menu_show(memoryview, DisplayCoord, ColorPair, ColorPair, MenuStyle) override {} void menu_select(int) override {} void menu_hide() override {} @@ -887,7 +887,7 @@ void register_commands() { CommandManager& cm = CommandManager::instance(); - cm.register_commands({"nop"}, [](const CommandParameters&, Context&){}); + cm.register_commands({"nop"}, [](CommandParameters, Context&){}); PerArgumentCommandCompleter filename_completer({ [](const Context& context, const String& prefix, ByteCount cursor_pos) diff --git a/src/editor.cc b/src/editor.cc index eed0fbe2..c03fd396 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -93,7 +93,7 @@ void Editor::insert(const String& str, InsertMode mode) check_invariant(); } -void Editor::insert(const memoryview& strings, InsertMode mode) +void Editor::insert(memoryview strings, InsertMode mode) { scoped_edition edition(*this); if (strings.empty()) @@ -542,7 +542,7 @@ void IncrementalInserter::insert(String content) } } -void IncrementalInserter::insert(const memoryview& strings) +void IncrementalInserter::insert(memoryview strings) { auto& buffer = m_editor.buffer(); for (size_t i = 0; i < m_editor.m_selections.size(); ++i) diff --git a/src/editor.hh b/src/editor.hh index bf70af70..0104d43d 100644 --- a/src/editor.hh +++ b/src/editor.hh @@ -50,7 +50,7 @@ public: void insert(const String& string, InsertMode mode = InsertMode::Insert); - void insert(const memoryview& strings, + void insert(memoryview strings, InsertMode mode = InsertMode::Insert); void move_selections(LineCount move, @@ -126,7 +126,7 @@ public: ~IncrementalInserter(); void insert(String content); - void insert(const memoryview& strings); + void insert(memoryview strings); void erase(); void move_cursors(CharCount move); void move_cursors(LineCount move); diff --git a/src/file.cc b/src/file.cc index c2cd645c..ed4a8276 100644 --- a/src/file.cc +++ b/src/file.cc @@ -184,7 +184,7 @@ Buffer* create_buffer_from_file(String filename) return buffer; } -static void write(int fd, const memoryview& data, const String& filename) +static void write(int fd, memoryview data, const String& filename) { const char* ptr = data.pointer(); ssize_t count = data.size(); @@ -228,7 +228,7 @@ void write_buffer_to_file(const Buffer& buffer, const String& filename) } } -String find_file(const String& filename, const memoryview& paths) +String find_file(const String& filename, memoryview paths) { for (auto candidate : paths) { diff --git a/src/file.hh b/src/file.hh index a8422d0d..4a93117f 100644 --- a/src/file.hh +++ b/src/file.hh @@ -31,7 +31,7 @@ String compact_path(const String& filename); String read_file(const String& filename); Buffer* create_buffer_from_file(String filename); void write_buffer_to_file(const Buffer& buffer, const String& filename); -String find_file(const String& filename, const memoryview& paths); +String find_file(const String& filename, memoryview paths); std::vector complete_filename(const String& prefix, const Regex& ignore_regex, diff --git a/src/filter.hh b/src/filter.hh index a33ea5c2..b863efeb 100644 --- a/src/filter.hh +++ b/src/filter.hh @@ -24,7 +24,7 @@ using FilterAndId = std::pair; using FilterGroup = FunctionGroup; using FilterParameters = memoryview; -using FilterFactory = std::function; +using FilterFactory = std::function; struct FilterRegistry : FunctionRegistry, Singleton diff --git a/src/filters.cc b/src/filters.cc index 02be6767..34d5d8b5 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -99,7 +99,7 @@ private: String m_replacement; }; -FilterAndId regex_filter_factory(const FilterParameters& params) +FilterAndId regex_filter_factory(FilterParameters params) { if (params.size() != 3) throw runtime_error("wrong parameter count"); @@ -114,7 +114,7 @@ class SimpleFilterFactory public: SimpleFilterFactory(const String& id) : m_id(id) {} - FilterAndId operator()(const FilterParameters& params) const + FilterAndId operator()(FilterParameters params) const { return FilterAndId(m_id, FilterFunc(filter_func)); } @@ -122,7 +122,7 @@ private: String m_id; }; -FilterAndId filter_group_factory(const FilterParameters& params) +FilterAndId filter_group_factory(FilterParameters params) { if (params.size() != 1) throw runtime_error("wrong parameter count"); diff --git a/src/highlighter.hh b/src/highlighter.hh index dba7fe11..e3561bee 100644 --- a/src/highlighter.hh +++ b/src/highlighter.hh @@ -24,7 +24,7 @@ typedef std::function HighlighterAndId; typedef memoryview HighlighterParameters; -using HighlighterFactory = std::function; using HighlighterGroup = FunctionGroup; diff --git a/src/highlighters.cc b/src/highlighters.cc index 940d4025..f0f54631 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -117,7 +117,7 @@ private: } }; -HighlighterAndId colorize_regex_factory(const HighlighterParameters params, const Window&) +HighlighterAndId colorize_regex_factory(HighlighterParameters params, const Window&) { if (params.size() < 2) throw runtime_error("wrong parameter count"); @@ -179,7 +179,7 @@ private: RegexGetter m_regex_getter; }; -HighlighterAndId highlight_search_factory(const HighlighterParameters params, const Window&) +HighlighterAndId highlight_search_factory(HighlighterParameters params, const Window&) { if (params.size() != 1) throw runtime_error("wrong parameter count"); @@ -198,7 +198,7 @@ HighlighterAndId highlight_search_factory(const HighlighterParameters params, co } } -HighlighterAndId highlight_regex_option_factory(const HighlighterParameters params, const Window& window) +HighlighterAndId highlight_regex_option_factory(HighlighterParameters params, const Window& window) { if (params.size() != 2) throw runtime_error("wrong parameter count"); @@ -446,7 +446,7 @@ private: }; std::unordered_map> FlagLines::ms_updaters; -HighlighterAndId flag_lines_factory(const HighlighterParameters& params, Window& window) +HighlighterAndId flag_lines_factory(HighlighterParameters params, Window& window) { if (params.size() != 2) throw runtime_error("wrong parameter count"); @@ -460,7 +460,7 @@ class SimpleHighlighterFactory public: SimpleHighlighterFactory(const String& id) : m_id(id) {} - HighlighterAndId operator()(const HighlighterParameters& params, const Window&) const + HighlighterAndId operator()(HighlighterParameters params, const Window&) const { return HighlighterAndId(m_id, HighlighterFunc(highlighter_func)); } @@ -468,7 +468,7 @@ private: String m_id; }; -HighlighterAndId highlighter_group_factory(const HighlighterParameters& params, const Window&) +HighlighterAndId highlighter_group_factory(HighlighterParameters params, const Window&) { if (params.size() != 1) throw runtime_error("wrong parameter count"); diff --git a/src/input_handler.cc b/src/input_handler.cc index 997c6e96..5d6f437a 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -161,7 +161,7 @@ private: class Menu : public InputMode { public: - Menu(InputHandler& input_handler, const memoryview& choices, + Menu(InputHandler& input_handler, memoryview choices, MenuCallback callback) : InputMode(input_handler), m_callback(callback), m_choices(choices.begin(), choices.end()), @@ -269,7 +269,7 @@ private: LineEditor m_filter_editor; }; -String common_prefix(const memoryview& strings) +String common_prefix(memoryview strings) { String res; if (strings.empty()) @@ -879,7 +879,7 @@ void InputHandler::set_prompt_colors(ColorPair prompt_colors) prompt->set_prompt_colors(prompt_colors); } -void InputHandler::menu(const memoryview& choices, +void InputHandler::menu(memoryview choices, MenuCallback callback) { m_mode_trash.emplace_back(std::move(m_mode)); diff --git a/src/input_handler.hh b/src/input_handler.hh index 5dccced1..ccd8426c 100644 --- a/src/input_handler.hh +++ b/src/input_handler.hh @@ -57,7 +57,7 @@ public: // abort or validation with corresponding MenuEvent value // returns to normal mode after validation if callback does // not change the mode itself - void menu(const memoryview& choices, + void menu(memoryview choices, MenuCallback callback); // execute callback on next keypress and returns to normal mode diff --git a/src/ncurses.cc b/src/ncurses.cc index 80c3dcb0..f5fcb973 100644 --- a/src/ncurses.cc +++ b/src/ncurses.cc @@ -413,7 +413,7 @@ void NCursesUI::draw_menu() redraw(); } -void NCursesUI::menu_show(const memoryview& choices, +void NCursesUI::menu_show(memoryview choices, DisplayCoord anchor, ColorPair fg, ColorPair bg, MenuStyle style) { diff --git a/src/ncurses.hh b/src/ncurses.hh index 497bbb5e..2cdcd06d 100644 --- a/src/ncurses.hh +++ b/src/ncurses.hh @@ -26,7 +26,7 @@ public: bool is_key_available() override; Key get_key() override; - void menu_show(const memoryview& choices, + void menu_show(memoryview choices, DisplayCoord anchor, ColorPair fg, ColorPair bg, MenuStyle style) override; void menu_select(int selected) override; diff --git a/src/option_types.hh b/src/option_types.hh index 9c07a6c1..7156af69 100644 --- a/src/option_types.hh +++ b/src/option_types.hh @@ -109,7 +109,7 @@ struct TupleOptionDetail tuple_separator + escape(option_to_string(std::get(opt)), tuple_separator, '\\'); } - static void from_string(const memoryview& elems, std::tuple& opt) + static void from_string(memoryview elems, std::tuple& opt) { option_from_string(elems[I], std::get(opt)); TupleOptionDetail::from_string(elems, opt); @@ -124,7 +124,7 @@ struct TupleOptionDetail<0, Types...> return option_to_string(std::get<0>(opt)); } - static void from_string(const memoryview& elems, std::tuple& opt) + static void from_string(memoryview elems, std::tuple& opt) { option_from_string(elems[0], std::get<0>(opt)); } diff --git a/src/register.hh b/src/register.hh index 96781b36..74e34365 100644 --- a/src/register.hh +++ b/src/register.hh @@ -13,7 +13,7 @@ class Register { public: virtual ~Register() {} - virtual Register& operator=(const memoryview& values) = 0; + virtual Register& operator=(memoryview values) = 0; virtual memoryview values(const Context& context) = 0; }; diff --git a/src/register_manager.cc b/src/register_manager.cc index 88f706b8..0fb17141 100644 --- a/src/register_manager.cc +++ b/src/register_manager.cc @@ -11,7 +11,7 @@ namespace Kakoune class StaticRegister : public Register { public: - Register& operator=(const memoryview& values) override + Register& operator=(memoryview values) override { m_content = std::vector(values.begin(), values.end()); return *this; @@ -40,7 +40,7 @@ public: DynamicRegister(RegisterRetriever function) : m_function(std::move(function)) {} - Register& operator=(const memoryview& values) override + Register& operator=(memoryview values) override { throw runtime_error("this register is not assignable"); } diff --git a/src/remote.cc b/src/remote.cc index 5fe996d6..3e0f8a56 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -62,7 +62,7 @@ public: }; template - void write(const memoryview& view) + void write(memoryview view) { write(view.size()); for (auto& val : view) @@ -213,7 +213,7 @@ public: void print_status(const DisplayLine& status) override; - void menu_show(const memoryview& choices, + void menu_show(memoryview choices, DisplayCoord anchor, ColorPair fg, ColorPair bg, MenuStyle style) override; void menu_select(int selected) override; @@ -258,7 +258,7 @@ void RemoteUI::print_status(const DisplayLine& status) msg.write(status); } -void RemoteUI::menu_show(const memoryview& choices, +void RemoteUI::menu_show(memoryview choices, DisplayCoord anchor, ColorPair fg, ColorPair bg, MenuStyle style) { diff --git a/src/shell_manager.cc b/src/shell_manager.cc index dcb5afd8..d293a137 100644 --- a/src/shell_manager.cc +++ b/src/shell_manager.cc @@ -17,7 +17,7 @@ ShellManager::ShellManager() } String ShellManager::eval(const String& cmdline, const Context& context, - const memoryview& params, + memoryview params, const EnvVarMap& env_vars) { return pipe("", cmdline, context, params, env_vars); @@ -25,7 +25,7 @@ String ShellManager::eval(const String& cmdline, const Context& context, String ShellManager::pipe(const String& input, const String& cmdline, const Context& context, - const memoryview& params, + memoryview params, const EnvVarMap& env_vars) { int write_pipe[2]; // child stdin diff --git a/src/shell_manager.hh b/src/shell_manager.hh index fce3e0af..6748b609 100644 --- a/src/shell_manager.hh +++ b/src/shell_manager.hh @@ -19,12 +19,12 @@ public: ShellManager(); String eval(const String& cmdline, const Context& context, - const memoryview& params, + memoryview params, const EnvVarMap& env_vars); String pipe(const String& input, const String& cmdline, const Context& context, - const memoryview& params, + memoryview params, const EnvVarMap& env_vars); void register_env_var(const String& regex, EnvVarRetriever retriever); diff --git a/src/user_interface.hh b/src/user_interface.hh index c80d72b0..2e2b6171 100644 --- a/src/user_interface.hh +++ b/src/user_interface.hh @@ -28,7 +28,7 @@ public: virtual ~UserInterface() {} virtual void print_status(const DisplayLine& status) = 0; - virtual void menu_show(const memoryview& choices, + virtual void menu_show(memoryview choices, DisplayCoord anchor, ColorPair fg, ColorPair bg, MenuStyle style) = 0; virtual void menu_select(int selected) = 0;