1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! Ways to organize opened [`Buffer`]s
//!
//! By default, when calling `:e some_buffer<Enter>`, Duat will follow
//! [`MasterOnLeft`], a type of [`Layout`] for opening `Buffer`s.
//! That is, the first opened `Buffer` will be on the left of the
//! screeng, and all subsequent `Buffer`s will be stacked vertically
//! on the right of the screen.
//!
//! You can create your own [`Layout`] fairly trivially, for example,
//! here's a spiraled layout:
//!
//! ```rust
//! # duat_core::doc_duat!(duat);
//! use duat::prelude::*;
//! use ui::{PushSpecs, Side, Window, layout::Layout};
//!
//! pub struct Spiraled;
//!
//! impl Layout for Spiraled {
//! fn new_buffer(&mut self, pa: &Pass, windows: &[Window]) -> (Handle, PushSpecs) {
//! let cur_win = context::current_win_index(pa);
//! let buffers = windows[cur_win].buffers(pa);
//! let last = buffers.iter().last().unwrap().clone();
//!
//! match buffers.len() % 4 {
//! 0 => (last, PushSpecs { side: Side::Right, ..Default::default() }),
//! 1 => (last, PushSpecs { side: Side::Below, ..Default::default() }),
//! 2 => (last, PushSpecs { side: Side::Left, ..Default::default() }),
//! 3 => (last, PushSpecs { side: Side::Above, ..Default::default() }),
//! _ => unreachable!("That's not how math works, man!"),
//! }
//! }
//! }
//! ```
//!
//! Also notice that this function can fail, which means you can set a
//! limit to how many [`Buffer`]s should can open in a single window.
//!
//! [`Buffer`]: crate::buffer::Buffer
use PushSpecs;
use crate::;
/// A form of organizing opened [`Buffer`]s
///
/// Determines how the n'th `Buffer` should be opened, given the
/// previously opened `Buffer`s on the same window.
///
/// [`Buffer`]: crate::buffer::Buffer
/// [`Layout`]: One [`Buffer`] on the left, others on the right
///
/// One `Buffer` will occupy the whole left side of the screen, and
/// future buffers will be vertically stacked on the right
///
/// [`Buffer`]: crate::buffer::Buffer
;