<p>This PR modifies <code>replace_all</code> to avoid the infinite loop described in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="536503148" data-permission-text="Title is private" data-url="https://github.com/geany/geany-plugins/issues/936" data-hovercard-type="issue" data-hovercard-url="/geany/geany-plugins/issues/936/hovercard" href="https://github.com/geany/geany-plugins/issues/936">#936</a>.  In each iteration, <code>replace_all</code> searches for <code>needle</code> starting from the beginning of <code>haystack</code>.  If <code>replacement</code> contains <code>needle</code>, the result is an infinite loop.  To prevent this from happening, <code>replace_all</code> is should continue searching for <code>needle</code> from the end of the previous <code>replacement</code>.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/geany/geany-plugins/pull/1128'>https://github.com/geany/geany-plugins/pull/1128</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/geany/geany-plugins/pull/1128/commits/187c3e2ac40abe91edcb92d522db242192784086">Markdown: Modify replace_all to avoid infinite loop.</a></li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/geany/geany-plugins/pull/1128/files">1 file</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/geany/geany-plugins/pull/1128/files#diff-9557cb310ad29094d82f01124c7ee436100320394ed91ad8b97cc1568c3105df">markdown/src/viewer.c</a>
    (6)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/geany/geany-plugins/pull/1128.patch'>https://github.com/geany/geany-plugins/pull/1128.patch</a></li>
  <li><a href='https://github.com/geany/geany-plugins/pull/1128.diff'>https://github.com/geany/geany-plugins/pull/1128.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany-plugins/pull/1128">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJYEGYGFQE7AZ5SW76DUJIXRZANCNFSM5G6PRL7Q">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/AAIOWJ4FQHYVWQVHH4QZWZDUJIXRZA5CNFSM5G6PRL72YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4PPQYB2Q.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany-plugins/pull/1128",
"url": "https://github.com/geany/geany-plugins/pull/1128",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>