<p></p>
<p><b>@kugel-</b> commented on this pull request.</p>

<p>I still need to check the second commit in more detail.</p>
<p>I think it may be useful to compare your work with what the autoclose plugin already does. Perhaps it gives some insights w.r.t to the implementation.</p><hr>

<p>In <a href="https://github.com/geany/geany/pull/2943#discussion_r730124941">src/editor.c</a>:</p>
<pre style='color:#555'>> +                            isAutoClosed = TRUE;
+                       break;
+               case '\'':
+                       if (editor_prefs.autoclose_chars & GEANY_AC_SQUOTE)
+                               isAutoClosed = TRUE;
+                       break;
+               case '"':
+                       if (editor_prefs.autoclose_chars & GEANY_AC_DQUOTE)
+                               isAutoClosed = TRUE;
+                       break;
+       }
+
+       gchar cNext = sci_get_char_at( sci, pos);
+
+       if( isAutoClosed && cNext == c ) {
+               sci_delete_range(sci, pos, 1);
</pre>
<p>Instead of truly deleting the closing char don't you think it would be better to just replace the insertion by a "virtual" cursor movement? Might make a difference w.r.t. undo behavior.</p>

<hr>

<p>In <a href="https://github.com/geany/geany/pull/2943#discussion_r730126116">src/editor.h</a>:</p>
<pre style='color:#555'>> @@ -138,6 +138,7 @@ typedef struct GeanyEditorPrefs
        gint            autocompletion_update_freq;
        gint            scroll_lines_around_cursor;
        gint            ime_interaction; /* input method editor's candidate window behaviour */
+       guint           autoclose_chars_consume;
</pre>
<p>unecessary</p>

<hr>

<p>In <a href="https://github.com/geany/geany/pull/2943#discussion_r730156933">src/editor.c</a>:</p>
<pre style='color:#555'>> +                    if (editor_prefs.autoclose_chars & GEANY_AC_PARENTHESIS)
+                               isAutoClosed = TRUE;
+                       break;
+               case '}':
+                       if (editor_prefs.autoclose_chars & GEANY_AC_CBRACKET)
+                               isAutoClosed = TRUE;
+                       break;
+               case ']':
+                       if (editor_prefs.autoclose_chars & GEANY_AC_SBRACKET)
+                               isAutoClosed = TRUE;
+                       break;
+               case '\'':
+                       if (editor_prefs.autoclose_chars & GEANY_AC_SQUOTE)
+                               isAutoClosed = TRUE;
+                       break;
+               case '"':
</pre>
<p>I wonder how Python multiline strings behave with this change?  These ones enclosed by 3 quotoes <code>""" foo bar """</code></p>

<hr>

<p>In <a href="https://github.com/geany/geany/pull/2943#discussion_r730160367">doc/geany.txt</a>:</p>
<pre style='color:#555'>> @@ -2193,6 +2193,10 @@ Geany can automatically insert a closing bracket and quote characters when
 you open them. For instance, you type a ``(`` and Geany will automatically
 insert ``)``. With the following options, you can define for which
 characters this should work.
+For a more flowing writing (not move the typing hand to arrow keys) Geany
+checks if the character written is the closing quote or bracket that was
+previously inserted. In that case only one quote or bracket of the one written
+and the one previously inserted remains.
</pre>
<p>This can be written in a much more concise way. E.g. "To prevent extraneous quotes or brackets Geany detects if you manually insert closing characters.". Then I would place that before the "With the following options, you …" sentence.</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/pull/2943#pullrequestreview-781245783">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ7L3OLDO3F7C2ZJLNTUHCVXRANCNFSM5GBHXS3Q">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/AAIOWJ4L2LXXRDE4W3ZY32LUHCVXRA5CNFSM5GBHXS32YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOF2IN2VY.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/pull/2943#pullrequestreview-781245783",
"url": "https://github.com/geany/geany/pull/2943#pullrequestreview-781245783",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>