Skip to content

Document locations don't work when in "Visual" mode in Rmd/Qmd documents #265

Open
@daattali

Description

@daattali

If I want to insert text at the end of the currently open document, I can use

id <- rstudioapi::getSourceEditorContext()$id
rstudioapi::insertText(location = Inf, text = "test", id = id)

However, when I'm in a Rmd or Qmd file and the "Visual" mode is selected, nothing happens. No text gets added. This is especially problematic with Qmd files because Visual mode is the default.

Another way to see this issue: rstudioapi::getSourceEditorContext()$selection always returns [1, 1] -- [1, 1]: '' when in Visual mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions