Small cleanups
This commit is contained in:
parent
a81dbd90a1
commit
b4df57d369
|
@ -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<std::pair<size_t, String>, 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;
|
||||
|
||||
|
|
|
@ -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<String, int> 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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user