[Github-comments] [geany/geany] A problem with "go to matching brace" command. (#1998)

Yury notifications at xxxxx
Tue Jan 22 20:31:32 UTC 2019


The statement "The cursor is between two brace characters " is inaccurate. The text cursor is an underscore, a solid rectangle, or a vertical line. When two braces are in a row, the caret can be either at the first brace or at the second brace position.  The statement "In between two braces" makes sense only when we use vertical line cursor. Then it looks like the bar is touching the brace from the left or from the right. Without vertical line it is really unclear why the position after the brace is related to the brace, but  the position prior to brace is not related. Editors that attempt to simulate outside/inside brace logic move the caret either to matching brace position or to the position next to matching brace. However, this logic causes this ambiguity that cannot be correctly resolved.
Other editors evaluate a brace only at the caret position. Then everything is obvious, and matching brace doesn't have any issue.
My suggestion is to check the brace existence only at the caret position, cancelling arguable inside/outside brace logic.  As I understand the change should affect only brace highlighting and brace matching . I might miss some functionality that I never used before.
I attached two patched functions: delay_match_brace and goto_matching_brace as a proof of concept. 
[goto_matching_brace-function.txt](https://github.com/geany/geany/files/2784477/goto_matching_brace-function.txt)
[delay_match_brace-functon.txt](https://github.com/geany/geany/files/2784479/delay_match_brace-functon.txt)


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/1998#issuecomment-456552132
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20190122/5b929094/attachment.html>


More information about the Github-comments mailing list