Skip to content

Instantly share code, notes, and snippets.

@edhowland
Created August 30, 2010 14:05
Show Gist options
  • Save edhowland/557449 to your computer and use it in GitHub Desktop.
Save edhowland/557449 to your computer and use it in GitHub Desktop.
str, t = "", nil
Shoes.app :height => 500, :width => 450 do
def answer(v)
@status.replace v.inspect
end
background black
stack :margin => 10 do
para span("TEXT EDITOR", :stroke => red, :fill => white), " * USE ALT-Q TO QUIT", :stroke => white
end
stack :margin => 10 do
border white
@keystruck = para '', :stroke => white
end
stack :margin => 10 do
t = para "", :font => "Monospace 12px", :stroke => yellow
t.cursor = -1
end
stack :margin => 10 do
border white
@status = para '', :stroke => white
end
keypress do |k|
if k.kind_of? Symbol
@keystruck.replace k.to_s
end
case k
when String
str += k
when :backspace
str.slice!(-1)
when :tab
str += " "
when :alt_o
str = File.read(ask_open_file)
when :alt_q
quit
when :alt_c
self.clipboard = str
when :alt_v
str += self.clipboard
end
t.replace str
end
@keystruck.replace 'Nil'
@status.replace 'here'
debug 'hi'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment