v shows up and ^ #55

Open
saslani opened this Issue Feb 18, 2016 · 5 comments

Projects

None yet

6 participants

@saslani
saslani commented Feb 18, 2016

I tried to import:
expected

but got:
actual

@iisfaq
iisfaq commented Mar 25, 2016

I have seen this too. I think that the v is used as a Vertical Line in the lines mode as that is what it draws in that mode. But in ascii mode is really should display as a v.

You will notice it is also colored the same as a line segment (silver) and not white.

@bitblitz

Thanks for AsciiFlow - great tool!

+1 for this bug. A 'v' that is not next to a line character can also generate this, but doesn't always.

For example, I had

Drives
Via
IFoobarInterface

in a text block off to the right of a diagram and got

Dri^es
Via
IFoobarInterface

But doesn't always seem to happen. Not sure why it does sometimes and not others.

@dundeemt

/dev/ad0 -> fine
/dev/ad1 --> /de^/ad1

change ^ back v and then it flips back again.

@fstark
fstark commented May 23, 2016 edited

Commenting line 337-339 of state.js fixed it for me.

/**
 * Loads the given text into the diagram starting at the given offset (centered).
 * @param {string} value
 * @param {ascii.Vector} offset
 */
ascii.State.prototype.fromText = function(value, offset) {
  var lines = value.split('\n');
  var middle = new ascii.Vector(0, Math.round(lines.length / 2));
  for (var j = 0; j < lines.length; j++) {
    middle.x = Math.max(middle.x, Math.round(lines[j].length / 2));
  }
  for (var j = 0; j < lines.length; j++) {
    var line = lines[j];
    for (var i = 0; i < line.length; i++) {
      var char = line.charAt(i);
      // Convert special output back to special chars.
      // TODO: This is a horrible hack, need to handle multiple special chars
      // correctly and preserve them through line drawing etc.
      if (SPECIAL_VALUES.indexOf(char)  != -1) {
        char = SPECIAL_VALUE;
      }
      // if (ALT_SPECIAL_VALUES.indexOf(char) != -1) {
      //   char = ALT_SPECIAL_VALUE;
      // }
      this.drawValue(new ascii.Vector(i, j).add(offset).subtract(middle), char);
    }
  }
};

I am not sure of what is going on, and I don't really understand why this was there in the first place...

I have a version with that code removed + an ugly fix for handling arrows(*) near lines at https://github.com/fstark/asciiflow2 , if anyone is interested.

(*) things like:

         +
         v
      +----+
      |    |
  +-->+    +<--+
      |    |
      +----+
        ^
        |
        |
        +
@fspafford

I also see this problem. And thanks for creating the tool.

@alevchuk alevchuk added a commit to alevchuk/asciiflow2 that referenced this issue Nov 23, 2016
@alevchuk alevchuk Stop coverting v's into ^'s (Closes #55) a79b9d4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment