Context lines around a match have a different format than match lines, and are presently ignored by okapi. Example for -C2:
1911/714-column_1.md-98-| —— Miss Miriam H, GovtDC PubSchs Tchr $700 DC DC DC | OK |
1911/714-column_1.md-99-| —— Thos, Navy MolderHlpr $2.08pd Pa 1PaPhiladelphia NavyYdPhiladelphia | OK |
1911/714-column_1.md:100:12:| Selahes, Abondino, War QMatLg Tmstr $180 PI PI PI | OK |
1911/714-column_1.md-101-| Selatsee, Frank, Int IndServ ChPolice $35pm Wash 3WashYakima FtSimcoe Wash | OK |
1911/714-column_1.md-102-| Selbie, Wm E, USA 4RegInf 2Lt PayRank SDak AtLgSDak — | OK |
For the simple case, this is easy enough to fix: just filter the match as normal. If the match isn't excluded and passes the column check, then pass through the context to the virtual buffer. But there are complications:
- What to do if a context line fails an exclude check?
- What to do if two sequential lines match the initial pattern, but only one of them fails the column/exclude check? Do all the context lines come through? In the worst case, you could have every odd line in a file match, but all of them save 1 be excluded. If the context lines were all passed through, that would definitely feel buggy.
- In the above case, does the second match line (which fails, but is context for the first) come through?
The only "Right" way to do solve problems 2 is to implement our own context arguments instead of relying on rg. These would be fetched when the files are initially loaded. But this doesn't answer question 1 or 3.
Let me know how important supporting context arguments is to your workflow.
Context lines around a match have a different format than match lines, and are presently ignored by okapi. Example for
-C2:For the simple case, this is easy enough to fix: just filter the match as normal. If the match isn't excluded and passes the column check, then pass through the context to the virtual buffer. But there are complications:
The only "Right" way to do solve problems 2 is to implement our own context arguments instead of relying on
rg. These would be fetched when the files are initially loaded. But this doesn't answer question 1 or 3.Let me know how important supporting context arguments is to your workflow.