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

Handle punctuation characters separately #594

Open
wants to merge 3 commits into
base: default
Choose a base branch
from

Conversation

paaguti
Copy link

@paaguti paaguti commented Feb 12, 2025

A way to control when to auto_enclose punctuation characters.

@orbitalquark
Copy link
Owner

orbitalquark commented Feb 17, 2025

I'm going to propose this:

 events.connect(events.KEYPRESS, function(key)
 	if not M.auto_enclose or buffer.selection_empty or not key:find('^%p$') then return end
 	if ui.command_entry.active then return end
+	if textadept.snippets.active and not M.auto_pairs[key] then return end -- likely placeholder
 	M.enclose(key, M.auto_pairs[key] or key, true)
 	return true -- prevent typing
 end, 1)

I am not in favor of adding another textadept.editing option, and since we are the only two who have been inconvenienced enough to bring it up, then I think this is okay. Should anyone complain, we can revisit :)

Does this work for you? Or do you also experience the issue outside of snippets?

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.

2 participants