---
title: "adjustSelection(by:completionHandler:)"
framework: browserenginekit
role: symbol
role_heading: Instance Method
path: "browserenginekit/betextinput/adjustselection(by:completionhandler:)"
---

# adjustSelection(by:completionHandler:)

Adjusts the selection using a range.

## Declaration

```swift
func adjustSelection(by range: BEDirectionalTextRange, completionHandler: @escaping @Sendable () -> Void)
```

```swift
func adjustSelection(by range: BEDirectionalTextRange) async
```

## Discussion

Discussion The argument value is a character count. The start of the current selection moves by range.offset characters, and the length of the selection changes by range.length characters. For example, if the current selection is a word “world” in “Hello world” and the range is { -6, -2 }, the selected text after adjustment is “Hel”.

## See Also

### Managing selection

- [selectedText](browserenginekit/betextinput/selectedtext.md)
- [selectedTextRange](browserenginekit/betextinput/selectedtextrange.md)
- [isSelectionAtDocumentStart](browserenginekit/betextinput/isselectionatdocumentstart.md)
- [selectPosition(at:completionHandler:)](browserenginekit/betextinput/selectposition(at:completionhandler:).md)
- [selectPosition(at:for:completionHandler:)](browserenginekit/betextinput/selectposition(at:for:completionhandler:).md)
- [updateCurrentSelection(to:from:in:)](browserenginekit/betextinput/updatecurrentselection(to:from:in:).md)
