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

Feature request: Allowing showing additional context lines before/after match #200

Open
petsuter opened this issue Sep 28, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@petsuter
Copy link

It would sometimes be very useful to show not only the matching line ("Text" column, "Context" Radiobutton) but also additional contextual lines before / after the matching line, similar to how grep --after-context=3 / grep --before-context=3 works in GNU grep.

Previously requested in #87

@stefankueng stefankueng added the enhancement New feature or request label Sep 28, 2020
@TooMuchBlue
Copy link

I can see where showing the context at all times could be very complicated, visually: Search Results would need to display multiple lines in the Text column, yet still be a single selectable row. That sounds like it could require a more complicated grid control.

As an alternative, how about adding an icon column to the results in Content view, and displaying the matching text with context when hovering on the icon? The window that displays on hover could then format the matching text to make it stand out.

I think it may be appropriate to limit the number of columns shown in context, not just rows. Some of the files I work with have very long lines of text -- over 500 characters. Even today (version 2.0.8), when reviewing results in Content view, hovering on the Text column frequently displays the tooltip/hover text, and even that is chopped off. Trying to display context in the middle of these very long lines could require line wrap in order to show the line with the match, and also the very long lines above/below.

Instead, I suggest showing a maximum number of columns in the context. If the matching line is longer than the max columns, the context should position the matching text near the center (left-to-right) of the window, and then show the corresponding columns from the lines above and below.

Just ideas to get the juices flowing.

P.S. Thanks for continuing to develop GrepWin. I use it multiple times a day, every day.

@garry-ut99
Copy link

garry-ut99 commented Oct 14, 2023

Apart of the above's proposals, some additional info :

  • showing the whole line containing the matched string,
    which means showing text at the left & right sides of the matched string,
    is called a horizonal context
  • showing lines above & below the matched string line is called a vertical context
  • the both contexts are useful :
    • a horizonal context is most useful
    • a vertical context provides additional usefulness in some cases (like source code files, logs)
  • as an example, a vertical context is available in : dnGrep and SublimeText
  • example screenshoot of dnGrep :
    dnGrep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants