Skip to content

Commit

Permalink
Separate option --multiline-dotall and --multiline
Browse files Browse the repository at this point in the history
Using option `--multiline` doesn't necessarily mean the user also wants
`--multiline-dotall`. The user may be certain about the number of new lines
involved. For example, with this code snippet:

    ```c
        if (level == 2U) {
            parent_irq = irq_parent_level_2(irq);
            table_idx = parent_offset + irq_from_level_2(irq);
        }
    #ifdef CONFIG_3RD_LEVEL_INTERRUPTS
        else if (level == 3U) {
            parent_irq = irq_parent_level_3(irq);
            table_idx = parent_offset + irq_from_level_3(irq);
        }
    ```

If I want to search all the #ifdef followed by a else statement, I can use regex
'#ifdef.*\n.*else'. If `--multiline-dotall` is used, this regex will match more
lines than I expected.
  • Loading branch information
feng-qi authored and dajva committed Sep 11, 2021
1 parent 0fa6d33 commit 3e9cada
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rg-menu.el
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ FUNC is an rerun function invoked from an `rg-mode' buffer."
(6 "-a" "Search binary files" "--text")
(4 "-z" "Search zipped files" "--search-zip")
(4 "-v" "Invert match" "--invert-match")
(4 "-U" "Multi line" "--multiline-dotall --multiline")
(4 "-U" "Multi line" "--multiline")
(4 "-." "Dot all" "--multiline-dotall")
(3 "-w" "Search words" "--word-regexp")
(5 "-x" "Search lines" "--line-regexp")
(5 "-P" "Use PCRE2 regexps" "--pcre2")
Expand Down

0 comments on commit 3e9cada

Please sign in to comment.