more フィルターを実装する方法を考えています-表示テキストのように、画面いっぱいになり、各行を「Enter」で移動します(UNIXのように)。ncurses が役立つことはわかっていますが、適切な方法が見つかりません。
ありがとう!
2つのバッファを実装する
これは概要である可能性があります:
Read from file into the 1st buffer.
offset = 0
while `offset != total_lines_in_file`
[1] show `max_lines_in_a_page` number of lines starting from line number `offset`
[2] when showing the lines if a buffer end is detected, load the other buffer and switch buffer, and print remaining lines.
[3] if the specific scroll keypress is detected make `offset = offset + x` (x = 1, 2 etc.)
more
実装のソースコードをよく見てください。