orbitalquark / textadept

Textadept is a fast, minimalist, and remarkably extensible cross-platform text editor for programmers.
https://orbitalquark.github.io/textadept
MIT License
636 stars 38 forks source link

One letter lexer name gotcha #428

Closed jxzwp closed 1 year ago

jxzwp commented 1 year ago

When you create a lexer with a single letter name like "p", by creating p.lua in the lexers directory, Textadept 12 beta will add it to the keys table and interpret it as the start of a keychain. So, whenever you type "p" it wouldn't insert a "p" in the buffer, instead the status bar would show "Keychain: p".

This behavior wasn't present in Textadept 11.4

I know a solution is to rename the lexer to something like "plang" and then put lexer.detect_extensions['p'] = 'plang' in my init.lua to make it work.

I just wanted to make you aware of this in case you want to add a warning in the docs, as it's more of a gotcha than a bug. To be fair there's already the following note, which was also present in the 11.4 docs.

Note: Try to refrain from using one-character language names like “c”, “d”, or “r”. For example, Scintillua uses “ansi_c”, “dmd”, and “rstats”, respectively.

Thanks

orbitalquark commented 1 year ago

Yeah, the note that you referenced is specifically for this issue. That documentation comes from the Scintillua project, which can serve different editors, so I didn't want to insert editor-specific descriptions as to why that caution is there.