Skip to content

Commit

Permalink
fix inline widget commands for master
Browse files Browse the repository at this point in the history
  • Loading branch information
cldwalker committed Sep 19, 2015
1 parent 368ff77 commit 4ea1000
Show file tree
Hide file tree
Showing 3 changed files with 393 additions and 389 deletions.
11 changes: 6 additions & 5 deletions src/lt/plugins/user/inline-result.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
[lt.plugins.birch.reader :as reader]
[lt.plugins.birch.eval :as eval]))


;; Caution: This will not find an inline result if it moves a different line after the eval
(defn current-inline-widget
"Finds the inline widget for the current line. If lines are selected, uses the last line
Expand All @@ -18,10 +17,10 @@
(-> ed editor/selection-bounds :to :line)
(:line (editor/->cursor ed)))]
(->> (:widgets @ed)
(some (fn [[[l t] widget]]
(when (and (= t :inline)
(= current-line (editor/lh->line ed l)))
widget))))))
(some (fn [[[line ch type_] widget]]
(when (and (= type_ :inline)
(= current-line (editor/lh->line ed line)))
widget))))))

(defn toggle-current-inline-result []
(when-let [inline (current-inline-widget)]
Expand All @@ -36,6 +35,8 @@
;; These also works for a selection. Note: you cannot bind these commands to vim/map-keys
;; because something about invoking it disables s selection

;; NOTE: These commands only work for LT master e.g. 0.8.x

(cmd/command {:command :user.toggle-current-inline-result
:desc "User: toggles current inline result"
:exec toggle-current-inline-result})
Expand Down
Loading

0 comments on commit 4ea1000

Please sign in to comment.