aboutsummaryrefslogtreecommitdiff
path: root/vis-core.h
diff options
context:
space:
mode:
authorRandy Palamar <randy@rnpnr.xyz>2025-12-17 16:29:06 -0700
committerRandy Palamar <randy@rnpnr.xyz>2026-01-06 15:38:58 -0700
commit65d0847af82ba6189817dfab4485de111e299634 (patch)
treed4e0d5a3a80a081785445d6d5e5c0adcc7ac3bc2 /vis-core.h
parent9f133c83126c77b05b18e3b3def8a9394d6b42f9 (diff)
downloadvis-65d0847af82ba6189817dfab4485de111e299634.tar.gz
vis-65d0847af82ba6189817dfab4485de111e299634.tar.xz
vis-marks: greatly simplify jumplist management
As far as I could tell from the code this was supposed to be a fixed size LRU cache of sets of selection regions. The structure had a maximum size member but it was never set or used. Furthermore there was some very complicated management of 2 parallel sets of regions. Instead of that mess just treat the cache as a circular buffer. Note that this is really not that useful at the moment. While the selection regions are saved and restored the editor mode is not. Therefore the selection is visible but not in any way usable. That will be fixed in the next commit.
Diffstat (limited to 'vis-core.h')
-rw-r--r--vis-core.h14
1 files changed, 4 insertions, 10 deletions
diff --git a/vis-core.h b/vis-core.h
index 6c54640..6e601ab 100644
--- a/vis-core.h
+++ b/vis-core.h
@@ -131,12 +131,6 @@ typedef struct {
enum SamError error; /* non-zero in case something went wrong */
} Transcript;
-typedef struct {
- Array prev;
- Array next;
- size_t max;
-} MarkList;
-
struct File { /* shared state among windows displaying the same file */
Text *text; /* data structure holding the file content */
const char *name; /* file name used when loading/saving */
@@ -161,12 +155,15 @@ struct Win {
bool expandtab; /* whether typed tabs should be converted to spaces in this window*/
Vis *vis; /* editor instance to which this window belongs */
File *file; /* file being displayed in this window */
- MarkList jumplist; /* LRU jump management */
Array saved_selections; /* register used to store selections */
Mode modes[VIS_MODE_INVALID]; /* overlay mods used for per window key bindings */
Win *parent; /* window which was active when showing the command prompt */
Mode *parent_mode; /* mode which was active when showing the command prompt */
Win *prev, *next; /* neighbouring windows */
+
+ /* Jumplist LRU */
+ size_t mark_set_lru_cursor;
+ Array mark_set_lru[32];
};
struct Vis {
@@ -283,9 +280,6 @@ VIS_INTERNAL void register_release(Register*);
VIS_INTERNAL void mark_init(Array*);
VIS_INTERNAL void mark_release(Array*);
-VIS_INTERNAL void marklist_init(MarkList*, size_t max);
-VIS_INTERNAL void marklist_release(MarkList*);
-
VIS_INTERNAL const char *register_get(Vis*, Register*, size_t *len);
VIS_INTERNAL const char *register_slot_get(Vis*, Register*, size_t slot, size_t *len);