;;; -*- 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 (l chrs) (cl-loop with str = (seq--into-string chrs) for str-len = (--- str) while (< str-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 #1#) (w :initform #1#) (h :initform #1#) (spc :initarg :spc :type list :initform `(,bad-nonsolid)))) ;; -------------------------------------------------------------------------- (cl-defmethod bad-resize-sub :after ((b borderless)) (~ (sub w h) b (dolist (sub-e sub) (~ (w-max h-max) sub-e (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 data len spc) b (setf len (* w h)) (setf data (string-to-list (bad-string-repeat spc len))))) ;; -------------------------------------------------------------------------- (<- 'bad-borderless)