 M: char-completion completion-banner drop "Unicode code point names:" ;
 M: history-completion completion-banner drop "Input history:" ;
 
+GENERIC: completion-popup-width ( interactor completion-mode -- x )
+
+M: object completion-popup-width 2drop 300 ;
+M: history-completion completion-popup-width drop dim>> first ;
+
 ! Completion modes also implement the row renderer protocol
 M: listener-completion row-columns drop present 1array ;
 

        t >>selection-required?
        dup '[ _ accept-completion ] >>action ;

: <completion-scroller> ( object -- object )
    <limited-scroller>
        { 300 120 } >>min-dim
        { 300 120 } >>max-dim ;

: <completion-popup> ( interactor completion-mode -- popup )
    [ vertical completion-popup new-track ] 2dip
    [ [ >>interactor ] [ >>completion-mode ] bi* ] [ <completion-table> >>table ] 2bi
    dup [ table>> <completion-scroller> ] [ completion-mode>> completion-banner ] bi
    <labelled-gadget> 1 track-add
    COLOR: white <solid> >>interior ;


GENERIC# accept-completion-hook 1 ( item popup -- )

: insert-completion ( item popup -- )
    [ completion-string ] [ completion-loc/doc/elt ] bi* set-elt-string ;

: accept-completion ( item table -- )
    find-completion-popup
