Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add matchbraceleft option #3432

Merged
merged 1 commit into from
Aug 18, 2024
Merged

Add matchbraceleft option #3432

merged 1 commit into from
Aug 18, 2024

Conversation

dmaluka
Copy link
Collaborator

@dmaluka dmaluka commented Aug 18, 2024

Add matchbraceleft option to allow disabling the default behavior matching not just the brace under cursor but also the brace to the left of it (which is arguably convenient, but also ambiguous and non-intuitive). With matchbraceleft disabled, micro will only match the brace character that is precisely under the cursor, and also when jumping to the matching brace, will always move cursor precisely to the matching brace character, not to the character next to it.

Nota bene: historical journey:

  • There was already a matchbraceleft option introduced in commit ea6a87d, when this feature (matching brace to the left) was introduced first time. That time it was matching only the brace to the left, instead of the brace under the cursor, and was disabled by default.

  • Later this feature was removed during the big refactoring of micro.

  • Then this feature was reintroduced again in commit d1e713c, in its present form (i.e. combined brace matching both under the cursor and to the left, simulating I-beam cursor behavior), and it was introduced unconditionally, without an option to disable it.

  • Since then, multiple users complained about this feature and asked for an option to disable it (e.g. Jumping to matching brace not as expected #3419 (comment)), so now we are reintroducing it as an option again (this time enabled by default though).

Fixes #3419

Add `matchbraceleft` option to allow disabling the default behavior
matching not just the brace under cursor but also the brace to the left
of it (which is arguably convenient, but also ambiguous and
non-intuitive). With `matchbraceleft` disabled, micro will only match
the brace character that is precisely under the cursor, and also when
jumping to the matching brace, will always move cursor precisely to the
matching brace character, not to the character next to it.

Nota bene: historical journey:

- There was already a `matchbraceleft` option introduced in commit
  ea6a87d, when this feature (matching brace to the left) was
  introduced first time. That time it was matching _only_ the brace
  to the left, _instead_ of the brace under the cursor, and was
  disabled by default.

- Later this feature was removed during the big refactoring of micro.

- Then this feature was reintroduced again in commit d1e713c, in
  its present form (i.e. combined brace matching both under the cursor
  and to the left, simulating I-beam cursor behavior), and it was
  introduced unconditionally, without an option to disable it.

- Since then, multiple users complained about this feature and asked
  for an option to disable it, so now we are reintroducing it as an
  option again (this time enabled by default though).
@JoeKar JoeKar merged commit fd3a002 into zyedidia:master Aug 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jumping to matching brace not as expected
2 participants