I'm trying to create a text viewer that is wider than the screen so that I can scroll right and left. I'm using Curses::Pad
for this. The documentation states that Pad
can be bigger than the screen.
Please consider the following code:
#!/usr/bin/ruby2.1
require 'curses'
Curses.init_screen
pad = Curses::Pad.new Curses.lines, Curses.cols * 10
0.upto(200) do |i|
pad.setpos(i, 0)
pad.addstr(0.upto(600).to_a.join(","))
end
pad.refresh 0,0,0,0,Curses.lines,Curses.cols
sleep(3)
pad.refresh 0,200,0,0,Curses.lines,Curses.cols
sleep(200)
When the Pad
size is bigger than the screen size, nothing is shown. When the Pad
size is the same as the screen size, the second refresh
fails unless min_pad_col
is smaller than pad
.
Cab anyone point what am I doing wrong?