<commit_before>(in-package :lem)

(defvar *exit*)

(defgeneric exit-lem (buffer arg))
(defmethod exit-lem ((buffer buffer) arg)
  (declare (ignore arg))
  (setq *exit* t))

(defun self-insert (c arg)
  (arg-repeat (arg t)
    (buffer-insert-char *current-buffer* c arg)))

(defun execute (keys arg)
  (let ((cmd (command-find-keybind keys)))
    (cond
      (cmd
	(funcall cmd *current-buffer* arg))
      ((< 31 (car keys))
	(self-insert (code-char (car keys)) arg))
      (t
	; key not found
	))))

(defun input-keys ()
  (let ((c (cl-ncurses:getch)))
    (if (or (= c key::ctrl-x)
            (= c key::escape))
      (list c (cl-ncurses:getch))
      (let ((bytes (utf8-bytes c)))
	(if (= bytes 1)
	  (list c)
          (let ((bytes
                  (coerce<commit_msg>タブ文字を入力できるようにした<commit_after>(in-package :lem)

(defvar *exit*)

(defgeneric exit-lem (buffer arg))
(defmethod exit-lem ((buffer buffer) arg)
  (declare (ignore arg))
  (setq *exit* t))

(defun self-insert (c arg)
  (arg-repeat (arg t)
    (buffer-insert-char *current-buffer* c arg)))

(defun execute (keys arg)
  (let ((cmd (command-find-keybind keys)))
    (cond
      (cmd
	(funcall cmd *current-buffer* arg))
      ((or (< 31 (car keys))
           (= key::ctrl-i (car keys)))
	(self-insert (code-char (car keys)) arg))
      (t
	; key not found
	))))

(defun input-keys ()
  (let ((c (cl-ncurses:getch)))
    (if (or (= c key::ctrl-x)
            (= c key::escape))
      (list c (cl-ncurses:getch))
      (let ((bytes (utf8-bytes c)))
	(if (= bytes 1)
	  (list c)
          (let ((bytes
                  (coerce
{'fraction_non_alphanumeric': 0.18204645323289392, 'fraction_numerical': 0.005021971123666039, 'mean_word_length': 2.6227272727272726, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5459938', 'n_tokens_mistral': 624, 'n_tokens_neox': 601, 'n_words': 167}