class Curses

e[nE n行下の先頭に移動 e[nF n行上の先頭に移動 e[nG 現在位置と関係なく左からnの場所に移動

Public Class Methods

clearline() click to toggle source

e[nJ 画面消去 0(or省略)・・・カーソルより後ろを消去 1・・・カーソルより前を消去 2・・・画面全体を消去

# File lib/helpline/curses.rb, line 57
def Curses.clearline # カーソルより後を消去
  STDOUT.print "\e[J"
end
down(n = 1) click to toggle source
# File lib/helpline/curses.rb, line 31
def Curses.down(n = 1)
  STDOUT.print "\e[#{n}B"
  @y += n
end
dump() click to toggle source
# File lib/helpline/curses.rb, line 78
def Curses.dump
  puts @x
  puts @y
end
left(n = 1) click to toggle source
# File lib/helpline/curses.rb, line 42
def Curses.left(n = 1)
  STDOUT.print "\e[#{n}D"
  @x -= n
end
move(yy,xx) click to toggle source
# File lib/helpline/curses.rb, line 61
def Curses.move(yy,xx)
  if xx > @x
    Curses.right(xx-@x)
  end
  if xx < @x
    Curses.left(@x - xx)
  end
  if yy > @y
    Curses.down(yy - @y)
  end
  if yy < @y
    Curses.up(@y - yy)
  end
  @y = yy
  @x = xx
end
print(s) click to toggle source
print_bold(s) click to toggle source
print_inverse(s) click to toggle source

e[0m 指定をリセットし未指定状態に戻す(0は省略可) e[1m 太字 e[2m 薄く表示 e[3m イタリック e[4m アンダーライン e[5m ブリンク e[6m 高速ブリンク e[7m 文字色と背景色の反転 e[8m 表示を隠す(コピペ可能) e[9m 取り消し

right(n = 1) click to toggle source
# File lib/helpline/curses.rb, line 36
def Curses.right(n = 1)
  n = 1 unless n
  STDOUT.print "\e[#{n}C"
  @x += n
end
tol(n = 0) click to toggle source
# File lib/helpline/curses.rb, line 47
def Curses.tol(n = 0) # 行頭からn文字目に移動
  STDOUT.print "\e[#{n+1}G"
  @x = n
end
up(n = 1) click to toggle source
# File lib/helpline/curses.rb, line 26
def Curses.up(n = 1)
  STDOUT.print "\e[#{n}A"
  @y -= n
end