Replace text in selection.
rs_replace_in_selection(
pattern,
replacement,
fixed = TRUE,
keep_selected = TRUE,
selection = c("all", "first", "last"),
context = rs_get_context()
)
rs_replace_selection(
replacement,
keep_selected = TRUE,
selection = c("all", "first", "last"),
context = rs_get_context()
)
select_correct_range(old_text, new_text, old_range, id = NULL)(character)
A pattern of text to be replaced.
(character)
The replacement text.
(logical)
If TRUE, the pattern is a fixed expression.
If FALSE, the pattern is a regular expression.
(logical)
Flag indicating if the selection should be kept after add-in is applied.
(string)
String that indicates, which selection should be extracted.
(class document_context)
Object with context of active RStudio document.
(character) Original text.
(character) Text after correction.
document_range object. See rstudioapi::document_range.
Document ID. See getActiveDocumentContext().
select_correct_range() correctly adjust current selection.