aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/grab.123
-rw-r--r--src/globals.h2
-rw-r--r--src/main.c4
-rw-r--r--src/work.c2
4 files changed, 20 insertions, 11 deletions
diff --git a/man/grab.1 b/man/grab.1
index a2e5813..46826b2 100644
--- a/man/grab.1
+++ b/man/grab.1
@@ -72,6 +72,10 @@ of the match from the beginning of the file.
This option is useful if your text editor
.Pq such as Xr vim 1 or Xr emacs 1
supports jumping directly to a given byte offset/position.
+.Pp
+This is the default behaviour if the
+.Fl L
+option is not provided.
.It Fl c , Fl Fl color
Force colored output,
even if the output device is not a TTY.
@@ -110,12 +114,10 @@ i.e. don’t interpret them as regular expressions.
Report the positions of matches as a (one-based) line- and column
position separated by a colon.
.Pp
-This option is the default behaviour if the
-.Fl b
-option is not supplied,
-but is provided as a means to override the
-.Fl b
-option.
+This option may be ill-advised in many circumstances.
+See
+.Sx BUGS
+for more details.
.It Fl p , Fl Fl predicate
Return an exit status indicating if a match was found without writing any
output to the standard output.
@@ -342,4 +344,11 @@ used to escape the delimeters will be searched for in the text literally.
The pattern string provided as a command-line argument as well as the
provided input files must be encoded as UTF-8.
No other encodings are supported unless they are UTF-8 compatible,
-such as ASCII. \ No newline at end of file
+such as ASCII.
+.Pp
+The
+.Fl L
+option has incredibly poor performance compared to the
+.Fl b
+option,
+especially with very large inputs. \ No newline at end of file
diff --git a/src/globals.h b/src/globals.h
index f0ed91b..fea375d 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -22,11 +22,11 @@ enum {
};
typedef struct {
- bool b : 1;
bool c : 1;
unsigned H : 2;
bool i : 1;
bool l : 1;
+ bool L : 1;
bool p : 1;
bool s : 1;
bool U : 1;
diff --git a/src/main.c b/src/main.c
index 1679da1..302c972 100644
--- a/src/main.c
+++ b/src/main.c
@@ -84,7 +84,7 @@ main(int argc, char **argv)
break;
switch (opt) {
case 'b':
- flags.b = true;
+ flags.L = false;
#if !GIT_GRAB
flags.do_header = true;
#endif
@@ -122,7 +122,7 @@ main(int argc, char **argv)
flags.l = true;
break;
case 'L':
- flags.b = false;
+ flags.L = true;
#if !GIT_GRAB
flags.do_header = true;
#endif
diff --git a/src/work.c b/src/work.c
index b6433b8..0fdf6eb 100644
--- a/src/work.c
+++ b/src/work.c
@@ -359,7 +359,7 @@ write_match_to_buffer(u8view_t sv, u8view_t *hl)
char offset[/* len(INT64_MAX - 1) */ 19];
pos_state_t ps = {.buf = {baseptr, PTRDIFF_MAX}};
- if (flags.b) {
+ if (!flags.L) {
offsetsz = sprintf(offset, "%td", sv.p - baseptr);
array_extend_sv(buf, COL_LN);
array_extend(buf, offset, offsetsz);