thread_view: Move handlers for confirmed completions to the MessageEditor (#36214)
Release Notes: - N/A --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
3c5d5a1d57
commit
1931889759
4 changed files with 455 additions and 409 deletions
|
@ -2369,6 +2369,34 @@ impl Editor {
|
|||
.is_some_and(|menu| menu.context_menu.focus_handle(cx).is_focused(window))
|
||||
}
|
||||
|
||||
pub fn is_range_selected(&mut self, range: &Range<Anchor>, cx: &mut Context<Self>) -> bool {
|
||||
if self
|
||||
.selections
|
||||
.pending
|
||||
.as_ref()
|
||||
.is_some_and(|pending_selection| {
|
||||
let snapshot = self.buffer().read(cx).snapshot(cx);
|
||||
pending_selection
|
||||
.selection
|
||||
.range()
|
||||
.includes(&range, &snapshot)
|
||||
})
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
self.selections
|
||||
.disjoint_in_range::<usize>(range.clone(), cx)
|
||||
.into_iter()
|
||||
.any(|selection| {
|
||||
// This is needed to cover a corner case, if we just check for an existing
|
||||
// selection in the fold range, having a cursor at the start of the fold
|
||||
// marks it as selected. Non-empty selections don't cause this.
|
||||
let length = selection.end - selection.start;
|
||||
length > 0
|
||||
})
|
||||
}
|
||||
|
||||
pub fn key_context(&self, window: &Window, cx: &App) -> KeyContext {
|
||||
self.key_context_internal(self.has_active_edit_prediction(), window, cx)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue