gyim / vim-boxdraw

An ASCII box drawing plugin for Vim
MIT License
194 stars 18 forks source link

Proposal: support for double-lined boxes with unicode box-drawing chars (would you accept a PR for this?) #5

Open alexanderbird opened 5 years ago

alexanderbird commented 5 years ago

I'm interested in adding some new functionality, are you interested in a PR for the following?

Double-lined rectangles

Except it produces

╔════════╗
║        ║
╚════════╝

Likewise for arrow and line commands.

If you're open to it, I'll do some more work on the proposal so you can give more detailed feedback.

alexanderbird commented 5 years ago

I just did a spike of this on my account -- you can see it here: https://github.com/gyim/vim-boxdraw/compare/master...alexanderbird:patch/double-box-draw

It works find with python 3, but there are more encoding issues that need to be addressed before it would work with python 2. Probably the different utility methods would need to be made unicode-aware.

It looks like once unicode is fully supported, it wouldn't be much work to add more unicode boxes. Maybe:

gyim commented 5 years ago

Thank you for the spike, I like the idea!

I'd like to support both Python 2 and 3 so that it will work out-of-the-box with system Python for most users. So far I only concentrated on ASCII because I primarily used the plugin to produce files for Ditaa.

Maybe the best way would be to use stdin in binary mode (needs some Python 2/3 wizardy), and pass the file encoding explicitly to the script. This way even non-UTF8 files could be supported, and the character positions would be handled correctly.