variable line-display pager?
Gary Kline
kline at thought.org
Sun Feb 20 22:56:24 UTC 2011
On Sun, Feb 20, 2011 at 08:44:10AM -0800, Chip Camden wrote:
> Quoth Gary Kline on Sunday, 20 February 2011:
> <snip>
> >
> > Yes, this is much nicer that the more -15 that messes up the
> > text with it's [MORE...] white within black. But here you can't
> > just tap the spacebar; is there a way around that <cr> and
> > turning it into a space...?
> >
> > Also, can you insert
> >
> > "^+++"
> >
> > text
> >
> > "^+++"
> >
> > top And bottom? Pretty sure that the user would have the large
> > font to read aloug with that espeak read to hijm. Having the
> > top/bottom delimiters might make scanning the text easier.
> >
> > (It messed up with more.
> >
> > Anyway, thanks foe something that actually works, :_)
> >
> > gary
> >
> >
> >
> >
> > --
> > Gary Kline kline at thought.org http://www.thought.org Public Service Unix
> > Journey Toward the Dawn, E-Book: http://www.thought.org
> > The 7.98a release of Jottings: http://jottings.thought.org
> >
> Better?
>
The code does what you tell it to. It puts the +++ string
before the output and following the EOF. I was thinking of
having:
+++
15 lines of text
+++
After espeak speaks these lines, the user hits the spacebar and
another
+++
15 lines
+++
until EOF. I know zero ruby and am still learhnning python.
Thanks much for getting me going with ruby! FRom here on it is
just logic, :_)
gary
>
> #!/usr/bin/env ruby
> require 'optparse'
>
> pagesize = 15
>
> optparse = OptionParser.new do |opts|
> opts.banner = 'usage: npg [-n pagesize] file...'
>
> opts.on('-n', '--numlines pagesize', 'Specify page size in number of lines') do |n|
> pagesize = n.to_i
> end
>
> end
>
> begin
> optparse.parse!
> rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
> puts e
> puts optparse
> exit 1
> end
>
> puts "^+++"
> loop do
> pagesize.times do
> if line = gets
> puts line
> else
> puts "^+++"
> exit
> end
> end
> print "More..."
> system "stty raw"
> STDIN.getc
> system "stty -raw"
> end
>
> --
> Sterling (Chip) Camden | sterling at camdensoftware.com | 2048D/3A978E4F
> http://chipsquips.com | http://camdensoftware.com | http://chipstips.com
--
Gary Kline kline at thought.org http://www.thought.org Public Service Unix
Journey Toward the Dawn, E-Book: http://www.thought.org
The 7.98a release of Jottings: http://jottings.thought.org
More information about the freebsd-questions
mailing list