<blockquote>
<p><a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=793526" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/b4n">@b4n</a>, better to not try to be smart, it will always be wrong somewhere, users are too good at finding new things to do that we never thought of.</p>
</blockquote>
<p>hehe yeah they are.  However I found a not-really-smart (yay) but pretty nice technique based on <a href="https://developer.gnome.org/gobject/stable/gobject-Signals.html#g-signal-has-handler-pending" rel="nofollow"><code>g_signal_has_handler_pending()</code></a> to prevent most of the computation when it won't be consumed anyway.  I need to check if it doesn't break the accessible when it's actually used, but it's pretty promising for now (e.g. with my initial attempt I can do the replaces mentioned here with a much more reasonable delay -- a couple of seconds).</p>
<p>It still doesn't help the case where accessibility is used, that'll be a matter of optimizing the position-to-character conversion.  Fortunately AFAIK there's position cache available in latest Scintilla that the accessibility layer could use.  We'll see.</p>

<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/issues/2092#issuecomment-468266633">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ-GYY7_WcFxtO_ULGNWCuCVVPsTnks5vR9UtgaJpZM4bRl6j">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABDrJx49Phi_hWkCmHGUo9QvdORCYkb-ks5vR9UtgaJpZM4bRl6j.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany","title":"geany/geany","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany"}},"updates":{"snippets":[{"icon":"PERSON","message":"@b4n in #2092: \u003e @b4n, better to not try to be smart, it will always be wrong somewhere, users are too good at finding new things to do that we never thought of.\r\n\r\nhehe yeah they are.  However I found a not-really-smart (yay) but pretty nice technique based on [`g_signal_has_handler_pending()`](https://developer.gnome.org/gobject/stable/gobject-Signals.html#g-signal-has-handler-pending) to prevent most of the computation when it won't be consumed anyway.  I need to check if it doesn't break the accessible when it's actually used, but it's pretty promising for now (e.g. with my initial attempt I can do the replaces mentioned here with a much more reasonable delay -- a couple of seconds).\r\n\r\nIt still doesn't help the case where accessibility is used, that'll be a matter of optimizing the position-to-character conversion.  Fortunately AFAIK there's position cache available in latest Scintilla that the accessibility layer could use.  We'll see."}],"action":{"name":"View Issue","url":"https://github.com/geany/geany/issues/2092#issuecomment-468266633"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/issues/2092#issuecomment-468266633",
"url": "https://github.com/geany/geany/issues/2092#issuecomment-468266633",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>