aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-06-23 15:19:41 +0200
committerOmar Polo <op@omarpolo.com>2021-06-23 15:19:41 +0200
commit98411855465df0c75210def209a669060f239901 (patch)
treee1d296343c4ce98e50394ccf8eb2fd0fb847f197
parentebd3fc9d15ad0d629bba5910c9719d061c785127 (diff)
downloadtelescope-98411855465df0c75210def209a669060f239901.tar.gz
telescope-98411855465df0c75210def209a669060f239901.tar.bz2
add save_excursion and restore_excursion
-rw-r--r--telescope.h9
-rw-r--r--ui.c20
2 files changed, 29 insertions, 0 deletions
diff --git a/telescope.h b/telescope.h
index a9c7216..2f88e09 100644
--- a/telescope.h
+++ b/telescope.h
@@ -340,6 +340,13 @@ extern int body_lines;
extern int body_cols;
extern int in_minibuffer;
+struct excursion {
+ int curs_x, curs_y;
+ size_t line_off;
+ struct vline *current_line;
+ size_t cpoff;
+};
+
enum pairs {
PTL_BG = 1,
PTL_TAB,
@@ -411,6 +418,8 @@ struct ministate {
};
extern struct ministate ministate;
+void save_excursion(struct excursion *, struct buffer *);
+void restore_excursion(struct excursion *, struct buffer *);
void restore_cursor(struct buffer *);
void minibuffer_taint_hist(void);
void eecmd_self_insert(void);
diff --git a/ui.c b/ui.c
index 81b7a7a..dcfbb56 100644
--- a/ui.c
+++ b/ui.c
@@ -277,6 +277,26 @@ load_default_keys(void)
}
void
+save_excursion(struct excursion *place, struct buffer *buffer)
+{
+ place->curs_x = buffer->curs_x;
+ place->curs_y = buffer->curs_y;
+ place->line_off = buffer->line_off;
+ place->current_line = buffer->current_line;
+ place->cpoff = buffer->cpoff;
+}
+
+void
+restore_excursion(struct excursion *place, struct buffer *buffer)
+{
+ buffer->curs_x = place->curs_x;
+ buffer->curs_y = place->curs_y;
+ buffer->line_off = place->line_off;
+ buffer->current_line = place->current_line;
+ buffer->cpoff = place->cpoff;
+}
+
+void
restore_cursor(struct buffer *buffer)
{
struct vline *vl;