Class: Cursor
- Inherits:
-
Object
- Object
- Cursor
- Defined in:
- lib/monadic_chat/helper.rb
Class Method Summary collapse
Class Method Details
.pos ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/monadic_chat/helper.rb', line 5 def pos res = +"" $stdin.raw do |stdin| $stdout << "\e[6n" $stdout.flush while (c = stdin.getc) != "R" res << c if c end end m = res.match(/(?<row>\d+);(?<column>\d+)/) { row: Integer(m[:row]), column: Integer(m[:column]) } end |