mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 02:31:45 +02:00
Scroll images with text
This commit is contained in:
@@ -620,6 +620,31 @@ grman_update_layers(GraphicsManager *self, unsigned int scrolled_by, float scree
|
|||||||
|
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
|
// Image lifetime/scrolling {{{
|
||||||
|
|
||||||
|
void
|
||||||
|
grman_scroll_images(GraphicsManager *self, int32_t amt, int32_t limit) {
|
||||||
|
Image *img; ImageRef *ref;
|
||||||
|
size_t i, j;
|
||||||
|
|
||||||
|
if (self->image_count) {
|
||||||
|
for (i = 0; i < self->image_count; i++) { img = self->images + i; for (j = 0; j < img->refcnt; j++) { ref = img->refs + j;
|
||||||
|
ref->start_row += amt;
|
||||||
|
if (ref->start_row < limit) {
|
||||||
|
// TODO: remove refs that have scrolled beyond limit
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
self->layers_dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grman_clear(GraphicsManager UNUSED *self) {
|
||||||
|
// TODO: Implement this
|
||||||
|
}
|
||||||
|
|
||||||
|
// }}}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
grman_handle_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_t *payload, Cursor *c, bool *is_dirty) {
|
grman_handle_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_t *payload, Cursor *c, bool *is_dirty) {
|
||||||
Image *image;
|
Image *image;
|
||||||
@@ -647,11 +672,6 @@ grman_handle_command(GraphicsManager *self, const GraphicsCommand *g, const uint
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
grman_clear(GraphicsManager UNUSED *self) {
|
|
||||||
// TODO: Implement this
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Boilerplate {{{
|
// Boilerplate {{{
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|||||||
@@ -79,3 +79,4 @@ GraphicsManager* grman_realloc(GraphicsManager *, index_type lines, index_type c
|
|||||||
void grman_clear(GraphicsManager*);
|
void grman_clear(GraphicsManager*);
|
||||||
const char* grman_handle_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_t *payload, Cursor *c, bool *is_dirty);
|
const char* grman_handle_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_t *payload, Cursor *c, bool *is_dirty);
|
||||||
bool grman_update_layers(GraphicsManager *self, unsigned int scrolled_by, float screen_left, float screen_top, float dx, float dy, unsigned int num_cols, unsigned int num_rows);
|
bool grman_update_layers(GraphicsManager *self, unsigned int scrolled_by, float screen_left, float screen_top, float dx, float dy, unsigned int num_cols, unsigned int num_rows);
|
||||||
|
void grman_scroll_images(GraphicsManager *self, int32_t amt, int32_t limit);
|
||||||
|
|||||||
@@ -654,6 +654,7 @@ screen_cursor_to_column(Screen *self, unsigned int column) {
|
|||||||
|
|
||||||
#define INDEX_UP \
|
#define INDEX_UP \
|
||||||
linebuf_index(self->linebuf, top, bottom); \
|
linebuf_index(self->linebuf, top, bottom); \
|
||||||
|
grman_scroll_images(self->grman, -1, self->linebuf == self->main_linebuf ? -self->historybuf->ynum : 0); \
|
||||||
if (self->linebuf == self->main_linebuf && bottom == self->lines - 1) { \
|
if (self->linebuf == self->main_linebuf && bottom == self->lines - 1) { \
|
||||||
/* Only add to history when no page margins have been set */ \
|
/* Only add to history when no page margins have been set */ \
|
||||||
linebuf_init_line(self->linebuf, bottom); \
|
linebuf_init_line(self->linebuf, bottom); \
|
||||||
|
|||||||
Reference in New Issue
Block a user