diff options
author | dundargoc <gocdundar@gmail.com> | 2025-01-03 15:40:46 +0100 |
---|---|---|
committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2025-01-07 12:35:24 +0100 |
commit | d8bc08db7fd8d0efbf2e9ebf39fecb6f732f84e8 (patch) | |
tree | 3dd3eb1954d36db51a1eab82ea890d18cf085189 /src/vterm/rect.h | |
parent | 4d9405991963a53ed31089ed456d9f4cfebc325d (diff) | |
download | rneovim-d8bc08db7fd8d0efbf2e9ebf39fecb6f732f84e8.tar.gz rneovim-d8bc08db7fd8d0efbf2e9ebf39fecb6f732f84e8.tar.bz2 rneovim-d8bc08db7fd8d0efbf2e9ebf39fecb6f732f84e8.zip |
refactor: adopt vterm
We have changed too much to consider it a mere bundled dependency (such
as unicode handling in e3bfcf2fd4a4ebf00b104b082cfe83c8144a842d), and
can consider it our own at this point.
Diffstat (limited to 'src/vterm/rect.h')
-rw-r--r-- | src/vterm/rect.h | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/vterm/rect.h b/src/vterm/rect.h deleted file mode 100644 index 2114f24c1b..0000000000 --- a/src/vterm/rect.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Some utility functions on VTermRect structures - */ - -#define STRFrect "(%d,%d-%d,%d)" -#define ARGSrect(r) (r).start_row, (r).start_col, (r).end_row, (r).end_col - -/* Expand dst to contain src as well */ -static void rect_expand(VTermRect *dst, VTermRect *src) -{ - if(dst->start_row > src->start_row) dst->start_row = src->start_row; - if(dst->start_col > src->start_col) dst->start_col = src->start_col; - if(dst->end_row < src->end_row) dst->end_row = src->end_row; - if(dst->end_col < src->end_col) dst->end_col = src->end_col; -} - -/* Clip the dst to ensure it does not step outside of bounds */ -static void rect_clip(VTermRect *dst, VTermRect *bounds) -{ - if(dst->start_row < bounds->start_row) dst->start_row = bounds->start_row; - if(dst->start_col < bounds->start_col) dst->start_col = bounds->start_col; - if(dst->end_row > bounds->end_row) dst->end_row = bounds->end_row; - if(dst->end_col > bounds->end_col) dst->end_col = bounds->end_col; - /* Ensure it doesn't end up negatively-sized */ - if(dst->end_row < dst->start_row) dst->end_row = dst->start_row; - if(dst->end_col < dst->start_col) dst->end_col = dst->start_col; -} - -/* True if the two rectangles are equal */ -static int rect_equal(VTermRect *a, VTermRect *b) -{ - return (a->start_row == b->start_row) && - (a->start_col == b->start_col) && - (a->end_row == b->end_row) && - (a->end_col == b->end_col); -} - -/* True if small is contained entirely within big */ -static int rect_contains(VTermRect *big, VTermRect *small) -{ - if(small->start_row < big->start_row) return 0; - if(small->start_col < big->start_col) return 0; - if(small->end_row > big->end_row) return 0; - if(small->end_col > big->end_col) return 0; - return 1; -} - -/* True if the rectangles overlap at all */ -static int rect_intersects(VTermRect *a, VTermRect *b) -{ - if(a->start_row > b->end_row || b->start_row > a->end_row) - return 0; - if(a->start_col > b->end_col || b->start_col > a->end_col) - return 0; - return 1; -} |