@@ -206,41 +206,6 @@ extension TextView {
206206 }
207207
208208 private func dragColumnSelection( mouseDragAnchor: CGPoint , locationInView: CGPoint ) {
209- // Drag the selection and select in columns
210- let start = CGPoint (
211- x: min ( mouseDragAnchor. x, locationInView. x) ,
212- y: min ( mouseDragAnchor. y, locationInView. y)
213- )
214- let end = CGPoint (
215- x: max ( mouseDragAnchor. x, locationInView. x) ,
216- y: max ( mouseDragAnchor. y, locationInView. y)
217- )
218-
219- // Collect all overlapping text ranges
220- var selectedRanges : [ NSRange ] = layoutManager. linesStartingAt ( start. y, until: end. y) . flatMap { textLine in
221- // Collect fragment ranges
222- return textLine. data. lineFragments. compactMap { lineFragment -> NSRange ? in
223- let startOffset = self . layoutManager. textOffsetAtPoint (
224- start,
225- fragmentPosition: lineFragment,
226- linePosition: textLine
227- )
228- let endOffset = self . layoutManager. textOffsetAtPoint (
229- end,
230- fragmentPosition: lineFragment,
231- linePosition: textLine
232- )
233- guard let startOffset, let endOffset else { return nil }
234-
235- return NSRange ( start: startOffset, end: endOffset)
236- }
237- }
238-
239- // If we have some non-cursor selections, filter out any cursor selections
240- if selectedRanges. contains ( where: { !$0. isEmpty } ) {
241- selectedRanges = selectedRanges. filter ( { !$0. isEmpty } )
242- }
243-
244- selectionManager. setSelectedRanges ( selectedRanges)
209+ selectColumns ( betweenPointA: mouseDragAnchor, pointB: locationInView)
245210 }
246211}
0 commit comments