@@ -1573,13 +1573,16 @@ impl Editor {
1573
1573
}
1574
1574
}
1575
1575
1576
- if let Some(extension) = self
1577
- .buffer
1578
- .read(cx)
1579
- .as_singleton()
1580
- .and_then(|buffer| buffer.read(cx).file()?.path().extension()?.to_str())
1581
- {
1582
- key_context.set("extension", extension.to_string());
1576
+ if let Some(singleton_buffer) = self.buffer.read(cx).as_singleton() {
1577
+ if let Some(extension) = singleton_buffer
1578
+ .read(cx)
1579
+ .file()
1580
+ .and_then(|file| file.path().extension()?.to_str())
1581
+ {
1582
+ key_context.set("extension", extension.to_string());
1583
+ }
1584
+ } else {
1585
+ key_context.add("multibuffer");
1583
1586
}
1584
1587
1585
1588
if has_active_edit_prediction {
@@ -9845,6 +9848,31 @@ impl Editor {
9845
9848
})
9846
9849
}
9847
9850
9851
+ pub fn move_to_start_of_next_excerpt(
9852
+ &mut self,
9853
+ _: &MoveToStartOfNextExcerpt,
9854
+ window: &mut Window,
9855
+ cx: &mut Context<Self>,
9856
+ ) {
9857
+ if matches!(self.mode, EditorMode::SingleLine { .. }) {
9858
+ cx.propagate();
9859
+ return;
9860
+ }
9861
+
9862
+ self.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
9863
+ s.move_with(|map, selection| {
9864
+ selection.collapse_to(
9865
+ movement::start_of_excerpt(
9866
+ map,
9867
+ selection.head(),
9868
+ workspace::searchable::Direction::Next,
9869
+ ),
9870
+ SelectionGoal::None,
9871
+ )
9872
+ });
9873
+ })
9874
+ }
9875
+
9848
9876
pub fn move_to_end_of_excerpt(
9849
9877
&mut self,
9850
9878
_: &MoveToEndOfExcerpt,
@@ -9870,6 +9898,31 @@ impl Editor {
9870
9898
})
9871
9899
}
9872
9900
9901
+ pub fn move_to_end_of_previous_excerpt(
9902
+ &mut self,
9903
+ _: &MoveToEndOfPreviousExcerpt,
9904
+ window: &mut Window,
9905
+ cx: &mut Context<Self>,
9906
+ ) {
9907
+ if matches!(self.mode, EditorMode::SingleLine { .. }) {
9908
+ cx.propagate();
9909
+ return;
9910
+ }
9911
+
9912
+ self.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
9913
+ s.move_with(|map, selection| {
9914
+ selection.collapse_to(
9915
+ movement::end_of_excerpt(
9916
+ map,
9917
+ selection.head(),
9918
+ workspace::searchable::Direction::Prev,
9919
+ ),
9920
+ SelectionGoal::None,
9921
+ )
9922
+ });
9923
+ })
9924
+ }
9925
+
9873
9926
pub fn select_to_start_of_excerpt(
9874
9927
&mut self,
9875
9928
_: &SelectToStartOfExcerpt,
@@ -9891,6 +9944,27 @@ impl Editor {
9891
9944
})
9892
9945
}
9893
9946
9947
+ pub fn select_to_start_of_next_excerpt(
9948
+ &mut self,
9949
+ _: &SelectToStartOfNextExcerpt,
9950
+ window: &mut Window,
9951
+ cx: &mut Context<Self>,
9952
+ ) {
9953
+ if matches!(self.mode, EditorMode::SingleLine { .. }) {
9954
+ cx.propagate();
9955
+ return;
9956
+ }
9957
+
9958
+ self.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
9959
+ s.move_heads_with(|map, head, _| {
9960
+ (
9961
+ movement::start_of_excerpt(map, head, workspace::searchable::Direction::Next),
9962
+ SelectionGoal::None,
9963
+ )
9964
+ });
9965
+ })
9966
+ }
9967
+
9894
9968
pub fn select_to_end_of_excerpt(
9895
9969
&mut self,
9896
9970
_: &SelectToEndOfExcerpt,
@@ -9912,6 +9986,27 @@ impl Editor {
9912
9986
})
9913
9987
}
9914
9988
9989
+ pub fn select_to_end_of_previous_excerpt(
9990
+ &mut self,
9991
+ _: &SelectToEndOfPreviousExcerpt,
9992
+ window: &mut Window,
9993
+ cx: &mut Context<Self>,
9994
+ ) {
9995
+ if matches!(self.mode, EditorMode::SingleLine { .. }) {
9996
+ cx.propagate();
9997
+ return;
9998
+ }
9999
+
10000
+ self.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
10001
+ s.move_heads_with(|map, head, _| {
10002
+ (
10003
+ movement::end_of_excerpt(map, head, workspace::searchable::Direction::Prev),
10004
+ SelectionGoal::None,
10005
+ )
10006
+ });
10007
+ })
10008
+ }
10009
+
9915
10010
pub fn move_to_beginning(
9916
10011
&mut self,
9917
10012
_: &MoveToBeginning,
0 commit comments