Commit 4816ece
Preserve `mark' across native redraws
Full and partial redraw paths both destroy markers:
- Full: `env.eraseBuffer()' snaps every marker to `point-min'.
- Partial: `env.deleteRegion' + `env.insert' per dirty row drift
markers asymmetrically by insertion-type, random-walking them
away from the user's intended position.
Point is owned by the renderer (placed at the TUI cursor on exit),
but `mark' is user state — `C-SPC' in an emacs-state buffer, any
region command in normal-state — and must survive.
Snapshot `(mark-marker)` position at the top of `redraw' and
restore it on exit via `defer'. Clamp to `point-max' in case the
buffer shrank. No change when the mark was never set in the buffer
(`marker-position' returns nil).
Other markers (e.g. evil's `evil-visual-beginning' /
`evil-visual-end') stay the caller's concern — a package can wrap
`ghostel--redraw' with its own save/restore for state the native
module cannot know about.
Adds `mark-marker' / `marker-position' / `set-marker' to the
symbol cache and thin `Env' helpers. One ERT case verifying mark
survives a full-redraw cycle.1 parent b955dbb commit 4816ece
3 files changed
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
231 | 243 | | |
232 | 244 | | |
233 | 245 | | |
| |||
291 | 303 | | |
292 | 304 | | |
293 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
294 | 309 | | |
295 | 310 | | |
296 | 311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
899 | 899 | | |
900 | 900 | | |
901 | 901 | | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
902 | 923 | | |
903 | 924 | | |
904 | 925 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
164 | 186 | | |
165 | 187 | | |
166 | 188 | | |
| |||
0 commit comments