diff --git a/src/commands.cc b/src/commands.cc index 30113af2..accb3e37 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -480,7 +480,7 @@ void do_write_buffer(Context& context, Optional filename, WriteFlags fla const bool is_readonly = (bool)(context.buffer().flags() & Buffer::Flags::ReadOnly); // if the buffer is in read-only mode and we try to save it directly // or we try to write to it indirectly using e.g. a symlink, throw an error - if (is_file and is_readonly and + if (is_file and is_readonly and (not filename or real_path(*filename) == buffer.name())) throw runtime_error("cannot overwrite the buffer when in readonly mode"); diff --git a/src/highlighters.cc b/src/highlighters.cc index 298e6b33..ecc84481 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -879,8 +879,8 @@ struct WrapHighlighter : Highlighter auto find_split_pos = [&](SplitPos start_pos, auto is_word) -> Optional { if (start_pos.byte == 0) return {}; - const char* it = &content[pos.byte]; - // split at current position if is a word boundary + const char* it = &content[pos.byte]; + // split at current position if is a word boundary if (not is_word(utf8::codepoint(it, content.end()), {'_'})) return pos; // split at last word boundary if the word is shorter than our wrapping width diff --git a/src/line_modification.cc b/src/line_modification.cc index 01ad22bf..47e11e64 100644 --- a/src/line_modification.cc +++ b/src/line_modification.cc @@ -151,7 +151,7 @@ void LineRangeSet::add_range(LineRange range, FunctionRef on_n [](LineRange range, LineCount line) { return range.end < line; }); if (it == end() or it->begin > range.end) on_new_range(range); - else + else { auto pos = range.begin; while (it != end() and it->begin <= range.end)