Given that a file is open in TaskPaper, how do I make it “zoomin” at a particular line?
I wasn’t able to figure it out, but got a hacky solution in by using bash to get the contents of the file at that line and using taskpaper script to focus at that content, which is inideal (multiple lines could have the same content).
here’s what i have so far:
const injectionScript = (editor, options) => {
const outline = editor.outline,
prjs = outline.evaluateItemPath('@text = "'+options.searchText.trim()+'"'),
prj = prjs.length ? prjs[0] : undefined;
if (prj) {
const itemBufferOutline = editor.itemBuffer.outline,
foundPrj = itemBufferOutline.getItemForID(prj.id);
return foundPrj ? (
editor['focusedItem'] = foundPrj,
editor.moveSelectionToItems(foundPrj, options.charPos-1),
foundPrj.bodyString
) : undefined;
}
}
intead, how do i get moveSelectionToItems
to go to a certain line? thanks!