Эх сурвалжийг харах

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 жил өмнө
parent
commit
a422359674

+ 7 - 4
Sources/SwiftTerm/SelectionService.swift

@@ -11,7 +11,7 @@ import Foundation
 /**
  * Tracks the selection state in the terminal
  */
-class SelectionService {
+class SelectionService: CustomDebugStringConvertible {
     var terminal: Terminal
     
     public init (terminal: Terminal)
@@ -36,9 +36,8 @@ class SelectionService {
         set(newValue) {
             if _active != newValue {
                 _active = newValue
-
-                terminal.tdel?.selectionChanged (source: terminal)
             }
+            terminal.tdel?.selectionChanged (source: terminal)
             if active == false {
                 pivot = nil
             }
@@ -371,5 +370,9 @@ class SelectionService {
     
     public func getSelectedText () -> String {
         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")]"
+    }
 }