Fix traling whitespaces

This commit is contained in:
Maxime Coste 2020-05-02 13:02:10 +10:00
parent ccecd5bd8e
commit 2fca4e5643
3 changed files with 4 additions and 4 deletions

View File

@ -480,7 +480,7 @@ void do_write_buffer(Context& context, Optional<String> filename, WriteFlags fla
const bool is_readonly = (bool)(context.buffer().flags() & Buffer::Flags::ReadOnly); 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 // 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 // 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())) (not filename or real_path(*filename) == buffer.name()))
throw runtime_error("cannot overwrite the buffer when in readonly mode"); throw runtime_error("cannot overwrite the buffer when in readonly mode");

View File

@ -879,8 +879,8 @@ struct WrapHighlighter : Highlighter
auto find_split_pos = [&](SplitPos start_pos, auto is_word) -> Optional<SplitPos> { auto find_split_pos = [&](SplitPos start_pos, auto is_word) -> Optional<SplitPos> {
if (start_pos.byte == 0) if (start_pos.byte == 0)
return {}; return {};
const char* it = &content[pos.byte]; const char* it = &content[pos.byte];
// split at current position if is a word boundary // split at current position if is a word boundary
if (not is_word(utf8::codepoint(it, content.end()), {'_'})) if (not is_word(utf8::codepoint(it, content.end()), {'_'}))
return pos; return pos;
// split at last word boundary if the word is shorter than our wrapping width // split at last word boundary if the word is shorter than our wrapping width

View File

@ -151,7 +151,7 @@ void LineRangeSet::add_range(LineRange range, FunctionRef<void (LineRange)> on_n
[](LineRange range, LineCount line) { return range.end < line; }); [](LineRange range, LineCount line) { return range.end < line; });
if (it == end() or it->begin > range.end) if (it == end() or it->begin > range.end)
on_new_range(range); on_new_range(range);
else else
{ {
auto pos = range.begin; auto pos = range.begin;
while (it != end() and it->begin <= range.end) while (it != end() and it->begin <= range.end)