소스 검색

When the selection is set to active, always notify of a change, we were missing key updates after the last code deduplication. Also, add some debugging aids

Miguel de Icaza 3 년 전
부모
커밋
a422359674
1개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 4
      Sources/SwiftTerm/SelectionService.swift

+ 7 - 4
Sources/SwiftTerm/SelectionService.swift

@@ -11,7 +11,7 @@ import Foundation
 /**
 /**
  * Tracks the selection state in the terminal
  * Tracks the selection state in the terminal
  */
  */
-class SelectionService {
+class SelectionService: CustomDebugStringConvertible {
     var terminal: Terminal
     var terminal: Terminal
     
     
     public init (terminal: Terminal)
     public init (terminal: Terminal)
@@ -36,9 +36,8 @@ class SelectionService {
         set(newValue) {
         set(newValue) {
             if _active != newValue {
             if _active != newValue {
                 _active = newValue
                 _active = newValue
-
-                terminal.tdel?.selectionChanged (source: terminal)
             }
             }
+            terminal.tdel?.selectionChanged (source: terminal)
             if active == false {
             if active == false {
                 pivot = nil
                 pivot = nil
             }
             }
@@ -371,5 +370,9 @@ class SelectionService {
     
     
     public func getSelectedText () -> String {
     public func getSelectedText () -> String {
         terminal.getText(start: self.start, end: self.end)
         terminal.getText(start: self.start, end: self.end)
-    }    
+    }
+    
+    public var debugDescription: String {
+        return "[Selection (active=\(active), start=\(start) end=\(end) hasSR=\(hasSelectionRange) pivot=\(pivot?.debugDescription ?? "nil")]"
+    }
 }
 }