Repository: Qiskit/qiskit

Issue:
text circuit drawer draws some boxes loooong
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues -->

### Information

- **Qiskit Terra version**: master
- **Python version**: 3.6
- **Operating system**: MacOs

### What is the current behavior?

```
qr = QuantumRegister(3)
circuit = QuantumCircuit(qr)
circuit.h(qr[0])
circuit.u1(0.0000001, qr[2])

print(circuit)
```
```
         ┌───────────┐
q0_0: |0>┤     H     ├
         └───────────┘
q0_1: |0>─────────────
         ┌───────────┐
q0_2: |0>┤ U1(1e-07) ├
         └───────────┘
```

### What is the expected behavior?
```
            ┌───┐
q0_0: |0>───┤ H ├─────
            └───┘
q0_1: |0>─────────────
         ┌───────────┐
q0_2: |0>┤ U1(1e-07) ├
         └───────────┘
```



Discussion:
For the record, this isn't a problem in Python 3.7.2. Wasn't able to reproduce it on my system.


@aasfaw are you using master code?
@1ucian0 yes, using master. 

Resolving patch:
diff --git a/qiskit/visualization/circuit_visualization.py b/qiskit/visualization/circuit_visualization.py
--- a/qiskit/visualization/circuit_visualization.py
+++ b/qiskit/visualization/circuit_visualization.py
@@ -282,7 +282,7 @@ def qx_color_scheme():
 
 
 def _text_circuit_drawer(circuit, filename=None, line_length=None, reverse_bits=False,
-                         plotbarriers=True, justify=None):
+                         plotbarriers=True, justify=None, vertically_compressed=True):
     """
     Draws a circuit using ascii art.
     Args:
@@ -297,6 +297,8 @@ def _text_circuit_drawer(circuit, filename=None, line_length=None, reverse_bits=
         plotbarriers (bool): Draws the barriers when they are there.
         justify (str) : `left`, `right` or `none`. Defaults to `left`. Says how
                         the circuit should be justified.
+        vertically_compressed (bool): Default is `True`. It merges the lines so the
+                                      drawing will take less vertical room.
     Returns:
         TextDrawing: An instances that, when printed, draws the circuit in ascii art.
     """
@@ -306,6 +308,7 @@ def _text_circuit_drawer(circuit, filename=None, line_length=None, reverse_bits=
     text_drawing = _text.TextDrawing(qregs, cregs, ops)
     text_drawing.plotbarriers = plotbarriers
     text_drawing.line_length = line_length
+    text_drawing.vertically_compressed = vertically_compressed
 
     if filename:
         text_drawing.dump(filename)
diff --git a/qiskit/visualization/text.py b/qiskit/visualization/text.py
--- a/qiskit/visualization/text.py
+++ b/qiskit/visualization/text.py
@@ -25,44 +25,46 @@ def __init__(self, label=None):
         self.top_format = self.mid_format = self.bot_format = "%s"
         self.top_connect = self.bot_connect = " "
         self.top_pad = self._mid_padding = self.bot_pad = " "
+        self.mid_bck = self.top_bck = self.bot_bck = " "
         self.bot_connector = {}
         self.top_connector = {}
-        self.right_fill = self.left_fill = 0
+        self.right_fill = self.left_fill = self.layer_width = 0
         self.wire_label = ""
 
     @property
     def top(self):
         """ Constructs the top line of the element"""
         ret = self.top_format % self.top_connect.center(
-            self.width - self.left_fill - self.right_fill, self.top_pad)
+            self.width, self.top_pad)
         if self.right_fill:
             ret = ret.ljust(self.right_fill, self.top_pad)
         if self.left_fill:
             ret = ret.rjust(self.left_fill, self.top_pad)
-
+        ret = ret.center(self.layer_width, self.top_bck)
         return ret
 
     @property
     def mid(self):
         """ Constructs the middle line of the element"""
         ret = self.mid_format % self.mid_content.center(
-            self.width - self.left_fill - self.right_fill, self._mid_padding)
+            self.width, self._mid_padding)
         if self.right_fill:
             ret = ret.ljust(self.right_fill, self._mid_padding)
         if self.left_fill:
             ret = ret.rjust(self.left_fill, self._mid_padding)
+        ret = ret.center(self.layer_width, self.mid_bck)
         return ret
 
     @property
     def bot(self):
         """ Constructs the bottom line of the element"""
         ret = self.bot_format % self.bot_connect.center(
-            self.width - self.left_fill - self.right_fill, self.bot_pad)
+            self.width, self.bot_pad)
         if self.right_fill:
             ret = ret.ljust(self.right_fill, self.bot_pad)
         if self.left_fill:
             ret = ret.rjust(self.left_fill, self.bot_pad)
-
+        ret = ret.center(self.layer_width, self.bot_bck)
         return ret
 
     @property
@@ -70,12 +72,6 @@ def length(self):
         """ Returns the length of the element, including the box around."""
         return max(len(self.top), len(self.mid), len(self.bot))
 
-    @length.setter
-    def length(self, value):
-        """ Adjusts width so the length fits."""
-        self.width = value - max(
-            [len(getattr(self, i) % '') for i in ["bot_format", "mid_format", "top_format"]])
-
     @property
     def width(self):
         """ Returns the width of the label, including padding"""
@@ -108,9 +104,9 @@ def connect(self, wire_char, where, label=None):
 
 class BoxOnClWire(DrawElement):
     """ Draws a box on the classical wire
-        top: ┌───┐ ┌───────┐
-        mid: ╡ A ╞ ╡   A   ╞
-        bot: └───┘ └───────┘
+        top: ┌───┐   ┌───┐
+        mid: ╡ A ╞ ══╡ A ╞══
+        bot: └───┘   └───┘
     """
 
     def __init__(self, label="", top_connect='─', bot_connect='─'):
@@ -119,6 +115,7 @@ def __init__(self, label="", top_connect='─', bot_connect='─'):
         self.mid_format = "╡ %s ╞"
         self.bot_format = "└─%s─┘"
         self.top_pad = self.bot_pad = '─'
+        self.mid_bck = '═'
         self.top_connect = top_connect
         self.bot_connect = bot_connect
         self.mid_content = label
@@ -126,9 +123,9 @@ def __init__(self, label="", top_connect='─', bot_connect='─'):
 
 class BoxOnQuWire(DrawElement):
     """ Draws a box on the quantum wire
-        top: ┌───┐ ┌───────┐
-        mid: ┤ A ├ ┤   A   ├
-        bot: └───┘ └───────┘
+        top: ┌───┐   ┌───┐
+        mid: ┤ A ├ ──┤ A ├──
+        bot: └───┘   └───┘
     """
 
     def __init__(self, label="", top_connect='─', bot_connect='─'):
@@ -136,7 +133,7 @@ def __init__(self, label="", top_connect='─', bot_connect='─'):
         self.top_format = "┌─%s─┐"
         self.mid_format = "┤ %s ├"
         self.bot_format = "└─%s─┘"
-        self.top_pad = self.bot_pad = '─'
+        self.top_pad = self.bot_pad = self.mid_bck = '─'
         self.top_connect = top_connect
         self.bot_connect = bot_connect
         self.mid_content = label
@@ -156,7 +153,7 @@ def __init__(self):
         self.top_connect = " ║ "
         self.mid_content = "═╩═"
         self.bot_connect = "   "
-        self._mid_padding = "═"
+        self.mid_bck = "═"
 
 
 class MeasureFrom(BoxOnQuWire):
@@ -198,6 +195,13 @@ def center_label(self, input_length, order):
             else:
                 self.bot_connect = self.label
 
+    @property
+    def width(self):
+        """ Returns the width of the label, including padding"""
+        if self._width:
+            return self._width
+        return len(self.label)
+
 
 class BoxOnQuWireTop(MultiBox, BoxOnQuWire):
     """ Draws the top part of a box that affects more than one quantum wire"""
@@ -207,9 +211,10 @@ def __init__(self, label="", top_connect=None, wire_label=''):
         self.wire_label = wire_label
         self.bot_connect = self.bot_pad = " "
         self.mid_content = ""  # The label will be put by some other part of the box.
-        self.top_format = "┌{}─%s─┐".format(self.top_pad * len(self.wire_label))
+        self.left_fill = len(self.wire_label)
+        self.top_format = "┌{}─%s─┐".format(self.top_pad * self.left_fill)
         self.mid_format = "┤{} %s ├".format(self.wire_label)
-        self.bot_format = "│{} %s │".format(self.bot_pad * len(self.wire_label))
+        self.bot_format = "│{} %s │".format(self.bot_pad * self.left_fill)
         self.top_connect = top_connect if top_connect else '─'
 
 
@@ -220,9 +225,10 @@ def __init__(self, label, input_length, order, wire_label=''):
         super().__init__(label)
         self.top_pad = self.bot_pad = self.top_connect = self.bot_connect = " "
         self.wire_label = wire_label
-        self.top_format = "│{} %s │".format(self.top_pad * len(self.wire_label))
+        self.left_fill = len(self.wire_label)
+        self.top_format = "│{} %s │".format(self.top_pad * self.left_fill)
         self.mid_format = "┤{} %s ├".format(self.wire_label)
-        self.bot_format = "│{} %s │".format(self.bot_pad * len(self.wire_label))
+        self.bot_format = "│{} %s │".format(self.bot_pad * self.left_fill)
         self.top_connect = self.bot_connect = self.mid_content = ''
         self.center_label(input_length, order)
 
@@ -234,9 +240,10 @@ def __init__(self, label, input_length, bot_connect='─', wire_label=''):
         super().__init__(label)
         self.wire_label = wire_label
         self.top_pad = " "
-        self.top_format = "│{} %s │".format(self.top_pad * len(self.wire_label))
+        self.left_fill = len(self.wire_label)
+        self.top_format = "│{} %s │".format(self.top_pad * self.left_fill)
         self.mid_format = "┤{} %s ├".format(self.wire_label)
-        self.bot_format = "└{}─%s─┘".format(self.bot_pad * len(self.wire_label))
+        self.bot_format = "└{}─%s─┘".format(self.bot_pad * self.left_fill)
         self.bot_connect = bot_connect
 
         self.mid_content = self.top_connect = ""
@@ -345,6 +352,7 @@ def __init__(self, top_connect="", bot_connect=""):
         super().__init__('■')
         self.top_connect = top_connect
         self.bot_connect = bot_connect
+        self.mid_bck = '─'
 
 
 class EmptyWire(DrawElement):
@@ -352,7 +360,7 @@ class EmptyWire(DrawElement):
 
     def __init__(self, wire):
         super().__init__(wire)
-        self._mid_padding = wire
+        self._mid_padding = self.mid_bck = wire
 
     @staticmethod
     def fillup_layer(layer, first_clbit):
@@ -424,13 +432,14 @@ class TextDrawing():
     """ The text drawing"""
 
     def __init__(self, qregs, cregs, instructions, plotbarriers=True,
-                 line_length=None):
+                 line_length=None, vertically_compressed=True):
         self.qregs = qregs
         self.cregs = cregs
         self.instructions = instructions
 
         self.plotbarriers = plotbarriers
         self.line_length = line_length
+        self.vertically_compressed = vertically_compressed
 
     def __str__(self):
         return self.single_string()
@@ -534,7 +543,7 @@ def lines(self, line_length=None):
         lines = []
         for layer_group in layer_groups:
             wires = [i for i in zip(*layer_group)]
-            lines += TextDrawing.draw_wires(wires)
+            lines += TextDrawing.draw_wires(wires, self.vertically_compressed)
 
         return lines
 
@@ -561,12 +570,13 @@ def wire_names(self, with_initial_value=True):
         return qubit_labels + clbit_labels
 
     @staticmethod
-    def draw_wires(wires):
+    def draw_wires(wires, vertically_compressed=True):
         """
         Given a list of wires, creates a list of lines with the text drawing.
         Args:
             wires (list): A list of wires with instructions.
-
+            vertically_compressed (bool): Default is `True`. It merges the lines
+                                     so the drawing will take less vertical room.
         Returns:
             list: A list of lines with the text drawing.
         """
@@ -581,16 +591,19 @@ def draw_wires(wires):
             if bot_line is None:
                 lines.append(top_line)
             else:
-                lines.append(TextDrawing.merge_lines(lines.pop(), top_line))
+                if vertically_compressed:
+                    lines.append(TextDrawing.merge_lines(lines.pop(), top_line))
+                else:
+                    lines.append(TextDrawing.merge_lines(lines[-1], top_line, icod="bot"))
 
             # MID
-            mid_line = ""
+            mid_line = ''
             for instruction in wire:
                 mid_line += instruction.mid
             lines.append(TextDrawing.merge_lines(lines[-1], mid_line, icod="bot"))
 
             # BOT
-            bot_line = ""
+            bot_line = ''
             for instruction in wire:
                 bot_line += instruction.bot
             lines.append(TextDrawing.merge_lines(lines[-1], bot_line, icod="bot"))
@@ -643,13 +656,17 @@ def merge_lines(top, bot, icod="top"):
                 ret += "│"
             elif topc == " ":
                 ret += botc
-            elif topc in '┬╥' and botc in " ║│":
+            elif topc in '┬╥' and botc in " ║│" and icod == "top":
                 ret += topc
+            elif topc in '┬' and botc == " " and icod == "bot":
+                ret += '│'
+            elif topc in '╥' and botc == " " and icod == "bot":
+                ret += '║'
             elif topc in '┬│' and botc == "═":
                 ret += '╪'
             elif topc in '┬│' and botc == "─":
                 ret += '┼'
-            elif topc in '└┘║│░' and botc == " ":
+            elif topc in '└┘║│░' and botc == " " and icod == "top":
                 ret += topc
             elif topc in '─═' and botc == " " and icod == "top":
                 ret += topc
@@ -665,8 +682,10 @@ def merge_lines(top, bot, icod="top"):
                 ret += "├"
             elif topc == '┘' and botc == "┐":
                 ret += "┤"
-            elif botc in "┐┌":
+            elif botc in "┐┌" and icod == 'top':
                 ret += "┬"
+            elif topc in "┘└" and botc in "─" and icod == 'top':
+                ret += "┴"
             else:
                 ret += botc
         return ret
@@ -681,7 +700,7 @@ def normalize_width(layer):
         instructions = [instruction for instruction in filter(lambda x: x is not None, layer)]
         longest = max([instruction.length for instruction in instructions])
         for instruction in instructions:
-            instruction.length = longest
+            instruction.layer_width = longest
 
     def _instruction_to_gate(self, instruction, layer):
         """ Convert an instruction into its corresponding Gate object, and establish
@@ -903,7 +922,7 @@ def _set_multibox(self, wire_type, bits, label, top_connect=None):
                     wire_label = qargs.pop(0)
                 else:
                     named_bit = (self.qregs + self.cregs)[bit_i]
-                    wire_label = ''
+                    wire_label = ' ' * len(qargs[0])
                 set_bit(named_bit, BoxOnWireMid(label, box_height, order, wire_label=wire_label))
             set_bit(bits.pop(0), BoxOnWireBot(label, box_height, wire_label=qargs.pop(0)))
 


Test patch:
diff --git a/test/python/visualization/references/text_ref.txt b/test/python/visualization/references/text_ref.txt
--- a/test/python/visualization/references/text_ref.txt
+++ b/test/python/visualization/references/text_ref.txt
@@ -1,9 +1,9 @@
         ┌───┐┌───┐┌───┐ ░ ┌───┐┌───┐┌─────┐┌───┐┌─────┐┌────┐     ┌────────────┐┌────────────┐┌────────────┐┌────────────┐┌────────────┐┌───────────────────┐┌──────────────────────────┐                                                                                ┌─┐      
 q_0: |0>┤ X ├┤ Y ├┤ Z ├─░─┤ H ├┤ S ├┤ Sdg ├┤ T ├┤ Tdg ├┤ Id ├─|0>─┤ Rx(3.1416) ├┤ Ry(3.1416) ├┤ Rz(3.1416) ├┤ U0(3.1416) ├┤ U1(3.1416) ├┤ U2(3.1416,3.1416) ├┤ U3(3.1416,3.1416,3.1416) ├─X───■────■───■───■───■────────────────────■────────────────────■─────────■───■─┤M├──────
         └─░─┘└───┘└───┘ ░ └───┘└───┘└─────┘└───┘└─────┘└────┘     └────────────┘└────────────┘└────────────┘└────────────┘└────────────┘└───────────────────┘└──────────────────────────┘ │ ┌─┴─┐┌─┴─┐ │ ┌─┴─┐ │3.1416 ┌────────────┴─────────────┐┌─────┴──────┐  │   │ └╥┘┌─┐   
-q_1: |0>──░───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────X─┤ X ├┤ Y ├─■─┤ H ├─■───────┤ U3(3.1416,3.1416,3.1416) ├┤ Rz(3.1416) ├──■───X──╫─┤M├───
+q_1: |0> ─░─ ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────X─┤ X ├┤ Y ├─■─┤ H ├─■───────┤ U3(3.1416,3.1416,3.1416) ├┤ Rz(3.1416) ├──■───X──╫─┤M├───
           ░                                                                                                                                                                                 └───┘└───┘   └───┘         └──────────────────────────┘└────────────┘┌─┴─┐ │  ║ └╥┘┌─┐
-q_2: |0>──░──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ X ├─X──╫──╫─┤M├
+q_2: |0> ─░─ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ X ├─X──╫──╫─┤M├
           ░                                                                                                                                                                                                                                                      └───┘    ║  ║ └╥┘
  c_0: 0 ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╩══╬══╬═
                                                                                                                                                                                                                                                                              ║  ║ 
diff --git a/test/python/visualization/test_circuit_text_drawer.py b/test/python/visualization/test_circuit_text_drawer.py
--- a/test/python/visualization/test_circuit_text_drawer.py
+++ b/test/python/visualization/test_circuit_text_drawer.py
@@ -539,13 +539,14 @@ def test_text_conditional_1(self):
         if(c0==1) x q[0];
         if(c1==1) x q[0];
         """
-        expected = '\n'.join(["        ┌─────┐┌─────┐",
-                              "q_0: |0>┤  X  ├┤  X  ├",
-                              "        ├──┴──┤└──┬──┘",
+        expected = '\n'.join(["         ┌───┐  ┌───┐ ",
+                              "q_0: |0>─┤ X ├──┤ X ├─",
+                              "        ┌┴─┴─┴┐ └─┬─┘ ",
                               "c0_0: 0 ╡ = 1 ╞═══╪═══",
                               "        └─────┘┌──┴──┐",
                               "c1_0: 0 ═══════╡ = 1 ╞",
                               "               └─────┘"])
+
         circuit = QuantumCircuit.from_qasm_str(qasm_string)
         self.assertEqual(str(_text_circuit_drawer(circuit)), expected)
 
@@ -560,9 +561,9 @@ def test_text_conditional_2(self):
         if(c0==2) x q[0];
         if(c1==2) x q[0];
         """
-        expected = '\n'.join(["        ┌─────┐┌─────┐",
-                              "q_0: |0>┤  X  ├┤  X  ├",
-                              "        ├──┴──┤└──┬──┘",
+        expected = '\n'.join(["         ┌───┐  ┌───┐ ",
+                              "q_0: |0>─┤ X ├──┤ X ├─",
+                              "        ┌┴─┴─┴┐ └─┬─┘ ",
                               "c0_0: 0 ╡     ╞═══╪═══",
                               "        │ = 2 │   │   ",
                               "c0_1: 0 ╡     ╞═══╪═══",
@@ -585,9 +586,9 @@ def test_text_conditional_3(self):
         if(c0==3) x q[0];
         if(c1==3) x q[0];
         """
-        expected = '\n'.join(["        ┌─────┐┌─────┐",
-                              "q_0: |0>┤  X  ├┤  X  ├",
-                              "        ├──┴──┤└──┬──┘",
+        expected = '\n'.join(["         ┌───┐  ┌───┐ ",
+                              "q_0: |0>─┤ X ├──┤ X ├─",
+                              "        ┌┴─┴─┴┐ └─┬─┘ ",
                               "c0_0: 0 ╡     ╞═══╪═══",
                               "        │     │   │   ",
                               "c0_1: 0 ╡ = 3 ╞═══╪═══",
@@ -614,9 +615,9 @@ def test_text_conditional_4(self):
         if(c0==4) x q[0];
         if(c1==4) x q[0];
         """
-        expected = '\n'.join(["        ┌─────┐┌─────┐",
-                              "q_0: |0>┤  X  ├┤  X  ├",
-                              "        ├──┴──┤└──┬──┘",
+        expected = '\n'.join(["         ┌───┐  ┌───┐ ",
+                              "q_0: |0>─┤ X ├──┤ X ├─",
+                              "        ┌┴─┴─┴┐ └─┬─┘ ",
                               "c0_0: 0 ╡     ╞═══╪═══",
                               "        │     │   │   ",
                               "c0_1: 0 ╡     ╞═══╪═══",
@@ -647,9 +648,9 @@ def test_text_conditional_5(self):
         if(c0==5) x q[0];
         if(c1==5) x q[0];
         """
-        expected = '\n'.join(["        ┌─────┐┌─────┐",
-                              "q_0: |0>┤  X  ├┤  X  ├",
-                              "        ├──┴──┤└──┬──┘",
+        expected = '\n'.join(["         ┌───┐  ┌───┐ ",
+                              "q_0: |0>─┤ X ├──┤ X ├─",
+                              "        ┌┴─┴─┴┐ └─┬─┘ ",
                               "c0_0: 0 ╡     ╞═══╪═══",
                               "        │     │   │   ",
                               "c0_1: 0 ╡     ╞═══╪═══",
@@ -851,6 +852,24 @@ def test_text_justify_right_measure_resize(self):
         circuit.measure(qr1[1], cr1[1])
         self.assertEqual(str(_text_circuit_drawer(circuit, justify='right')), expected)
 
+    def test_text_box_length(self):
+        """The length of boxes is indepedent of other boxes in the layer
+        https://github.com/Qiskit/qiskit-terra/issues/1882"""
+        expected = '\n'.join(["             ┌───┐    ┌───┐",
+                              "q1_0: |0>────┤ H ├────┤ H ├",
+                              "             └───┘    └───┘",
+                              "q1_1: |0>──────────────────",
+                              "         ┌───────────┐     ",
+                              "q1_2: |0>┤ U1(1e-07) ├─────",
+                              "         └───────────┘     "])
+
+        qr = QuantumRegister(3, 'q1')
+        circuit = QuantumCircuit(qr)
+        circuit.h(qr[0])
+        circuit.h(qr[0])
+        circuit.u1(0.0000001, qr[2])
+        self.assertEqual(str(_text_circuit_drawer(circuit)), expected)
+
 
 class TestTextDrawerMultiQGates(QiskitTestCase):
     """ Gates impling multiple qubits."""
@@ -907,14 +926,13 @@ def test_3Qgate_cross_wires(self):
 
     def test_2Qgate_nottogether(self):
         """ 2Q that are not together """
-        expected = '\n'.join(["        ┌──────┐",
-                              "q_2: |0>┤1     ├",
-                              "        │      │",
-                              "q_1: |0>┤ twoQ ├",
-                              "        │      │",
-                              "q_0: |0>┤0     ├",
-                              "        └──────┘"])
-
+        expected = '\n'.join(["        ┌───────┐",
+                              "q_2: |0>┤1      ├",
+                              "        │       │",
+                              "q_1: |0>┤  twoQ ├",
+                              "        │       │",
+                              "q_0: |0>┤0      ├",
+                              "        └───────┘"])
         qr = QuantumRegister(3, 'q')
         circuit = QuantumCircuit(qr)
 
@@ -925,15 +943,15 @@ def test_2Qgate_nottogether(self):
 
     def test_2Qgate_nottogether_across_4(self):
         """ 2Q that are 2 bits apart"""
-        expected = '\n'.join(["        ┌──────┐",
-                              "q_3: |0>┤1     ├",
-                              "        │      │",
-                              "q_2: |0>┤      ├",
-                              "        │ twoQ │",
-                              "q_1: |0>┤      ├",
-                              "        │      │",
-                              "q_0: |0>┤0     ├",
-                              "        └──────┘"])
+        expected = '\n'.join(["        ┌───────┐",
+                              "q_3: |0>┤1      ├",
+                              "        │       │",
+                              "q_2: |0>┤       ├",
+                              "        │  twoQ │",
+                              "q_1: |0>┤       ├",
+                              "        │       │",
+                              "q_0: |0>┤0      ├",
+                              "        └───────┘"])
 
         qr = QuantumRegister(4, 'q')
         circuit = QuantumCircuit(qr)
@@ -946,6 +964,7 @@ def test_2Qgate_nottogether_across_4(self):
 
 class TestTextDrawerParams(QiskitTestCase):
     """Test drawing parameters."""
+
     def test_text_parameters_mix(self):
         """ cu3 drawing with parameters"""
         expected = '\n'.join(["                                   ",
@@ -975,5 +994,58 @@ def test_text_sympy_constant(self):
         self.assertEqual(str(_text_circuit_drawer(circuit)), expected)
 
 
+class TestTextDrawerVerticallyExtended(QiskitTestCase):
+    """Test vertically_compressed=False"""
+
+    def test_text_conditional_1(self):
+        """ Conditional drawing with 1-bit-length regs."""
+        qasm_string = """
+        OPENQASM 2.0;
+        include "qelib1.inc";
+        qreg q[1];
+        creg c0[1];
+        creg c1[1];
+        if(c0==1) x q[0];
+        if(c1==1) x q[0];
+        """
+        expected = '\n'.join(["         ┌───┐  ┌───┐ ",
+                              "q_0: |0>─┤ X ├──┤ X ├─",
+                              "         └─┬─┘  └─┬─┘ ",
+                              "        ┌──┴──┐   │   ",
+                              "c0_0: 0 ╡ = 1 ╞═══╪═══",
+                              "        └─────┘   │   ",
+                              "               ┌──┴──┐",
+                              "c1_0: 0 ═══════╡ = 1 ╞",
+                              "               └─────┘"])
+
+        circuit = QuantumCircuit.from_qasm_str(qasm_string)
+        self.assertEqual(str(_text_circuit_drawer(circuit, vertically_compressed=False)), expected)
+
+    def test_text_justify_right(self):
+        """ Drawing with right justify """
+        expected = '\n'.join(["              ┌───┐",
+                              "q1_0: |0>─────┤ X ├",
+                              "              └───┘",
+                              "         ┌───┐ ┌─┐ ",
+                              "q1_1: |0>┤ H ├─┤M├─",
+                              "         └───┘ └╥┘ ",
+                              "                ║  ",
+                              " c1_0: 0 ═══════╬══",
+                              "                ║  ",
+                              "                ║  ",
+                              " c1_1: 0 ═══════╩══",
+                              "                   "])
+
+        qr1 = QuantumRegister(2, 'q1')
+        cr1 = ClassicalRegister(2, 'c1')
+        circuit = QuantumCircuit(qr1, cr1)
+        circuit.x(qr1[0])
+        circuit.h(qr1[1])
+        circuit.measure(qr1[1], cr1[1])
+        self.assertEqual(str(_text_circuit_drawer(circuit,
+                                                  justify='right',
+                                                  vertically_compressed=False)), expected)
+
+
 if __name__ == '__main__':
     unittest.main()