Skip to content

Add acme style window tags #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sminez opened this issue Oct 3, 2024 · 1 comment
Open

Add acme style window tags #26

sminez opened this issue Oct 3, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@sminez
Copy link
Owner

sminez commented Oct 3, 2024

Please describe the change / addition you'd like to see made

The tag in acme is a convenient scratchpad for holding text that you want to make use of in relation to a specific buffer, with execute and load events being considered running for the file the tag is attached to. It also provides a really simple way of handling things like renaming files or swapping out one file for another rather than opening a new window.

One thing I'll need to have a think about is how this interacts with ad's approach to buffer management and proposed window layout behaviour in #9. In acme every open file has a window. The user is able to hide some of those windows if desired but really the "thing" you work with in acme is a visible window, not a buffer that may or may not be visible in one of several windows currently open in the UI.

@mathuin on Mastodon suggested the possibility of having the tag be rendered using the minibuffer, making it detachable and something the user could show / hide on demand. That could be an interesting idea to explore but the implementation would need to be something other than the current mini-buffer as that has a fair amount of custom logic to it in order to grab input and act as a dynamic filter as the user types, rather than being a "real" buffer.

Is this a feature you have seen in other text editors?

This is a key part of the acme UI: http://doc.cat-v.org/plan_9/4th_edition/papers/acme/

@sminez sminez added the enhancement New feature or request label Oct 3, 2024
@sminez sminez changed the title Add acme style buffer tags Add acme style window tags Oct 27, 2024
@sminez
Copy link
Owner Author

sminez commented Apr 14, 2025

I took a stab at a rough initial implementation for this over the weekend and quickly realised that it's going to be a fair amount of work. My thinking was that it would be cleanest to store tags as actual buffers in the Buffers struct stored on Layout so that input focus "just works" but that then complicates / breaks a number of invariants around maintaining buffer state and detecting things like being in the "empty scratch" state.

An alternative would be to store a Buffer directly as part of each Window and then alter the event handling behaviour in the main editor loop to instead pass through to the active window, with the window maintaining a flag to mark whether or not it was the tag that was currently focused or the buffer. The logic for setting a focused buffer from mouse input is already handled by Layout so this might actually work better? It would also avoid scattering tag buffers in with the normal buffer state which was what was breaking a number of the existing invariants.

sminez added a commit that referenced this issue Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant