<commit_before>(ns lt.objs.editor.pool
  (:require [lt.object :as object]
            [lt.objs.app :as app]
            [lt.objs.keyboard :as kb]
            [lt.objs.files :as files]
            [lt.objs.file-manager :as fileman]
            [lt.objs.canvas :as canvas]
            [lt.objs.settings :as settings]
            [lt.objs.sidebar.command :as cmd]
            [lt.objs.popup :as popup]
            [lt.objs.notifos :as notifos]
            [lt.objs.editor :as editor]
            [lt.util.cljs :refer [->dottedkw]]
            [clojure.string :as string]
            [lt.util.dom :as dom])
  (:require-macros [lt.macros :refer [defui]]))

(defn get-all []
  (object/by-tag :editor))

(object/behavior* ::theme-changed
                  :triggers #{:theme-change}
                  :reaction (fn [this theme]
                              (doseq [ed (get-all)
                                      :let [e (:ed @ed)]]
                                (editor/set-options e {:theme theme}))))

(object/behavior* ::line-numbers-changed
                  :triggers #{:line-numbers-change}
                  :reaction (fn [this numbers?]
                              (doseq [ed (get-all)
                                      :let [e (:ed @ed)]]
                                (editor/set-options e {:lineNumbers numbers?}))))

(object/behavior* ::options-changed
                  :triggers #{:options-changed}
                  :reaction (fn [this opts]
                              (doseq [ed (get-all)
                                      :let [e (:ed @ed)]]
                                (editor/set-options e opts))))

(object/object* ::pool
                :tags #{:editor.pool})

(object/tag-behaviors :editor.pool [::theme-changed ::line-numbers-changed ::options-changed])

(defn unsaved? []
  (some #(:dirty (deref %)) (object/by-tag :editor)))

(defn by-path [path]
  (when path
    (let [path (string/lower-case path)]
      (filter #(= (-> @% :info (:path "") string/lower-case) path) (object/by-tag :editor)))))
<commit_msg>fix error where a pathless file will cause no files to open<commit_after>(ns lt.objs.editor.pool
  (:require [lt.object :as object]
            [lt.objs.app :as app]
            [lt.objs.keyboard :as kb]
            [lt.objs.files :as files]
            [lt.objs.file-manager :as fileman]
            [lt.objs.canvas :as canvas]
            [lt.objs.settings :as settings]
            [lt.objs.sidebar.command :as cmd]
            [lt.objs.popup :as popup]
            [lt.objs.notifos :as notifos]
            [lt.objs.editor :as editor]
            [lt.util.cljs :refer [->dottedkw]]
            [clojure.string :as string]
            [lt.util.dom :as dom])
  (:require-macros [lt.macros :refer [defui]]))

(defn get-all []
  (object/by-tag :editor))

(object/behavior* ::theme-changed
                  :triggers #{:theme-change}
                  :reaction (fn [this theme]
                              (doseq [ed (get-all)
                                      :let [e (:ed @ed)]]
                                (editor/set-options e {:theme theme}))))

(object/behavior* ::line-numbers-changed
                  :triggers #{:line-numbers-change}
                  :reaction (fn [this numbers?]
                              (doseq [ed (get-all)
                                      :let [e (:ed @ed)]]
                                (editor/set-options e {:lineNumbers numbers?}))))

(object/behavior* ::options-changed
                  :triggers #{:options-changed}
                  :reaction (fn [this opts]
                              (doseq [ed (get-all)
                                      :let [e (:ed @ed)]]
                                (editor/set-options e opts))))

(object/object* ::pool
                :tags #{:editor.pool})

(object/tag-behaviors :editor.pool [::theme-changed ::line-numbers-changed ::options-changed])

(defn unsaved? []
  (some #(:dirty (deref %)) (object/by-tag :editor)))

(defn by-path [path]
  (when path
    (let [path (string/lower-case path)]
      (filter #(= (-> @% :info (get :path "") string/lower-case) path) (object/by-tag :editor)))))

{'fraction_non_alphanumeric': 0.15021665864227252, 'fraction_numerical': 0.0, 'mean_word_length': 1.477638640429338, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7193763', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1248, 'n_words': 294}