File tree Expand file tree Collapse file tree 5 files changed +29
-16
lines changed
clojure/fominok/ideahelix Expand file tree Collapse file tree 5 files changed +29
-16
lines changed Original file line number Diff line number Diff line change 2323
2424(defn push-event
2525 [project focus-owner event]
26- (condp instance? focus-owner
27- EditorComponentImpl
28- (handle-editor-event project (.getEditor ^EditorComponentImpl focus-owner) event)
29- false ))
26+ (boolean
27+ (when (instance? EditorComponentImpl focus-owner)
28+ (let [editor (.getEditor ^EditorComponentImpl focus-owner)]
29+ (when-not (.isOneLineMode editor)
30+ (handle-editor-event project editor event))))))
3031
3132
3233(defn- caret-listener
5354 (ihx-apply-selection! document))))))))
5455
5556
56- (defn focus-lost
57- [project ^Editor editor]
58- (let [state (or (get @state-atom project) {:mode :normal })]
59- (quit-insert-mode project state (.getDocument editor))))
57+ #_ (defn focus-lost
58+ [project ^Editor editor]
59+ (let [state (or (get @state-atom project) {:mode :normal })]
60+ (quit-insert-mode project state (.getDocument editor))))
6061
6162
6263(defonce -server (start-server :port 7888 :handler cider-nrepl-handler))
Original file line number Diff line number Diff line change 548548 (try
549549 (if (= mode :insert )
550550 (cond
551- (= (.getKeyCode event) KeyEvent/VK_ESCAPE) (result-fn )
551+ (and (= (.getID event) KeyEvent/KEY_PRESSED)
552+ (= (.getKeyCode event) KeyEvent/VK_ESCAPE)) (result-fn )
553+ (and (not= (.getID event) KeyEvent/KEY_PRESSED)
554+ (= (.getKeyCode event) KeyEvent/VK_ESCAPE)) nil
552555 (and debounce (= (.getID event) KeyEvent/KEY_TYPED))
553556 (assoc project-state :debounce false )
554557 :else (result-fn ))
Original file line number Diff line number Diff line change 44
55(ns fominok.ideahelix.editor.ui
66 (:require
7- [clojure.string :as str])
7+ [clojure.string :as str]
8+ [fominok.ideahelix.editor.util :refer [when-let*]])
89 (:import
910 (com.intellij.openapi.editor
1011 CaretVisualAttributes
2021(defn update-mode-panel!
2122 [project editor-state]
2223 (let [id (ModePanel/ID )
23- status-bar (.. WindowManager getInstance (getStatusBar project))
24- widget (.getWidget status-bar id)
2524 mode-text (str/upper-case (name (or (:mode editor-state)
2625 :normal )))
2726 widget-text
2827 (str
2928 (when-let [prefix (:prefix editor-state)] (format " (%s) " (apply str prefix)))
3029 mode-text)]
31- (.setText widget widget-text)
32- (.updateWidget status-bar id)))
30+ (when-let* [status-bar (.. WindowManager getInstance (getStatusBar project))
31+ widget (.getWidget status-bar id)]
32+ (.setText widget widget-text)
33+ (.updateWidget status-bar id))))
3334
3435
3536(defn highlight-primary-caret
Original file line number Diff line number Diff line change 55(ns fominok.ideahelix.editor.util )
66
77
8+ (defmacro when-let*
9+ ([bindings & body]
10+ (if (seq bindings)
11+ `(when-let [~(first bindings) ~(second bindings)]
12+ (when-let* ~(drop 2 bindings) ~@body))
13+ `(do ~@body))))
14+
15+
816(defn deep-merge
917 [& maps]
1018 (reduce (fn [m1 m2]
Original file line number Diff line number Diff line change @@ -75,12 +75,12 @@ class Init : ProjectActivity {
7575 })
7676 }
7777
78- override fun focusLost (editor : Editor ) {
78+ /* override fun focusLost(editor: Editor) {
7979 super.focusLost(editor)
8080 applicationManager.invokeLater({
8181 focusLost.invoke(project, editor)
8282 })
83- }
83+ }*/
8484 }, project)
8585
8686
You can’t perform that action at this time.
0 commit comments