diff --git a/kitty/tracker.c b/kitty/tracker.c index b2139f2ad..2ce006d0b 100644 --- a/kitty/tracker.c +++ b/kitty/tracker.c @@ -6,6 +6,7 @@ */ #include "data-types.h" +#include "tracker.h" #include #define RESET_STATE_VARS(self) \ @@ -60,37 +61,6 @@ reset(ChangeTracker *self) { Py_RETURN_NONE; } -static inline void tracker_cursor_changed(ChangeTracker *self) { - self->cursor_changed = true; - self->dirty = true; -} - -static inline void tracker_line_added_to_history(ChangeTracker *self) { - self->history_line_added_count++; - self->dirty = true; -} - -static inline void tracker_update_screen(ChangeTracker *self) { - self->screen_changed = true; - self->dirty = true; -} - -static inline void tracker_update_line_range(ChangeTracker *self, unsigned int first_line, unsigned int last_line) { - if (!self->screen_changed) { - for (unsigned int i = first_line; i <= MIN(self->ynum - 1, last_line); i++) self->changed_lines[i] = true; - self->dirty = true; - } -} - -static inline void tracker_update_cell_range(ChangeTracker *self, unsigned int line, unsigned int first_cell, unsigned int last_cell) { - if (!self->screen_changed && line < self->ynum && !self->changed_lines[line]) { - self->lines_with_changed_cells[line] = true; - unsigned int base = line * self->xnum; - for (unsigned int i = first_cell; i <= MIN(self->xnum - 1, last_cell); i++) self->changed_cells[base + i] = true; - self->dirty = true; - } -} - static PyObject* cursor_changed(ChangeTracker *self) { #define cursor_changed_doc "" diff --git a/kitty/tracker.h b/kitty/tracker.h new file mode 100644 index 000000000..fc15458d2 --- /dev/null +++ b/kitty/tracker.h @@ -0,0 +1,39 @@ +/* + * tracker.h + * Copyright (C) 2016 Kovid Goyal + * + * Distributed under terms of the GPL3 license. + */ + +#pragma once + +static inline void tracker_cursor_changed(ChangeTracker *self) { + self->cursor_changed = true; + self->dirty = true; +} + +static inline void tracker_line_added_to_history(ChangeTracker *self) { + self->history_line_added_count++; + self->dirty = true; +} + +static inline void tracker_update_screen(ChangeTracker *self) { + self->screen_changed = true; + self->dirty = true; +} + +static inline void tracker_update_line_range(ChangeTracker *self, unsigned int first_line, unsigned int last_line) { + if (!self->screen_changed) { + for (unsigned int i = first_line; i <= MIN(self->ynum - 1, last_line); i++) self->changed_lines[i] = true; + self->dirty = true; + } +} + +static inline void tracker_update_cell_range(ChangeTracker *self, unsigned int line, unsigned int first_cell, unsigned int last_cell) { + if (!self->screen_changed && line < self->ynum && !self->changed_lines[line]) { + self->lines_with_changed_cells[line] = true; + unsigned int base = line * self->xnum; + for (unsigned int i = first_cell; i <= MIN(self->xnum - 1, last_cell); i++) self->changed_cells[base + i] = true; + self->dirty = true; + } +}