diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-08-06 18:11:29 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-08-06 18:11:29 -0700 |
| commit | 07c628471c1b37f125e3766f0e95089168603b87 (patch) | |
| tree | d1cb0c39e1b51ee1980bf05cc1760dc9e3ddfdf3 /bp.c | |
| parent | 78034539773a3be2113fed80c39878d2727d6ef2 (diff) | |
Changed it so --replace makes context default to `all`, but --inplace
doesn't, so it can still be easily used as a filter.
Diffstat (limited to 'bp.c')
| -rw-r--r-- | bp.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -424,7 +424,6 @@ int main(int argc, char *argv[]) options.mode = MODE_INPLACE; options.print_filenames = false; options.format = FORMAT_PLAIN; - options.context_before = options.context_after = ALL_CONTEXT; } else if (BOOLFLAG("-G") || BOOLFLAG("--git")) { options.git_mode = true; } else if (BOOLFLAG("-i") || BOOLFLAG("--ignore-case")) { @@ -440,6 +439,8 @@ int main(int argc, char *argv[]) pattern = bp_replacement(replace_file, pattern, replace_file->start); if (!pattern) errx(EXIT_FAILURE, "Replacement failed to compile: %s", flag); + if (options.context_before == USE_DEFAULT_CONTEXT) options.context_before = ALL_CONTEXT; + if (options.context_after == USE_DEFAULT_CONTEXT) options.context_after = ALL_CONTEXT; } else if (FLAG("-g") || FLAG("--grammar")) { file_t *f = NULL; if (strlen(flag) > 3 && strncmp(&flag[strlen(flag)-3], ".bp", 3) == 0) |
