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

Show lines before and after matched #289

Open
iilyak opened this Issue Jan 14, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@iilyak

iilyak commented Jan 14, 2016

Feature request. It would be very helpful to expand selection around matching lines. I.e. adding peco.ZoomIn and peco.ZoomOut actions. When you trigger ZoomIn it could ask you how many lines to show before and after every selected line (or could use default something like 5).

@syohex

This comment has been minimized.

Show comment
Hide comment
@syohex

syohex Jan 20, 2016

Contributor

Could you give us concrete examples where this feature is very helpful ?

Contributor

syohex commented Jan 20, 2016

Could you give us concrete examples where this feature is very helpful ?

@iilyak

This comment has been minimized.

Show comment
Hide comment
@iilyak

iilyak Jan 20, 2016

When you searching in log produced by unit testing frameworks you usually interested not in matched lines but in few lines before. Since you need to know what caused the failure.

iilyak commented Jan 20, 2016

When you searching in log produced by unit testing frameworks you usually interested not in matched lines but in few lines before. Since you need to know what caused the failure.

@syohex

This comment has been minimized.

Show comment
Hide comment
@syohex

syohex Jan 28, 2016

Contributor

How should peco show before/after lines ?

  • If before/after lines and matched line are shown across multiple pages, how should peco show ?
  • Is separator necessary like grep ?
Contributor

syohex commented Jan 28, 2016

How should peco show before/after lines ?

  • If before/after lines and matched line are shown across multiple pages, how should peco show ?
  • Is separator necessary like grep ?
@iilyak

This comment has been minimized.

Show comment
Hide comment
@iilyak

iilyak Jan 28, 2016

If before/after lines and matched line are shown across multiple pages, how should peco show ?
I didn't consider this case. The flow I imagined is something as the following.

1 cat tests.log | peco
2 user types fail
3 the result is a list of matched lines
4 user selects on of the matching lines
5 user presses zoom-in hot-key
6 few lines before and after selected match are shown (the match itself has a different color)

However I agree there is a case when the selected match is close to the edges of the screen either top or bottom. The implementation could be different depending on the abilities of the library you use.

  1. you could show zoom-in in separate textual window like this
  2. you could show just a portion of an expanded text. For example if selected match is on top of the screen. You would display the match and few lines lines after. You also display up arrow character (if you support unicode) on the right border of a matched line to indicate that the user can scroll up (using arrows) to see more. If unicode is not supported you could display [UP] or [DOWN]

Is separator necessary like grep ?

I would say yes. In case you want to support expansion of multiple selected matches. I didn't figure out how multiple selection work in peco just yet. However if you are considering implementation of the feature only for a single selected match then there is no need for separators.

iilyak commented Jan 28, 2016

If before/after lines and matched line are shown across multiple pages, how should peco show ?
I didn't consider this case. The flow I imagined is something as the following.

1 cat tests.log | peco
2 user types fail
3 the result is a list of matched lines
4 user selects on of the matching lines
5 user presses zoom-in hot-key
6 few lines before and after selected match are shown (the match itself has a different color)

However I agree there is a case when the selected match is close to the edges of the screen either top or bottom. The implementation could be different depending on the abilities of the library you use.

  1. you could show zoom-in in separate textual window like this
  2. you could show just a portion of an expanded text. For example if selected match is on top of the screen. You would display the match and few lines lines after. You also display up arrow character (if you support unicode) on the right border of a matched line to indicate that the user can scroll up (using arrows) to see more. If unicode is not supported you could display [UP] or [DOWN]

Is separator necessary like grep ?

I would say yes. In case you want to support expansion of multiple selected matches. I didn't figure out how multiple selection work in peco just yet. However if you are considering implementation of the feature only for a single selected match then there is no need for separators.

@Cascador

This comment has been minimized.

Show comment
Hide comment
@Cascador

Cascador May 20, 2017

Hello,

+1 @iilyak ! Very useful for sysadmin and read logs.

Thanks !

Hello,

+1 @iilyak ! Very useful for sysadmin and read logs.

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment