diff --git a/src/command_manager.cc b/src/command_manager.cc index 562744d1..267dc44e 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -80,8 +80,8 @@ bool is_horizontal_blank(char c) struct unterminated_string : parse_error { unterminated_string(const String& open, const String& close, int nest = 0) - : parse_error{"unterminated string '" + open + "..." + close + "'" + - (nest > 0 ? "(nesting: " + int_to_str(nest) + ")" : "")} + : parse_error{"unterminated string '" + open + "..." + close + "'" + + (nest > 0 ? "(nesting: " + int_to_str(nest) + ")" : "")} {} }; diff --git a/src/commands.cc b/src/commands.cc index 98fca3a1..31773bfa 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -279,8 +279,8 @@ void add_highlighter(const CommandParameters& params, Context& context) Window& window = context.window(); HighlighterGroup& group = parser.has_option("group") ? - get_group(window.highlighters(), parser.option_value("group")) - : window.highlighters(); + get_group(window.highlighters(), parser.option_value("group")) + : window.highlighters(); auto& factory = registry[name]; group.append(factory(window, highlighter_params)); @@ -294,8 +294,8 @@ void rm_highlighter(const CommandParameters& params, Context& context) Window& window = context.window(); HighlighterGroup& group = parser.has_option("group") ? - get_group(window.highlighters(), parser.option_value("group")) - : window.highlighters(); + get_group(window.highlighters(), parser.option_value("group")) + : window.highlighters(); group.remove(parser[0]); } @@ -316,8 +316,8 @@ void add_filter(const CommandParameters& params, Context& context) Editor& editor = context.editor(); FilterGroup& group = parser.has_option("group") ? - get_group(editor.filters(), parser.option_value("group")) - : editor.filters(); + get_group(editor.filters(), parser.option_value("group")) + : editor.filters(); auto& factory = registry[name]; group.append(factory(filter_params)); @@ -331,8 +331,8 @@ void rm_filter(const CommandParameters& params, Context& context) Editor& editor = context.editor(); FilterGroup& group = parser.has_option("group") ? - get_group(editor.filters(), parser.option_value("group")) - : editor.filters(); + get_group(editor.filters(), parser.option_value("group")) + : editor.filters(); group.remove(parser[0]); } @@ -371,8 +371,8 @@ EnvVarMap params_to_env_var_map(const CommandParameters& params) char param_name[] = "param0"; for (size_t i = 0; i < params.size(); ++i) { - param_name[sizeof(param_name) - 2] = '0' + i; - vars[param_name] = params[i]; + param_name[sizeof(param_name) - 2] = '0' + i; + vars[param_name] = params[i]; } return vars; } @@ -413,9 +413,9 @@ void define_command(const CommandParameters& params, Context& context) } else { - cmd = [=](const CommandParameters& params, Context& context) { - if (not params.empty()) - throw wrong_argument_count(); + cmd = [=](const CommandParameters& params, Context& context) { + if (not params.empty()) + throw wrong_argument_count(); CommandManager::instance().execute(commands, context); }; } @@ -479,10 +479,10 @@ class RegisterRestorer { public: RegisterRestorer(char name, const Context& context) - : m_name(name) + : m_name(name) { - memoryview save = RegisterManager::instance()[name].values(context); - m_save = std::vector(save.begin(), save.end()); + memoryview save = RegisterManager::instance()[name].values(context); + m_save = std::vector(save.begin(), save.end()); } ~RegisterRestorer() @@ -497,7 +497,7 @@ class BatchUI : public UserInterface { public: BatchUI(const KeyList& keys) - : m_keys(keys), m_pos(0) {} + : m_keys(keys), m_pos(0) {} Key get_key() override { @@ -551,7 +551,6 @@ void exec_string(const CommandParameters& params, Context& context) keys.insert(keys.end(), param_keys.begin(), param_keys.end()); } - Context& keys_context = parser.has_option("client") ? ClientManager::instance().get_client_context(parser.option_value("client")) : context; diff --git a/src/completion.cc b/src/completion.cc index 8ee18aa2..2c7cea11 100644 --- a/src/completion.cc +++ b/src/completion.cc @@ -18,11 +18,11 @@ static boost::regex make_regex_ifp(const String& ex) boost::regex result; if (not ex.empty()) { - try - { - result = boost::regex(ex.c_str()); - } - catch(boost::regex_error&) {} + try + { + result = boost::regex(ex.c_str()); + } + catch(boost::regex_error&) {} } return result; } diff --git a/src/display_buffer.hh b/src/display_buffer.hh index 5a5f1558..ef00a19b 100644 --- a/src/display_buffer.hh +++ b/src/display_buffer.hh @@ -117,8 +117,8 @@ struct DisplayAtom AtomContent content; DisplayAtom(AtomContent content) - : content(std::move(content)), attribute(Normal), - fg_color(Color::Default), bg_color(Color::Default) {} + : content(std::move(content)), attribute(Normal), + fg_color(Color::Default), bg_color(Color::Default) {} }; class DisplayLine diff --git a/src/editor.cc b/src/editor.cc index 9017e90f..48b3ac1e 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -486,7 +486,7 @@ IncrementalInserter::~IncrementalInserter() { if (m_mode == InsertMode::Append and sel.last().column() > 0) sel.last() = utf8::previous(sel.last()); - sel.avoid_eol(); + sel.avoid_eol(); } m_editor.on_incremental_insertion_end(); diff --git a/src/event_manager.cc b/src/event_manager.cc index 35c111b6..7d680fd2 100644 --- a/src/event_manager.cc +++ b/src/event_manager.cc @@ -54,7 +54,7 @@ void EventManager::handle_next_events() void EventManager::force_signal(int fd) { - m_forced.push_back(fd); + m_forced.push_back(fd); } } diff --git a/src/filters.cc b/src/filters.cc index a08a19d2..267144a9 100644 --- a/src/filters.cc +++ b/src/filters.cc @@ -10,13 +10,13 @@ void preserve_indent(Buffer& buffer, Selection& selection, String& content) { if (content == "\n") { - BufferIterator line_begin = buffer.iterator_at_line_begin(selection.last() - 1); - BufferIterator first_non_white = line_begin; - while ((*first_non_white == '\t' or *first_non_white == ' ') and - not first_non_white.is_end()) - ++first_non_white; + BufferIterator line_begin = buffer.iterator_at_line_begin(selection.last() - 1); + BufferIterator first_non_white = line_begin; + while ((*first_non_white == '\t' or *first_non_white == ' ') and + not first_non_white.is_end()) + ++first_non_white; - content += buffer.string(line_begin, first_non_white); + content += buffer.string(line_begin, first_non_white); } } diff --git a/src/highlighters.cc b/src/highlighters.cc index 52f8b484..5417947f 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -175,9 +175,9 @@ public: } private: - String m_last_search; - ColorSpec m_colors; - RegexColorizer m_colorizer; + String m_last_search; + ColorSpec m_colors; + RegexColorizer m_colorizer; }; HighlighterAndId highlight_search_factory(Window& window, @@ -271,10 +271,10 @@ void highlight_selections(Window& window, DisplayBuffer& display_buffer) const BufferIterator& last = sel.last(); highlight_range(display_buffer, last, utf8::next(last), false, - [](DisplayAtom& atom) { atom.attribute |= Attributes::Reverse; atom.attribute &= ~Attributes::Underline; }); + [](DisplayAtom& atom) { atom.attribute |= Attributes::Reverse; + atom.attribute &= ~Attributes::Underline; }); } const Selection& back = window.selections().back(); - const BufferIterator& last = back.last(); highlight_range(display_buffer, back.begin(), back.end(), false, [](DisplayAtom& atom) { atom.attribute |= Attributes::Bold; }); } diff --git a/src/main.cc b/src/main.cc index 340ef6c4..7cd6155c 100644 --- a/src/main.cc +++ b/src/main.cc @@ -126,8 +126,8 @@ void do_pipe(Context& context) Editor& editor = context.editor(); std::vector strings; - for (auto& sel : const_cast(context.editor()).selections()) - strings.push_back(ShellManager::instance().pipe(String(sel.begin(), sel.end()), + for (auto& sel : context.editor().selections()) + strings.push_back(ShellManager::instance().pipe({sel.begin(), sel.end()}, cmdline, context, {}, {})); editor.insert(strings, InsertMode::Replace); }, context); @@ -637,13 +637,13 @@ void register_registers() register_manager.register_dynamic_register('.', [](const Context& context) { return context.editor().selections_content(); }); for (size_t i = 0; i < 10; ++i) { - register_manager.register_dynamic_register('0'+i, - [i](const Context& context) { - std::vector result; - for (auto& sel : context.editor().selections()) - result.emplace_back(i < sel.captures().size() ? sel.captures()[i] : ""); - return result; - }); + register_manager.register_dynamic_register('0'+i, + [i](const Context& context) { + std::vector result; + for (auto& sel : context.editor().selections()) + result.emplace_back(i < sel.captures().size() ? sel.captures()[i] : ""); + return result; + }); } } diff --git a/src/remote.cc b/src/remote.cc index 0fb9f451..eb61738f 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -309,42 +309,42 @@ void RemoteClient::process_next_message() { case RemoteUIMsg::PrintStatus: { - auto status = read(m_socket); - auto cursor_pos = read(m_socket); - m_ui->print_status(status, cursor_pos); - break; + auto status = read(m_socket); + auto cursor_pos = read(m_socket); + m_ui->print_status(status, cursor_pos); + break; } case RemoteUIMsg::MenuShow: { - auto choices = read_vector(m_socket); - auto anchor = read(m_socket); - auto style = read(m_socket); - m_ui->menu_show(choices, anchor, style); - break; + auto choices = read_vector(m_socket); + auto anchor = read(m_socket); + auto style = read(m_socket); + m_ui->menu_show(choices, anchor, style); + break; } case RemoteUIMsg::MenuSelect: - m_ui->menu_select(read(m_socket)); - break; + m_ui->menu_select(read(m_socket)); + break; case RemoteUIMsg::MenuHide: - m_ui->menu_hide(); - break; + m_ui->menu_hide(); + break; case RemoteUIMsg::InfoShow: { - auto choices = read(m_socket); - auto anchor = read(m_socket); - auto style = read(m_socket); - m_ui->info_show(choices, anchor, style); - break; + auto choices = read(m_socket); + auto anchor = read(m_socket); + auto style = read(m_socket); + m_ui->info_show(choices, anchor, style); + break; } case RemoteUIMsg::InfoHide: - m_ui->info_hide(); - break; + m_ui->info_hide(); + break; case RemoteUIMsg::Draw: { - DisplayBuffer display_buffer = read(m_socket); - String mode_line = read(m_socket); - m_ui->draw(display_buffer, mode_line); - break; + DisplayBuffer display_buffer = read(m_socket); + String mode_line = read(m_socket); + m_ui->draw(display_buffer, mode_line); + break; } } } diff --git a/src/selection.hh b/src/selection.hh index 83246a9c..294ecee1 100644 --- a/src/selection.hh +++ b/src/selection.hh @@ -50,7 +50,7 @@ struct Selection : public Range { Selection(const BufferIterator& first, const BufferIterator& last, CaptureList captures = {}) - : Range(first, last), m_captures(std::move(captures)) {} + : Range(first, last), m_captures(std::move(captures)) {} void avoid_eol(); diff --git a/src/units.hh b/src/units.hh index 74840402..8fdfcacd 100644 --- a/src/units.hh +++ b/src/units.hh @@ -9,7 +9,7 @@ class StronglyTypedInteger { public: explicit constexpr StronglyTypedInteger(ValueType value) - : m_value(value) {} + : m_value(value) {} constexpr RealType operator+(const RealType& other) const { return RealType(m_value + other.m_value); }