-
Notifications
You must be signed in to change notification settings - Fork 715
The window scope
Dan Rosén edited this page Jun 1, 2018
·
1 revision
What is the window
scope? It is actually not a window from a client, but a view of a buffer. mawww
writes this on IRC May 3 2017:
09:26 < danr> mawww: in what order are options looked for if they are defined in different scopes?
09:26 < danr> buffer, then window then global?
09:26 < mawww> window -> buffer -> global
09:26 < danr> What is the 'current' scope?
09:27 < danr> Oh, window first?
09:27 < mawww> A window is not a client
09:27 < mawww> a window is linked to a buffer, the window's buffer never changes
09:28 < danr> Oh so WinCreate means... a new view into one and the same buffer forever?
09:28 < mawww> when you switch to a buffer, Kakoune tries to find a free window on that buffer, and then displays it in a client
09:28 < danr> I thought it meant new client ;)
09:28 < mawww> yeah, window was a bad choice of name for that
09:29 < mawww> so, there is a N:1 relationship between windows and buffers
09:29 < danr> So you might get a different 'window' when switching using many clients?
09:30 < mawww> Yep, if you have two clients displaying the same buffer, then you have two windows
09:30 < mawww> a window stores a set of selections as well
09:31 < mawww> so when you switch back to a buffer, you usually get back to the selections and window position on the buffer you had
09:31 < ironzorg> that makes sense, e.g. for collaborative editing or even as a tool (different highlighters of the same data)
09:31 < danr> Ah, I see: I got two clients to change the 'window' (and their cursors) by switching around buffers
09:32 < danr> I thought the selections were bound to the client somehow
09:32 < danr> So not much is bound to the clients, I presume?
09:32 < mawww> Yep, as windows options are looked up first, you can have a window on a buffer using one filetype, and another
window on the same buffer using another filetype
09:33 < danr> oh that could potentially be handy (or confusing! :) )
09:33 < mawww> Well, in reallity the selections are bound to the client, but when a window gets hidden, we add it to a free window
list along with the selections
09:34 < mawww> and when we grab a window from the free list, we restore the associated selections
09:36 < danr> Thinking about the name, view, viewport or bufferView might be better than window
- Normal mode commands
- Avoid the escape key
- Implementing user mode (Leader key)
- Kakoune explain
- Kakoune TV