<commit_before>! Copyright (C) 2006, 2007 <NAME>.
! See http://factorcode.org/license.txt for BSD license.

USING: kernel accessors ui.gadgets ui.gestures namespaces ;

IN: ui.clipboards

! Two text transfer buffers

TUPLE: clipboard contents ;

GENERIC: clipboard-contents ( clipboard -- string )

GENERIC: set-clipboard-contents ( string clipboard -- )

M: clipboard clipboard-contents contents>> ;

M: clipboard set-clipboard-contents contents<< ;

: <clipboard> ( -- clipboard ) "" clipboard boa ;

GENERIC: paste-clipboard ( gadget clipboard -- )

M: object paste-clipboard
    clipboard-contents dup [ swap user-input ] [ 2drop ] if ;

GENERIC: copy-clipboard ( string gadget clipboard -- )

M: object copy-clipboard nip set-clipboard-contents ;

SYMBOL: clipboard
SYMBOL: selection

: gadget-copy ( gadget clipboard -- )
    over gadget-selection?
        [ [ [ gadget-selection ] keep ] dip copy-clipboard ]
        [ 2drop ]
    if ;

: gadget-copy-all ( gadget clipboard -- )
    [ [ gadget-text ] keep ] dip copy-clipboard ;

: com-copy ( gadget -- ) clipboard get gadget-copy ;

: com-copy-selection ( gadget -- ) selection get gadget-copy ;<commit_msg>Revert "ui.clipboards: adding a gadget-copy-all."<commit_after>! Copyright (C) 2006, 2007 <NAME>.
! See http://factorcode.org/license.txt for BSD license.

USING: kernel accessors ui.gadgets ui.gestures namespaces ;

IN: ui.clipboards

! Two text transfer buffers

TUPLE: clipboard contents ;

GENERIC: clipboard-contents ( clipboard -- string )

GENERIC: set-clipboard-contents ( string clipboard -- )

M: clipboard clipboard-contents contents>> ;

M: clipboard set-clipboard-contents contents<< ;

: <clipboard> ( -- clipboard ) "" clipboard boa ;

GENERIC: paste-clipboard ( gadget clipboard -- )

M: object paste-clipboard
    clipboard-contents dup [ swap user-input ] [ 2drop ] if ;

GENERIC: copy-clipboard ( string gadget clipboard -- )

M: object copy-clipboard nip set-clipboard-contents ;

SYMBOL: clipboard
SYMBOL: selection

: gadget-copy ( gadget clipboard -- )
    over gadget-selection?
        [ [ [ gadget-selection ] keep ] dip copy-clipboard ]
        [ 2drop ]
    if ;

: com-copy ( gadget -- ) clipboard get gadget-copy ;

: com-copy-selection ( gadget -- ) selection get gadget-copy ;
{'fraction_non_alphanumeric': 0.11922569291684998, 'fraction_numerical': 0.008798944126704795, 'mean_word_length': 3.4069767441860463, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '508660', 'n_tokens_mistral': 745, 'n_tokens_neox': 724, 'n_words': 199}