diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-11-13 22:17:13 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-11-13 22:17:13 +0100 |
commit | b3fd0e0a2228c2501a14670440b48bbe6f036f07 (patch) | |
tree | 78c1750e16f2149bd1360a284c7ca35353d2d818 | |
parent | 0cf413c8a6a060fbc532f645202b01cf8ef27fef (diff) |
Default back to -b from -Lv3.0.0
-rw-r--r-- | man/grab.1 | 23 | ||||
-rw-r--r-- | src/globals.h | 2 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/work.c | 2 |
4 files changed, 20 insertions, 11 deletions
@@ -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; @@ -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 @@ -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); |