jbyuki / venn.nvim

Draw ASCII diagrams in Neovim
MIT License
967 stars 21 forks source link

Support crossings #3

Closed AckslD closed 3 years ago

AckslD commented 3 years ago

Currently if you draw a line over another it replaces any existing characters such as:

                   ▲
                   │
     ┌──────┐  │   │
     │      ├──│───┘
     └──────┘  │
               ▼

which in some cases might be desirable but it would also be great to get the crossing characters such as .

If #2 is implemented there might be more crossings to consider.

jbyuki commented 3 years ago

This is already possible in 2 steps.

  │
  ▼
─────►

Elongate the upper arrow to the horizontal arrow.

  │
  │
──┴──►

Elongate from the crossing.

  │
  │
──┼──►
  ▼

Does that help? I would be happy to discuss it. Like you said, sometimes or ─│─ is desirable which the current implementation allows you to do both.

AckslD commented 3 years ago

Yes, awesome! Thanks for the help!

AckslD commented 3 years ago

@jbyuki Is it also possible to do this on some nice ways for boxes also?

For example if I want to draw the following:

┌┬┐
└┴┘

or similar

jbyuki commented 3 years ago

I would also do it in 2 steps:

┌─┐
└─┘

Draw the outline of the box.

┌┬┐
└┴┘

Draw a line vertically which cuts the box in half. The arrow disappears because the end is automatically merged. The character which is at the end of the line and the direction of the line determines the merged glyph.

Horizontally it's also possible of course:

┌┐
├┤
└┘

How is that for a nice way?

AckslD commented 3 years ago

Thanks for your reply @jbyuki! Maybe the example was not the best but I sometimes notice that I want to have crossings between boxes, without having to draw all of the sides of the boxes manually. A better example is probably:

What I get:

     ┌────┐
  ┌──│──┐ │
  │  └────┘
  │     │
  └─────┘

What I want:

     ┌────┐
  ┌──┼──┐ │
  │  └──┼─┘
  │     │
  └─────┘
jbyuki commented 3 years ago

Crossings variation of commands can be invoked with VBoxO, VBoxDO, VBoxHO.

It also supports crossings between line types (double, heavy) but double - heavy is not in the unicode box drawing character set so this is the only exception which doesn't work.

Let's see how well it's working!

AckslD commented 3 years ago

Works great @jbyuki :+1: