-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Periodic autorefresh of buffer visualization #69
Comments
I will give it at shot more, soon. As far as I remember it can be difficult to get information about the dimensions of the terminal on runtime. But I will give it another try :-) |
Wouldn't it be easiest to do a periodic refresh whatever happens? Maybe add a toggle to stop it if someone finds there's an issue? |
Pressing ESC twice usually redraws everything, but it does not take into account, if the terminal has be resized. I will have to recalculate the size of each window. I think periodic refreshes will be a bit annoying since the user will experience a slight flicker when nothing is happening. But if I manage to create a good resize function, it should be possible to make a toggle on the periodic refresh. |
; Nice GPT4o solution:
; (:import [sun.misc Signal SignalHandler])
(defn handle-sigwinch [ch]
(reify SignalHandler
(handle [_ signal]
(let [[rows cols] (get-terminal-size)]
(put! ch {:rows rows :cols cols})))))
(defn redraw-editor [rows cols]
(println (str "Terminal resized to " rows " rows and " cols " columns")))
(defn main-loop []
(let [sigwinch-chan (chan)]
(Signal/handle (Signal. "WINCH") (handle-sigwinch sigwinch-chan))
(go-loop []
(let [{:keys [rows cols]} (<! sigwinch-chan)]
(redraw-editor rows cols)
(recur))))) But you can at least hook in |
Also: ; (:require [clojure.java.shell :refer [sh]]
(defn get-terminal-size []
(let [size (sh "stty" "size")]
(mapv #(Integer/parseInt %) (re-seq #"\d+" (:out size))))) |
In my window manager, i3, the shape of the terminal changes over time, and so if I return to Liquid, it's all jumbled up. Can we just have a running autorefresh, or something similar?
The text was updated successfully, but these errors were encountered: