diff --git a/scheme/nuit-packages.scm b/scheme/nuit-packages.scm index 94dc1a3..defc4db 100644 --- a/scheme/nuit-packages.scm +++ b/scheme/nuit-packages.scm @@ -162,6 +162,7 @@ utils select-list select-line + select-element tty-debug) (files process)) @@ -181,6 +182,7 @@ utils layout select-list + select-element (subset focus-table (make-focus-object-reference)) tty-debug) (files user-group-info)) @@ -197,6 +199,7 @@ ncurses select-list + select-element completion-sets run-jobs plugin @@ -221,6 +224,7 @@ utils fs-object select-list + select-element plugin ncurses tty-debug) @@ -321,12 +325,6 @@ (export make-select-list select-list? - make-unmarked-element - make-marked-element - make-unmarked-text-element - make-marked-text-element - element? - select-list-handle-key-press unmark-current-line mark-current-line @@ -349,6 +347,7 @@ define-record-types signals + select-element (subset focus-table (make-focus-object-reference)) tty-debug utils @@ -368,11 +367,29 @@ define-record-types signals + select-element layout tty-debug ncurses) (files select-line)) +(define-interface select-element-interface + (export + make-element + make-unmarked-element + make-marked-element + make-unmarked-text-element + make-marked-text-element + element? element-markable? element-marked? + element-value element-painter)) + +(define-structure select-element select-element-interface + (open scheme + define-record-types + + ncurses) + (files select-element)) + ;;; joblist viewer (define-structure joblist-viewer @@ -389,6 +406,7 @@ ncurses focus-table select-list + select-element tty-debug plugin layout) @@ -418,6 +436,7 @@ layout utils select-list + select-element tty-debug plugin) (files inspector)) @@ -890,6 +909,7 @@ completion-sets completer select-list + select-element jobs run-jobs run-jobs-internals diff --git a/scheme/select-list.scm b/scheme/select-list.scm index 410e0c5..914b5f2 100644 --- a/scheme/select-list.scm +++ b/scheme/select-list.scm @@ -1,27 +1,3 @@ -(define-record-type element :element - (make-element markable? marked? value painter) - element? - (markable? element-markable?) - (marked? element-marked?) - (value element-value) - (painter element-painter)) - -(define-record-discloser :element - (lambda (r) - `(element ,(element-marked? r) ,(element-value r)))) - -(define (make-unmarked-element value markable? painter) - (make-element markable? #f value painter)) - -(define (make-marked-element value markable? painter) - (make-element markable? #t value painter)) - -(define (make-unmarked-text-element value markable? text) - (make-unmarked-element value markable? (make-text-painter text))) - -(define (make-marked-text-element value markable? text) - (make-marked-element value markable? (make-text-painter text))) - (define-record-type select-list :select-list (really-make-select-list elements view-index cursor-index num-lines) select-list? @@ -149,16 +125,6 @@ (select-list-view-index select-list)) (+ 1 num-lines))) -(define (make-text-painter text) - (lambda (win x y at-cursor? marked?) - (if at-cursor? - (wattron win (A-REVERSE))) - (if marked? - (wattron win (A-BOLD))) - (mvwaddstr win y x text) - (if (or at-cursor? marked?) - (wattrset win (A-NORMAL))))) - (define (paint-selection-list select-list win result-buffer have-focus?) (paint-selection-list-at select-list 0 0 win result-buffer have-focus?))