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

Fails for multi-byte characters #374

Open
ei14 opened this issue Jan 27, 2024 · 1 comment
Open

Fails for multi-byte characters #374

ei14 opened this issue Jan 27, 2024 · 1 comment

Comments

@ei14
Copy link

ei14 commented Jan 27, 2024

Unicode characters that exceed one byte are not treated correctly.

Minimal example

.vimrc

let g:AutoPairs = {"X": "Y", "": ""}
imap ABC 

The characters "《" and "》" are Unicode U+300A and U+300B respectively. They can be typed natively in Vim by typing <C-k><LT>+ and <C-k>>+ respectively. Other multi-byte characters will also present the bug.

Reproduction steps

  • Open Vim
  • Open insert mode (i) and type X.
    • If auto-pairs and the .vimrc are loaded correctly, the line should read XY.
  • Press <BS> to remove both the X and Y, leaving an empty buffer.
  • Type <C-k><LT>+ (Control+k, less-than symbol, then plus symbol).
    • Expected behavior: The line should read 《》.
    • Actual behavior: The line reads . The pair doesn't pair.
  • Press <BS> to clear the buffer.
  • Type ABC.
    • Expected behavior: The line should read 《》
      • By mapping ABC to and enabling recursive mapping, the character should be typed, causing auto-pairs to complete the pair.
    • Actual behavior: ERROR:
- E115: Missing single quote: 'ã                                                                                
- E116: Invalid arguments for function AutoPairsInsert('ã
+ Press ENTER or type command to continue

Tested on a fresh vim install in a newly-made Debian VM.

@LunarWatcher
Copy link

#280

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

No branches or pull requests

2 participants