Patch for a better "more"

Tristan Schmelcher tpkschme at engmail.uwaterloo.ca
Wed Aug 15 04:46:05 UTC 2007


Hello,

I recently used BusyBox extensively in an embedded device product and
ended up making some improvements to the "more" command. Attached is a
patch against BB 1.6.1. The changes are:

- Fixed a number of deficiencies in the line wrapping.
- Fixed a bug where the page could scroll multiple times per keypress.
(The fix is to only scroll on spacebar, as with other "more"
implementations. If an invalid character is pressed, we print a brief
usage message.)
- Made us re-read the terminal dimensions after user input, in case they
resized the terminal while we were waiting.
- Added an 'R' key to print the rest of the file without prompting.
- Made us crudely support tabs in the line-wrapping code by converting
them to 8 spaces (not great, but better than messing up the screen; make
it a compile-time option if you don't like it).

With this patch, the line-wrapping code now scrolls the screen correctly
for any combination of normal characters, newlines, and tabs. And I
think the change in code size is probably fairly small.

Enjoy. I hope to see this in the next release. :)

Thanks for the great program,

Tristan Schmelcher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/busybox/attachments/20070814/1a450776/attachment-0002.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-1.6.1-more-patch.diff
Type: text/x-patch
Size: 5025 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070814/1a450776/attachment-0002.bin 


More information about the busybox mailing list