diff options
| author | Albert Cervin <albert@acervin.com> | 2024-01-31 23:24:02 +0100 |
|---|---|---|
| committer | Albert Cervin <albert@acervin.com> | 2024-01-31 23:24:02 +0100 |
| commit | 4b6933a7cb5e0ef583071fffc0c97b829e72c684 (patch) | |
| tree | cb608d7d3929fd1a32010b11be751fe2b741eeee /src/dged/location.c | |
| parent | ef64c4d05794484e5affbf633f095877cc1422df (diff) | |
| download | dged-4b6933a7cb5e0ef583071fffc0c97b829e72c684.tar.gz dged-4b6933a7cb5e0ef583071fffc0c97b829e72c684.tar.xz dged-4b6933a7cb5e0ef583071fffc0c97b829e72c684.zip | |
Fix syntax predicate creation
It is now created when parsing the queries.
Also, make completion popup directly.
Diffstat (limited to 'src/dged/location.c')
| -rw-r--r-- | src/dged/location.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/src/dged/location.c b/src/dged/location.c index cac0333..0c7e973 100644 --- a/src/dged/location.c +++ b/src/dged/location.c @@ -2,25 +2,19 @@ bool location_is_between(struct location location, struct location start, struct location end) { - if (location.line >= start.line && location.line <= end.line) { - if (location.line == end.line && location.col <= end.col && - location.line == start.line && location.col >= start.col) { - // only one line - return true; - } else if (location.line == start.line && location.line != end.line && - location.col >= start.col) { - // we are on the first line - return true; - } else if (location.line == end.line && location.line != start.line && - location.col <= end.col) { - // we are on the last line - return true; - } else if (location.line != end.line && location.line != start.line) { - // we are on lines in between - return true; - } - } - return false; + return (location.line >= start.line && location.line <= end.line) && + ( + // inbetween + (location.line != end.line && location.line != start.line) || + // first line + (location.line == start.line && location.line != end.line && + location.col >= start.col) || + // last line + (location.line == end.line && location.line != start.line && + location.col <= end.col) || + // only one line + (location.line == end.line && location.col <= end.col && + location.line == start.line && location.col >= start.col)); } int location_compare(struct location l1, struct location l2) { |
