| am_cursor_position | R Documentation |
Retrieves the current position of a cursor within a text object. The position automatically adjusts as text is inserted or deleted before the cursor's original position. The cursor remembers which text object it was created for, so you only need to pass the cursor itself.
am_cursor_position(cursor)
cursor |
An |
Integer position (0-based inter-character position) where the cursor
currently points. See am_cursor() for indexing details.
doc <- am_create()
am_put(doc, AM_ROOT, "text", am_text("Hello World"))
text_obj <- am_get(doc, AM_ROOT, "text")
# Create cursor
cursor <- am_cursor(text_obj, 5)
# Get position
pos <- am_cursor_position(cursor)
pos # 5
am_close(doc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.