Skip to content

Commit

Permalink
minors
Browse files Browse the repository at this point in the history
  • Loading branch information
krzyzanowskim committed May 19, 2024
1 parent cdc0d3e commit 8d9779d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/STTextView/STTextView+Speech.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import AVFoundation
extension STTextView {

/// Speaks the selected text, or all text if no selection.
@objc func startSpeaking(_ sender: Any?) {
@objc open func startSpeaking(_ sender: Any?) {
stopSpeaking(sender)

let attrString: NSAttributedString
Expand All @@ -27,7 +27,7 @@ extension STTextView {
}

/// Stops the speaking of text.
@objc func stopSpeaking(_ sender: Any?) {
@objc open func stopSpeaking(_ sender: Any?) {
if speechSynthesizer.isSpeaking {
speechSynthesizer.stopSpeaking(at: .word)
}
Expand Down
8 changes: 8 additions & 0 deletions TextEdit/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ final class ViewController: NSViewController {
}
}

do {
let str = textView.string
var currentRange = str.startIndex..<str.endIndex
while let ocurrenceRange = str.range(of: "vim", range: currentRange) {
textView.addAttributes([.cursor: NSCursor.operationNotAllowed], range: NSRange(ocurrenceRange, in: str))
currentRange = ocurrenceRange.upperBound..<currentRange.upperBound
}
}
// Insert attachment image using NSTextAttachmentCell
//
// do {
Expand Down

0 comments on commit 8d9779d

Please sign in to comment.