diff --git a/src/highlighters.cc b/src/highlighters.cc index 1ef9dfaf..5708801d 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -193,12 +193,6 @@ private: ValueId m_id; }; -static bool overlaps(const BufferRange& lhs, const BufferRange& rhs) -{ - return lhs.begin < rhs.begin ? lhs.end > rhs.begin - : rhs.end > lhs.begin; -} - using FacesSpec = Vector, MemoryDomain::Highlight>; class RegexHighlighter : public Highlighter @@ -212,6 +206,11 @@ public: void highlight(const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer, BufferRange range) override { + auto overlaps = [](const BufferRange& lhs, const BufferRange& rhs) { + return lhs.begin < rhs.begin ? lhs.end > rhs.begin + : rhs.end > lhs.begin; + }; + if (flags != HighlightFlags::Highlight or not overlaps(display_buffer.range(), range)) return; diff --git a/src/shell_manager.cc b/src/shell_manager.cc index 100c2185..5aa9ab9c 100644 --- a/src/shell_manager.cc +++ b/src/shell_manager.cc @@ -29,7 +29,7 @@ namespace struct Pipe { - Pipe() { pipe(m_fd); } + Pipe() { ::pipe(m_fd); } ~Pipe() { close_read_fd(); close_write_fd(); } int read_fd() const { return m_fd[0]; } @@ -143,7 +143,7 @@ std::pair ShellManager::eval( : FDWatcher(pipe.read_fd(), [&contents, &pipe](FDWatcher& watcher, EventMode) { char buffer[1024]; - size_t size = read(pipe.read_fd(), buffer, 1024); + size_t size = ::read(pipe.read_fd(), buffer, 1024); if (size <= 0) { pipe.close_read_fd();