467 _drawendinglines(lines, extra_interline, edgemap, seen, state) |
467 _drawendinglines(lines, extra_interline, edgemap, seen, state) |
468 |
468 |
469 while len(text) < len(lines): |
469 while len(text) < len(lines): |
470 text.append("") |
470 text.append("") |
471 |
471 |
472 if any(len(char) > 1 for char in edgemap.values()): |
|
473 # limit drawing an edge to the first or last N lines of the current |
|
474 # section the rest of the edge is drawn like a parent line. |
|
475 parent = state['styles'][PARENT][-1:] |
|
476 def _drawgp(char, i): |
|
477 # should a grandparent character be drawn for this line? |
|
478 if len(char) < 2: |
|
479 return True |
|
480 num = int(char[:-1]) |
|
481 # either skip first num lines or take last num lines, based on sign |
|
482 return -num <= i if num < 0 else (len(lines) - i) <= num |
|
483 for i, line in enumerate(lines): |
|
484 line[:] = [c[-1:] if _drawgp(c, i) else parent for c in line] |
|
485 edgemap.update( |
|
486 (e, (c if len(c) < 2 else parent)) for e, c in edgemap.items()) |
|
487 |
|
488 # print lines |
472 # print lines |
489 indentation_level = max(ncols, ncols + coldiff) |
473 indentation_level = max(ncols, ncols + coldiff) |
490 lines = ["%-*s " % (2 * indentation_level, "".join(line)) for line in lines] |
474 lines = ["%-*s " % (2 * indentation_level, "".join(line)) for line in lines] |
491 outputgraph(ui, zip(lines, text)) |
475 outputgraph(ui, zip(lines, text)) |
492 |
476 |