<commit_before># frozen_string_literal: true

module Clipboard
  @implementation = nil
end

require "clipboard"

module Textbringer
  module Commands
    CLIPBOARD_AVAILABLE =
      Clipboard.implementation.name != "Clipboard::Linux" ||
      (ENV["DISPLAY"] && system("which xclip > /dev/null 2>&1"))

    if CLIPBOARD_AVAILABLE
      GLOBAL_MAP.define_key("\ew", :clipboard_copy_region)<commit_msg>Add Fiddle::Pointer#put_bytes and get_bytes for compability with ffi.<commit_after># frozen_string_literal: true

module Clipboard
  @implementation = nil
end

require "clipboard"

class Fiddle::Pointer
  def put_bytes(offset, str, index = 0, length = nil)
    len = length || str.bytesize - index
    self[offset, len] = str[index, len]
  end

  def get_bytes(offset, len)
    self[offset, len]
  end
end

module Textbringer
  module Commands
    CLIPBOARD_AVAILABLE =
      Clipboard.implementation.name != "Clipboard::Linux" ||
      (ENV["DISPLAY"] && system("which xclip > /dev/null 2>&1"))

    if CLIPBOARD_AVAILABLE
      GLOBAL_MAP.define_key("\ew", :clipboard_copy_region)
{'fraction_non_alphanumeric': 0.11182994454713494, 'fraction_numerical': 0.0046210720887245845, 'mean_word_length': 4.257281553398058, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3089147', 'n_tokens_mistral': 375, 'n_tokens_neox': 357, 'n_words': 83}