99 (println " non event" ))
1010
1111(defmethod handle-event ::type-text [{:keys [fx/event fx/context tclient]}]
12- (println (.getCaretPosition (.getTarget event)))
13- (println (.getAnchor (.getTarget event)))
14- @(s/put! tclient " text-edit" )
15- @(s/put! tclient (fx/sub-val context :caret-pos ))
16- @(s/put! tclient (fx/sub-val context :anchor-pos ))
17- @(s/put! tclient (.getCharacter event))
12+ @(s/put! tclient [" text-edit" (fx/sub-val context :file-path ) (fx/sub-val context :caret-pos ) (.getCharacter event)])
13+ (println @(s/take! tclient))
1814 {:context (fx/swap-context context
1915 assoc
2016 :anchor-pos (.getAnchor (.getSource event))
2117 :caret-pos (.getCaretPosition (.getSource event)))})
2218
2319
20+ ; similar event must be made for arrow key press
2421(defmethod handle-event ::mouse-click [{:keys [fx/event fx/context tclient]}]
2522 (println " click" )
2623 (println (.getSource event))
3128
3229(defmethod handle-event ::open-file [{:keys [fx/event fx/context tclient]}]
3330 (println " getting file" )
34- @(s/put! tclient " open-file" )
35- @(s/take! tclient))
31+ @(s/put! tclient [" open-file" (fx/sub-val context :file-path )])
32+ {:context (fx/swap-context context
33+ assoc
34+ :text-editor
35+ @(s/take! tclient))})
3636
3737(defmethod handle-event ::close-file [{:keys [fx/event fx/context tclient]}]
3838 (println " requesting close file" )
39- @(s/put! tclient " close-file" ))
39+ @(s/put! tclient [ " close-file" ( fx/sub-val context :file-path )] ))
4040
4141(defmethod handle-event ::save-file [{:keys [fx/event fx/context tclient]}]
4242 (println " saving file" )
43- @(s/put! tclient " save-file" ))
43+ @(s/put! tclient [" save-file" (fx/sub-val context :file-path )])
44+ @(s/take! tclient))
4445
4546(defmethod handle-event ::save-all [{:keys [fx/event fx/context tclient]}]
4647 (println " saving all buffers" )
47- @(s/put! tclient " save-all" ))
48+ @(s/put! tclient [" save-all" ])
49+ @(s/take! tclient))
0 commit comments