Sha256: f393fba23d508568d59f94bc5243e3bd7c473130bee21a6dbe7f6e891a024acd

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 Bytes

Contents

# frozen_string_literal: true
str = ""
t = nil
Shoes.app height: 500, width: 450 do
  background rgb(77, 77, 77)
  stack margin: 10 do
    para span("TEXT EDITOR", stroke: red, fill: white), " * USE ALT-Q TO QUIT", stroke: white
  end
  stack margin: 10 do
    t = para "", font: "Monospace 12px", stroke: white
    t.cursor = -1
  end
  keypress do |k|
    case k
    when String
      str += k
    when :backspace
      str.slice!(-1)
    when :tab
      str += "  "
    when :alt_q
      quit
    when :alt_c
      self.clipboard = str
    when :alt_v
      str += clipboard
    end
    t.replace str
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-4.0.0.pre12 samples/simple_editor.rb