File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
Sources/CodeEditSourceEditor/Controller Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import CodeEditTextView
99import AppKit
1010
1111extension TextViewController {
12- /// Handles indentation and unindentation
12+ /// Handles indentation and unindentation
1313 ///
1414 /// Handles the indentation of lines in the text view based on the current indentation option.
1515 ///
@@ -53,22 +53,17 @@ for cursorPosition in self.cursorPositions.reversed() {
5353 return false
5454 }
5555
56- private func getHighlightedLines( for range: NSRange ) -> [ Int ] ? {
56+ private func getHighlightedLines( for range: NSRange ) -> ClosedRange < Int > ? {
5757 guard let startLineInfo = textView. layoutManager. textLineForOffset ( range. lowerBound) else {
5858 return nil
5959 }
60- var lines : [ Int ] = [ startLineInfo. index]
6160
6261 guard let endLineInfo = textView. layoutManager. textLineForOffset ( range. upperBound) ,
6362 endLineInfo. index != startLineInfo. index else {
64- return lines
65- }
66- if endLineInfo. index == startLineInfo. index + 1 {
67- lines. append ( endLineInfo. index)
68- return lines
63+ return startLineInfo. index... startLineInfo. index
6964 }
7065
71- return Array ( startLineInfo. index... endLineInfo. index)
66+ return startLineInfo. index... endLineInfo. index
7267 }
7368
7469 private func adjustIndentation( lineIndex: Int , indentationChars: String , inwards: Bool ) {
You can’t perform that action at this time.
0 commit comments