Method: WindowTerminal.getchrs

Defined in:
lib/accu-window.rb

.getchrsObject

Similar to ask_quietly but renders the screen after each character is entered.

A block may also be passed which will be executed just before a render with the current character and the full string thus far.



830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
# File 'lib/accu-window.rb', line 830

def self.getchrs()
  if self.os == :linux then
    full = ""
    string = " "
    string = self.getchr()
    while (string.ord != 13) do
      if string.ord == 127 and full.length > 0 then
        full.slice!(full.length - 1)
      else
        full << string.ord
      end
      yield(string,full) if block_given?
      self.screen_render
      string = self.getchr()
    end
    return full
  else
    ""
  end
end