STTextView icon indicating copy to clipboard operation
STTextView copied to clipboard

Function to get current caret position

Open 0xWDG opened this issue 3 years ago • 2 comments

Hi,

This commit adds a delegate function what triggers if the caret has moved.

func textView(_ textView: STTextView, didMoveCaretTo row: Int, column: Int) { }

0xWDG avatar Aug 25 '22 15:08 0xWDG

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 25 '22 15:08 CLAassistant

thank you for that!

I wonder whether the STTextView.didChangeSelectionNotification is insufficient for that purpose. It's modeled after how NSTextView works. The notification is fired for every selection change, and since the caret position is a selection, it is fired on every caret position change too.

The didChangeSelectionNotification notification is fired after change, meaning the handler can obtain the new position from the STTextView.

wdyt?

krzyzanowskim avatar Oct 08 '22 22:10 krzyzanowskim

given the explanation above, I'm unlikely to merge these changes

krzyzanowskim avatar Nov 20 '22 00:11 krzyzanowskim