Created
August 30, 2010 14:05
-
-
Save edhowland/557449 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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