Grepview - Group matches by line
Open, Needs TriagePublic

Description

Currently if there is more than one match in a line they are all shown separately. The idea is to group them together under a new level in the Treeview corresponding to the line.
For example if your file contains a line like
Type* type = new Type();
and you search for type it would produce

  • foo.cpp: X matches
    • Line n: Type * type = new Type();
      • Type* type = new Type();
      • Type* type = new Type();
      • Type* type = new Type();

instead of

  • foo.cpp: X matches
    • Line n: Type* type = new Type();
    • Line n: Type* type = new Type();
    • Line n: Type* type = new Type();

This would improve the clarity of the outputview for some usecases, for example quickly checking where something is used or orienting in a large codebase. While it could be hindering during find/replace. I would like to have this feature and have some proposals for that:

  • Only have this extra level when there is a more than one match in a line
  • Non matches (files and lines) will still be skipped over by go to next/previous item but not if a line item is its only match itself
  • Make it optional and the user can quickly switch between both view modes depending on which suits his current task better

Code wise it would need some restructuring of the current code, for example the items knowing which level they correspond to or having fields to the respective parents. However I feel this could also be chance to improve on the current code which is not easy to understand see for example the next/previous item functions.

davidre created this task.Jul 13 2019, 7:04 PM
davidre updated the task description. (Show Details)
arrowd added a subscriber: arrowd.Jul 13 2019, 7:09 PM