Thanks for the advice. I can provide more of the code, or all the
code…
The specific error messages are:
fsed.rb:681:in ‘select’: Interrupt
from fsed.rb 681:in ‘run’
from edit.rb:93
-or-
the application simply reports “Quit”, with no error at all
Let me send you the whole loop… it’s long and not refactored and a
mess… so no laughing (out loud…)
I’m not sure what else I could provide. Unix low level io is not one
of my skills…
Appreciate any other advice you guys could give, and I will happily
provide any info you want.
Take Care and thanks!
Mark
while true
if select([@in_io], nil, nil, 1)
c = @in_io.sysread(1)
#c = @in_io.getc
$lf.print"c: #{c.bytes.to_a}\n"
if @supress then # if we are suppressing the mysterious
extra linefeed… we do that here.
@supress = false
c = 0.chr if c.bytes.to_a[0] = 10
end
if @w_mode then #We are in winodw mode, not edit mode...
$lf.print "in wmode\n"
$lf.print "c: #{c.upcase}"
case c
when "\e" #effectively, esc this is cancel for
everything
@w_mode = false
@out_io.print @state.screen_clear
else
case @w_type
when ABORT,SAVE
if c.upcase == “Y” then
@state.clear if ABORT
@state.clear_screen
sleep(4)
break
else
@out_io.print @state.screen_clear
@w_mode = false
end
end
end
else
case c
when "\cX" # exit
@out_io.print @state.yes_no_window("Post message... Are you
sure?")
@w_type = SAVE
@w_mode = true
when “\cG”,"\eOP"
@out_io.print @state.help_window
@w_type = MESSAGE
@w_mode = true
when “\cA”
@out_io.print @state.yes_no_window(“Abort message… Are you
sure?”)
@w_type = ABORT
@w_mode = true
when “\cN” #insert line
@state.newline
@out_io.print @state.redraw(true)
when “\cY” #delete line
@state.deleteline
@out_io.print @state.redraw(true)
when “\cL” # refresh
@out_io.print @state.redraw(true)
when “\r”,"\n"
$lf.print “i’m at newline\n”
@state.newline
@supress = true if @bbs_mode #telnet seems to like to echo
linefeeds. lets supress this …
@out_io.print @state.redraw(true)
when “\010”, “\177”
redraw = @state.backspace
@out_io.print “\e[#{@state.current_y +
@state.header_height};1H\e[K”
@out_io.print @state.buffer.line(@state.current_y)
@out_io.print @state.update_cursor_position
@out_io.print @state.redraw(true) if redraw
when “\e” # escape
buf = c
else
if buf.nil?
chr = c.unpack(“c”)[0]
if (chr >= 32 && chr <= 127)
out_c,redraw = @state.input_char_at_cursor©
@out_io.putc(out_c) if !out_c.nil?
@out_io.print @state.redraw(true) if redraw
end
else
buf << c
$lf.print “buf: #{buf}\n”
case buf
when “\e[H”,"\e[1"
@state.home_cursor
@out_io.print @state.update_cursor_position
when “\e[F”,"\e[4"
@state.end_cursor
@out_io.print @state.update_cursor_position
when “\e[6”
redraw = @state.page_down
@out_io.print @state.redraw(true) if redraw
when “\e[5”
redraw = @state.page_up
@out_io.print @state.redraw(true) if redraw
when “\e[2”
@state.toggle_ins
@out_io.print @state.redraw(true)
when “\e[A”
redraw = @state.move_cursor_up(1)
if redraw
@out_io.print @state.redraw(true)
else
@out_io.print @state.update_cursor_position
end
buf = nil
when “\e[B”
redraw = @state.move_cursor_down(1)
if redraw
@out_io.print @state.redraw(true)
else
@out_io.print @state.update_cursor_position
end
buf = nil
when “\e[D”
@state.move_cursor_left(1)
@out_io.print @state.update_cursor_position
buf = nil
when “\e[C”
@state.move_cursor_right(1)
@out_io.print @state.update_cursor_position
buf = nil
else
if buf.size >= 3
buf = nil
end
end
end
end
end
end
end
@state.buffer
end
end
On Tue, Jul 1, 2008 at 12:53 PM, Robert K.