You are not logged in.
Say I have a huge text file and I want to put it in an ncurses pad so the user can scroll through it, how is it done?
I have something like
max_x = stdscr.getmaxyx()[1]
max_y = stdscr.getmaxyx()[0]
log_window = curses.newpad(max_y,max_x)
but I can't slam all the file lines in there because it is bigger than the newpad size.
if I do
log_window = curses.newpad(len(file_data),max_x)
log_window.refresh(window_position,0,4,0,max_y,max_x
I get
_curses.error: prefresh() returned ERR
Can't think if any way to get this done.
Last edited by boast (2013-05-12 18:00:04)
Asus M4A785TD-V ;; Phenom II X4 @ 3.9GHz ;; Ripjaws 12GB DDR3-1600 ;; 128GB Samsung 830 ;; MSI GTX460 v2 w/ blob ;; Arch Linux + KDE 4.x
Offline
You can check out the code in the editor function of keepassc to see how we did it. So far we've only implemented vertical scrolling, not horizontal yet. We didn't use pads either...just fancy scrolling in the buffer.
Scott
Offline
If you want to load the whole file into a pad, then you could also create a fitting pad and then use a subpad which you will display in the console.
The refresh call seems to be fine. What is the value of window_position?
Last edited by progandy (2013-05-12 14:48:04)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
If you want to load the whole file into a pad, then you could also create a fitting pad and then use a subpad which you will display in the console.
ahh, I see. That worked, thanks!
Asus M4A785TD-V ;; Phenom II X4 @ 3.9GHz ;; Ripjaws 12GB DDR3-1600 ;; 128GB Samsung 830 ;; MSI GTX460 v2 w/ blob ;; Arch Linux + KDE 4.x
Offline