Cursor Location

Is there a way to specify the location of the cursor upon:

  • evoking an action
  • opening a draft

Could the cursor always be

  • at the top of the draft?
  • load always be where I left it last?

Many thanks,

You can move a cursor in the draft editor via an action.

Opening a draft just triggers default behaviour, which for me retains the position and selection.

I so if you do nothing it should give you the second option. With an action you could locate the cursor to the zero position with a zero selection to place it at the start of the draft.

There are several functions in TADpoLe to facilitate placing a cursor and selection. This includes placing a cursor to the start of a draft.

Thank you for the action - I will add it… resolving a part of my request.

However, I am not experiencing “Opening a draft just triggers default behaviour, which for me retains the position and selection” which is why I am posting here.

I generally see returning to a Draft and the cursor sitting at the bottom of the draft. This is happening on both desktop and opening a draft through widgets, at the least.

Any way to troubleshoot this?

@sylumer Editor | ThoughtAsylum Drafts Library is not apart of the 7 TA action groups? I just updated them all… not to be found in my drafts.

What am I overlooking?

If you want an action try “TAD-Jump to Start of Draft”.

What I gave you above was code you could use in your own action scripts to do this. Include the TADpoLe file (by including the TAD action), and you have access to the function (and hundreds more).

On my iPhone, navigating between drafts shows me previous location and selection. Maybe there is an option to enable/disable this behaviour.I don’t recall, but I definitely see the behaviour on my phone.

This works -
I get it now about the code -

I’ll continue to monitor and will document for Greg.
Many thanks - as always.

< 256GB iPhone 7 Plus running iOS 13.5 on unc0ver 5.3.1 >

I, too, would very much appreciate it if Drafts would remember the cursor location and any selection in any reopened draft. (I have been spoiled by BBEdit since 1995! :wink: )

Whenever I launch Drafts, the cursor location in any subsequently opened draft seems completely random. I would greatly appreciate it if there were a way to enable a setting that would have Drafts send the cursor to the end of the draft if no previous position or selection had been made.

Is this already possible, or is a feature request necessary?

Blessings, and thank you!

Guess I need more info on this…as it has always been the behavior of Drafts to load a draft to its last selection when it’s opened from the list…and that seems to be working for me here at the moment.

The only setting that I can immediately think of that would disable this is turning off the “Edit on selection” option in “Aa” editor settings.

I have edit on selection switched to on.

I’ll monitor more closey and document the occurrences.

Ah! “There’s the rub.”

I have to load my drafts from Dropbox, as I need to stay synced with my Mac. I do understand that Drafts does not permit any syncing beyond iCloud . . .

Is there any way to code a draft such that the list can recognize/remember the cursor location and any selection? Could the list be adapted to simply recognize an address in the draft, e.g.: dbox:/Text Files/Current Notes.txt , and have a record for that draft’s last cursor location and any selection?

As a last resort, is there any way to script Drafts to move the cursor location to the last character, given some specific text in the draft?

Blessings, and thank you!

Not sure what your workflow is with your Dropbox files. Are you importing them, then exporting them back with actions? If so, your import action could certain add logic to set the cursor position for you after import. This snippet of script would put the cursor at the end of the document ready for editing:

// assuming the item is already loaded and the current draft
editor.setSelectedRange(editor.getText().length, 0);

The navigation menu also has “Top” and “Bottom” commands to move in the draft.

I continue to experience erradict cursor behavior…

Cursor is constantly ending up at the bottom of the note… but not exclusively… in fact, what set me off now is I went to a note where I left the cursor…

Noticed it yesterday switching between iOS and Mac OS - Opening a Draft on IOS had me at the bottom of the note - where I was inline just a few hours earlier.

I believe it has something to do with my navigation and cross linking. I treat my drafts like a wiki… I have cross referenced notes in all directions… I rely on a few actions to create cross links and I believe this has something to do with returning to notes where the cursor is dropped to the bottom. But, I’m not 100% certain of this.

Actions I use:

Thoughts on resolving?

1 Like

Please excuse my delay in responding!

Yes, I am importing my Dropbox files, and then exporting them back with Dr. Drang’s wonderful action script at Drafts and Dropbox redux - All this .

To import texts onto my iPhone, in the Drafts app, at the top of the screen, the second icon in from the left is a plus sign. When I press and hold on that icon, a menu pops up, and the fifth item down says “Import File…” That is how I import my text files from Dropbox. How do I edit that code? Where is it stored? Can I modify that menu? (It would be much appreciated! :wink: Is there any way to stop this forum from converting text to emjois, like the one I just entered as text?)

Can the cursor location, and any selected text range, be logged and added to the end of the text file when exporting it back to Dropbox, such that the “Import File…” action can be edited to read that final log and move the cursor to that location, selecting any logged range of text?

Blessings, and thank you!

That’s built into the app. You can’t edit the code for it. I don’t know of any way to edit the menu content.

You can edit code for actions if you have a pro subscription these are visible in the actions list within the app. They can also be added to the action bar that can be displayed at the bottom of the editor area, and you can assign keyboard shortcuts should you be using an external keyboard.

I don’t think so. The forum converts just before display, so escaping the content as Markdown doesn’t help.

Yes, you could do that… with actions. Actions are not the same as the built in functionality. They allow you to effectively build your own functionality, but you access them in a different way.

Im typing in a draft on my iPhone
I return to my Home Screen and then turn off the phone
I unlock the phone and open drafts again
My cursor is right where I left it ready for immediate typing - Perfecto, all is right with the world

Same scenario on iPad
When I open drafts up again after being on the Home Screen
The cursor is not only not where I left it
It’s no where
The note has jumped me out of edit mode and I’m just looking at my notes near, but not 100% at the bottom of the page…

Please help!

I just want it to behave exactly as it does on my iPhone!

1 Like

The iPad version intentionally resigns editor focus if the app is made inactive. I have not revisited this is a while to see if the situation has gotten any better, but historically iPadOS handles it very poorly if you do not, and you end up with all sorts of weird keyboard and display glitches, especially when working with multiple window/splits/slideovers, some that render the app unusable.