Comments (4)
Sorry for the trouble this may have caused. Glad you found this and shared it with us! An update will be released soon after a more testing to verify everything.
Yeah, no worries. Thanks for your time and effort on this project.
Keep up the good work!
from ugrep.
I don't think that is a problem caused by any combinations of options, because none of the other options have any effect on the context. If anything differs or matters, it is the pattern itself, which is also modified with -w
to match words using anchors.
Since we don't have your test case, you need to help us out here a bit. Can you be a bit more specific? Are after contexts always missing, or in some cases and when?
from ugrep.
Here's the pattern I am using.
from ugrep.
Looks like there is an "off by one" problem, where the match position counter is off by one and that messes with the context position that no longer aligns. I also see the issue with .*
, but not with different patterns even when those match the same initial part of a pattern. To show the differences, note the second search shows the context:
With a bit of tracing I found out that the difference between these cases is observable only in parts that actually do not match, like in the after context line. The internal pointer/position is moved by one so the context is no longer the same.
So it flew under the radar since pattern matching is OK, but the after contexts are not when this pattern is used. The "off by one" problem is triggered with the initial used of .*
in a pattern and affects the after context (in most cases it appears to affect the after context after the last match, not in between matches, but not 100% sure).
The fix is actually very simple. The "off by one" happens in the pattern matcher, which is in an optimization that scans ahead when nothing possibly matches. The fixed version is correct:
Sorry for the trouble this may have caused. Glad you found this and shared it with us! An update will be released soon after a more testing to verify everything.
from ugrep.
Related Issues (20)
- How to use ugrep instead of grep with git HOT 1
- [QUESTION] Help me with a strict (fixed) search HOT 3
- How to show file name inside a tar file HOT 3
- Escaped space causes a regex syntax error HOT 5
- background coloring artifact due to scrolling when the first character of a continuation line is matched HOT 14
- Are ugrep SSE and AVX binaries portable to non-SSE2 CPUs? HOT 8
- [RFE] block matching in ugrep HOT 18
- Unresolved boost_regex symbol HOT 8
- [FR] Have portable, statically-linked releases for Linux HOT 9
- build fails on AIX HOT 12
- `ug -TrinΞ` is invalid, but `ug -ITrin` isn't? HOT 2
- ug+ : many warning messages to stderr for problems with PDFs HOT 3
- max-count across all files HOT 2
- inquiry on saving the output interactive HOT 4
- Ugrep search throws error -z option not available in new Homebrew ugrep v5.1.2 HOT 16
- ugrep 5.1.3 FTFBS with musl HOT 2
- [FR] 90% speed up by refactoring and optimizing some code HOT 2
- easier windows install HOT 6
- valgrind: Source and destination overlap in memcpy - Zthread::decompress() (ugrep.cpp:1205) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ugrep.