Skip to content

Keep point and scroll steady in the eca-workspaces dashboard - #328

Open
agzam wants to merge 2 commits into
editor-code-assistant:masterfrom
agzam:fix-workspaces-point-and-scroll-on-refresh
Open

agzam wants to merge 2 commits into
editor-code-assistant:masterfrom
agzam:fix-workspaces-point-and-scroll-on-refresh

Conversation

@agzam

@agzam agzam commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

TL;DR

The eca-workspaces dashboard stays where you left it while chats run. Before, the once-a-second refresh scrolled the view and could throw point to the top, which made the buffer impossible to navigate.


Problem

eca-workspaces--render erases the buffer and re-inserts every row, so it has to put the view back afterwards. It restored point by row entity and missed two things:

  • erase-buffer deletes all text, so every marker into the buffer collapses to position 1, window-start included. Nothing restored it, so after the re-insert each window started at line 1 with point further down, and redisplay recentered point. A window shorter than the content, which the bottom side window usually is, scrolled on every tick.
  • Only workspace and chat rows carry the eca-workspaces-session-id property. Point on the footer or the blank line above it had no entity, so eca-workspaces--restore-point fell back to point-min, once a second.

Both paths fire continuously while a chat streams: the 1s elapsed-time ticker and the debounced refresh on chat status changes.

Change

  • eca-workspaces--window-state also records (line-number-at-pos (window-start window)), and the render restores it with set-window-start ... t, after setting the window point. NOFORCE means redisplay ignores a start that would push point off screen, e.g. when rows above it disappeared.
  • eca-workspaces--restore-point gives way to eca-workspaces--point-state and eca-workspaces--point-position. The state is (ENTITY COLUMN LINE): a line without an entity is found again by its line number, so point on the footer survives; a row whose entity is gone still falls back to buffer start.

Testing

Two new specs: point on the footer line survives a render, and a window keeps both its start line and its point row. Both fail on master with exactly the reported symptom (window start line 1 instead of 3, point line 1 instead of 4). Full suite: 732 specs, 0 failed. checkdoc clean.

Also verified live: three consecutive eca-workspaces-refresh calls in a real window keep the window start line, the point row, and point on the footer.

The dashboard re-renders once a second while a chat runs, and the render
lost the view. `erase-buffer' collapses every marker into the buffer,
`window-start' included, so each window restarted at line 1 with point
further down and redisplay recentered it: a window shorter than the
content scrolled on every tick. Point resting on a line without a row
entity, the footer, fell back to `point-min'.

Each window now records the line it starts at and gets it back after the
render, and point on an entity-less line is found again by line number.
@agzam

agzam commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

@ericdallo CI is red here, but not from this change. The four failing jobs (ubuntu and macos on Emacs 28.1 and 28.2) pass Byte-compile, both lints and Run tests. They fail in Package, on eask install:

- [1/1] Installing package-build (20260924.1014)... Package ‘emacs-29.1’ is unavailable

MELPA published package-build today with an Emacs 29.1 requirement, so eask cannot install it on Emacs 28.

@ericdallo

Copy link
Copy Markdown
Member

I fixed, can you rebase master pls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants