Skip to content

Commit 91f325c

Browse files
committed
Update readme.md with stack details
1 parent eeb6cc4 commit 91f325c

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed

readme.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,117 @@ bug)). If lower case matches, do it, if uppercase matches something,
200200
then make sure that's ok and do it but with the
201201
`resize-window-uppercase-argument` rather than
202202
`resize-window-lowercase-argument`.
203+
204+
### More about the window configurations stack ##
205+
206+
Some explanations are due about the stack. Here are some details you
207+
may find interesting and clarifying.
208+
209+
## Current window configuration ##
210+
211+
The current window configuration is what you are looking at in the
212+
screen. Think of it like a windows layout. It may be or may be not
213+
equal to the first element of the stack. The former means it is
214+
unmodified, hence it is equal to a saved configuration in the
215+
stack. The latter means that it is modified, and not saved in the
216+
stack yet. The current window configuration is modified when a window
217+
is switched, split, resized, or deleted.
218+
219+
A modified current window configuration prints the modification flag
220+
`*` to the notification area and an unmodified one prints `=`.
221+
222+
## Stack navigation: shifting elements ##
223+
224+
The stack is a spinning wheel, with no real beginning or end. The
225+
active element is the first one. Movements along the stack consist
226+
into shifting the elements. Hitting `<` (shift left) pops the last
227+
element and pushes it to the beginning of the stack, making it the
228+
first. Hitting `>` (shift right) pops the first element and pushes
229+
it to the end of the stack, making the second element the first.
230+
231+
Shifting left prints the direction flag `<` to the notification area
232+
and shifting right prints `>`.
233+
234+
## Stack update: auto shifting elements ##
235+
236+
When the current window configuration is modified, a smart system
237+
checks the elements in the stack adjacent to the first to see if they
238+
are equal to the modified configuration. The direction flag suggests
239+
the order of comparison, i.e. start from the last element when it is
240+
`<` or from the second when it is `>`, until a match is found or both
241+
elements are tested. If a match is found, the stack is shifted in the
242+
direction of the match (like you hit the corresponding key binding),
243+
the modification flag is unset, and the direction flag is set to the
244+
shifting direction.
245+
246+
## Stack update: saving a window configuration ##
247+
248+
When the smart system did not find a match, a modified configuration
249+
may be automatically saved in the stack if trying to modify it again.
250+
This also triggers the smart system to search in the stack the newly
251+
modification obtained. Please note that resizing a window is exempted
252+
from automatically saving a modified configuration.
253+
254+
Pressing `s`, `<`, or `>` will also save the modified configuration.
255+
256+
The direction flag dictates where configurations are saved. If it is
257+
`<`, save the configuration as the first element. If it is `>`, save
258+
the configuration as the second element, then shift right. This is to
259+
give you an insight on how to step back to the previous configuration.
260+
For instance, if there is only a single window and the direction flag
261+
is `>`, when you split the window and hit `<` you will be back to the
262+
single window... suppose there was more than one configuration in the
263+
stack to begin with... If the direction flag was `<`, a split and hit
264+
on `>` will still get you back to the single window, but hitting `<`
265+
instead would have shifted to the configuration expected to be found
266+
on the left of the single window.
267+
268+
```
269+
config A config C
270+
----- -----
271+
| A | |-C-| initial condition, unmodified configuration A
272+
----- -----
273+
274+
notification area: [=>] (modified flag is =, direction flag is >)
275+
276+
277+
hit 3 and split A into
278+
modified configuration
279+
(set modified flag: *)
280+
/ |
281+
/ |
282+
3 planned
283+
| insertion
284+
| / hit s to save the modified configuration or
285+
----- / ----- you may even hit < to save and step back to A
286+
| A | ----- |-C-|
287+
----- | | | ----- here (silent right shift [*>] from A on save)
288+
\ ----- /
289+
\ /
290+
saving pushes it
291+
292+
notification area: [*>] (modified flag is *, direction flag is >)
293+
294+
295+
final result
296+
----- ----- -----
297+
| | | |-C-| | A | to step back to A hit <
298+
----- ----- -----
299+
300+
notification area: [=>] (modified flag is =, direction flag is >)
301+
302+
303+
shifting left
304+
----- ----- -----
305+
| A | | | | |-C-| stepped back to A, the direction flag changed
306+
----- ----- -----
307+
308+
notification area: [<=] (modified flag is =, direction flag is <)
309+
310+
```
311+
312+
## Stack update: dropping a window configuration ##
313+
314+
When a configuration is dropped from the stack, the stack is shifted
315+
in the direction dictated by the direction flag, like pressing either
316+
`<` or `>`.

0 commit comments

Comments
 (0)