Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Justify line numbers #2179

Closed
deivid-rodriguez opened this issue Apr 12, 2022 · 2 comments
Closed

Justify line numbers #2179

deivid-rodriguez opened this issue Apr 12, 2022 · 2 comments
Labels
duplicate An issue that is duplicative of another.

Comments

@deivid-rodriguez
Copy link

First of all, thanks so much for ripgrep, I use it all the time! 😍

Now, my little suggestion

Describe your feature request

Currently when searching in a terminals, matching lines are preceded by line numbers followed by ":" or "-" depending on whether they are actual matches or context lines. This is cool.

However, when the output includes successive lines with different number of digits, that can slightly decrease the readability of the output, specially for files where indentation is important. For example:

1-uk:
2-  active_admin:
3-    dashboard: "Панель керування"
4-    dashboard_welcome:
5-      welcome: "Ласкаво просимо до Active Admin. Це стандартна сторінка керування сайтом."
6-      call_to_action: "Щоб додати сюди що-небудь, зазирніть у 'app/admin/dashboard.rb'"
7-    view: "Переглянути"
8-    edit: "Змінити"
9-    delete: "Видалити"
10-    delete_confirmation: "Ви впевнені, що хочете це видалити?"
11:    new_model: "Створити %{model}"
12-    edit_model: "Змінити %{model}"
13-    delete_model: "Видалити %{model}"
14-    details: "%{model} детальніше"
15-    cancel: "Скасувати"
16-    empty: "Пусто"
17-    previous: "Поперед."
18-    next: "Наст."
19-    download: "Завантаження:"
20-    has_many_new: "Додати %{model}"
21-    has_many_delete: "Прибрати"

The delete and delete_confirmation keys are siblings, but the indentation makes it not that clear.

Would it be desirable to justify line numbers to the highest number of digits of each chunk of output?

Thanks!

@BurntSushi
Copy link
Owner

Something like this was requested in #544. It was added to ripgrep in #723. An issue with the idea was raised in #795 and I ultimately decided to remove the feature in ae6f871. The options at this point are:

  • Use the --json flag and write your own tool that prints results in whatever way you want.
  • Somehow find a way to come up with a thorough specification for this feature that works well in all output modes and doesn't require buffering all output.
  • Even if you manage to achieve the above, I might still say no to it if I perceive it as increasing the maintenance burden too much.

I'm going to close this for now as a duplicate as I think it's unlikely something like this will get added.

I will note that I suspect you could write a fairly simple wrapper script that will do what you need without too much fuss.

@BurntSushi BurntSushi added the duplicate An issue that is duplicative of another. label Apr 12, 2022
@deivid-rodriguez
Copy link
Author

Thank you for your suggestions and context, and sorry I failed to find the previous request before opening this, I must've used the wrong search keys :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate An issue that is duplicative of another.
Projects
None yet
Development

No branches or pull requests

2 participants