MCPcopy Create free account
hub / github.com/AccessKit/accesskit / remove_selection

Method remove_selection

platforms/atspi-common/src/node.rs:1464–1487  ·  view source on GitHub ↗
(&self, selection_num: i32)

Source from the content-addressed store, hash-verified

1462 }
1463
1464 pub fn remove_selection(&self, selection_num: i32) -> Result<bool> {
1465 if selection_num != 0 {
1466 return Ok(false);
1467 }
1468
1469 self.resolve_for_text_with_context(|node, tree, context| {
1470 // Simply collapse the selection to the position of the caret if a caret is
1471 // visible, otherwise set the selection to 0.
1472 let selection_end = node
1473 .text_selection_focus()
1474 .unwrap_or_else(|| node.document_range().start());
1475 let (target_node, target_tree) =
1476 tree.state().locate_node(node.id()).ok_or(Error::Defunct)?;
1477 context.do_action(ActionRequest {
1478 action: Action::SetTextSelection,
1479 target_tree,
1480 target_node,
1481 data: Some(ActionData::SetTextSelection(
1482 selection_end.to_degenerate_range().to_text_selection(),
1483 )),
1484 });
1485 Ok(true)
1486 })
1487 }
1488
1489 pub fn set_selection(
1490 &self,

Callers

nothing calls this directly

Calls 10

text_selection_focusMethod · 0.80
startMethod · 0.80
document_rangeMethod · 0.80
locate_nodeMethod · 0.80
to_text_selectionMethod · 0.80
to_degenerate_rangeMethod · 0.80
stateMethod · 0.45
idMethod · 0.45
do_actionMethod · 0.45

Tested by

no test coverage detected