;;; -*- lexical-binding: t -*- ;; ;; -------------------------------------------------------------------------- (require 'cl-lib) (cl-pushnew "." load-path :test #'string=) (require 'luki-lisp) ;; -------------------------------------------------------------------------- (-> 'bad-elem) (-> 'bad-write) ;; -------------------------------------------------------------------------- (defun bad-string-repeat (chrs num-chrs) (when (& (< 0 num-chrs) (l chrs)) (cl-loop with str = (seq--into-string chrs) for len = (--- str) while (< len num-chrs) do (setq str (@f "%s%s" str str)) finally return (substring str 0 num-chrs)))) ;; -------------------------------------------------------------------------- (defclass borderless (elem) ((name :initform (@f "borderless-%d" (random 100))) (w-min :initform #1=2) (h-min :initform #2=2) (w :initform #1#) (h :initform #2#) (spc :initarg :spc :type list :initform `(,bad-nonsolid)))) ;; -------------------------------------------------------------------------- (cl-defmethod bad-resize-sub :after ((b borderless)) (~ (sub w h) b (dolist (u sub) (~ (w-max h-max) u (setf w-max w) (setf h-max h))))) ;; -------------------------------------------------------------------------- (cl-defmethod bad-size :after ((b borderless) &rest _) (bad-update b)) (cl-defmethod bad-update ((b borderless)) (~ (w h spc) b (bad-set-data b (string-to-list (bad-string-repeat spc (* w h)))))) ;; -------------------------------------------------------------------------- (<- 'bad-borderless)