| ... | @@ -1079,7 +1079,13 @@ impl State { | ... | @@ -1079,7 +1079,13 @@ impl State { |
| 1079 | }, | 1079 | }, |
| 1080 | ); | 1080 | ); |
| 1081 | let mut open = None; | 1081 | let mut open = None; |
| 1082 | for (space, title, level) in matching(&session.pages, &self.filter) { | 1082 | let pages: Vec<_> = matching(&session.pages, &self.filter).collect(); |
| | 1083 | let is_open = |index: Option<usize>| { |
| | 1084 | index |
| | 1085 | .and_then(|index| pages.get(index)) |
| | 1086 | .is_some_and(|(space, ..)| *space == session.space) |
| | 1087 | }; |
| | 1088 | for (index, (space, title, level)) in pages.iter().enumerate() { |
| 1083 | let selected = *space == session.space; | 1089 | let selected = *space == session.space; |
| 1084 | let spec = Spec { | 1090 | let spec = Spec { |
| 1085 | flags: Flags::CLICKABLE, | 1091 | flags: Flags::CLICKABLE, |
| ... | @@ -1109,10 +1115,13 @@ impl State { | ... | @@ -1109,10 +1115,13 @@ impl State { |
| 1109 | ..Spec::default() | 1115 | ..Spec::default() |
| 1110 | }, | 1116 | }, |
| 1111 | ); | 1117 | ); |
| | 1118 | // A pill beside the open tab gives up a little on that side, widening the gap. |
| | 1119 | let [above, below] = [index.checked_sub(1), Some(index + 1)] |
| | 1120 | .map(|neighbour| if is_open(neighbour) { 2.0 } else { 0.0 }); |
| 1112 | let spec = Spec { | 1121 | let spec = Spec { |
| 1113 | flags: Flags::CLICKABLE | Flags::FLOAT, | 1122 | flags: Flags::CLICKABLE | Flags::FLOAT, |
| 1114 | size: [px(PAGE_LIST - 3.0 - 6.0), px(26.0)], | 1123 | size: [px(PAGE_LIST - 3.0 - 6.0), px(26.0 - above - below)], |
| 1115 | position: [3.0, 0.0], | 1124 | position: [3.0, above], |
| 1116 | color: Some(if title.is_empty() { | 1125 | color: Some(if title.is_empty() { |
| 1117 | ui::mix(theme.ink, section.tab, 0.5) | 1126 | ui::mix(theme.ink, section.tab, 0.5) |
| 1118 | } else { | 1127 | } else { |