summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/inlines.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/inlines.c b/src/inlines.c
index 3e298de..afe564c 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -301,8 +301,10 @@ scan_delims(subject* subj, unsigned char c, bool * can_open, bool * can_close)
!utf8proc_is_space(after_char) &&
!utf8proc_is_punctuation(after_char));
if (c == '_') {
- *can_open = left_flanking && !right_flanking;
- *can_close = right_flanking && !left_flanking;
+ *can_open = left_flanking &&
+ (!right_flanking || utf8proc_is_punctuation(before_char));
+ *can_close = right_flanking &&
+ (!left_flanking || utf8proc_is_punctuation(after_char));
} else if (c == '\'' || c == '"') {
*can_open = left_flanking && !right_flanking;
*can_close = right_flanking;