Skip to content

Commit

Permalink
Merge pull request #2066 from sopel-irc/find-no-empty-bold
Browse files Browse the repository at this point in the history
find: don't output useless bold formatting for empty replacement
  • Loading branch information
dgw authored May 23, 2021
2 parents d7a538d + f3ec122 commit 0a6e5ee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sopel/modules/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,14 @@ def findandreplace(bot, trigger):

sep = trigger.group('sep')
old = trigger.group('old').replace('\\%s' % sep, sep)
new = bold(trigger.group('new')).replace('\\%s' % sep, sep)
new = trigger.group('new')
me = False # /me command
flags = trigger.group('flags') or ''

# only clean/format the new string if it's non-empty
if new:
new = bold(new.replace('\\%s' % sep, sep))

# If g flag is given, replace all. Otherwise, replace once.
if 'g' in flags:
count = -1
Expand Down

0 comments on commit 0a6e5ee

Please sign in to comment.