vim-boxdraw icon indicating copy to clipboard operation
vim-boxdraw copied to clipboard

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

Open alexanderbird opened this issue 6 years ago • 2 comments

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

Double-lined rectangles

  • +d is like +o
  • +D is like +O

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 avatar Feb 04 '19 21:02 alexanderbird

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:

  • +ud ("unicode double") for ╔═════╗
  • +us ("unicode single") for ┌───┐
  • +uh ("unicode heavy") for ┏━━┓
  • +ua ("unicode dAshed") for ┌╌╌╌╌╌┐

alexanderbird avatar Feb 05 '19 16:02 alexanderbird

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.

gyim avatar Feb 13 '19 08:02 gyim