Suggestion: Have an option to justify line numbers

1 view
Skip to first unread message

Neil Hooey

unread,
Sep 30, 2009, 1:11:27 PM9/30/09
to ack dev/users
I really like ack, it's almost perfect. But I do think it's important
to give the user the ability to make the output easier to read.

With an option like `ack --justify`, you can take output that looks
like this:

Foo.cpp:
1:int foo() {
24:float foo;
555:const int foogoo;

And make it more presentable like this:

1:int foo() {
24:float foo;
555:const int foogoo;

(Paste into a fixed-width editor to see, since Google Groups uses
proportional-width characters)

The amount to justify the line numbers would be calculated per-file
given the number of line numbers in the file, or the line number of
the last match.

You should also be able to manually specify the justification amount
on the command-line, so matches between all files looks uniform.

For example:
ack --justify=6

I think having ack calculate the justification amount for all files,
based on the highest line number in all matches, would be impractical
since output would be suppressed until the very last match is found.

What do you think?

- Neil

Bill Ricker

unread,
Sep 30, 2009, 9:54:05 PM9/30/09
to ack-...@googlegroups.com
On Wed, Sep 30, 2009 at 1:11 PM, Neil Hooey <nhooey...@gmail.com> wrote:
>
> What do you think?

nice idea

need to guess log10(maxlinenumber) before first output unless its a
parameter so user guesses wrong instead of code.

--
Bill
n1...@arrl.net bill....@gmail.com

Reply all
Reply to author
Forward
0 new messages