How to distinguish if there is text selected

This is going to be a weird question.

I have a macro on my computer for changing text to Title Case or back to lower case. One of the most frequent uses of this macro is when editing the beginning of a sentence and a different word must be capitalized– I have programmed the macro so that if there is no text selected it will highlight just the current word and apply Title Case to it.

That being said, Obsidian has an interesting quirk– If there is no text selected when you Copy, it will Copy the whole line. This is throwing off my macro’s ability to distinguish whether there is a selection or not, resulting in the entire line being copied, filtered with Title Case, and then re-pasted inside the un-capitalized original sentence.

So yeah, I realize it’s an odd question, but if anyone has any ideas I’d be thrilled.

To summarize, the problem is that Edit > Copy is active whether there is text selected or not, preventing my macro from distinguishing whether or not there is text selected.

Or alternately, if anyone knows how to change Obsidian’s behaviour of copying the whole line when no text is selected to the standard copying nothing if no text is selected, that would also fix this.

1 Like

I never noticed that before. I can see how it could be useful, but it certainly is a quirk!

If you are willing to learn the Obsidian API, maybe there are some answers for you. Get current text selection

(But I don’t know how.)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.