Index: packages/Python/lldbsuite/test/functionalities/print/TestPrintEmptyExpressionList.py =================================================================== --- /dev/null +++ packages/Python/lldbsuite/test/functionalities/print/TestPrintEmptyExpressionList.py @@ -0,0 +1,35 @@ +"""Test printing an empty list of expressions""" + +from __future__ import print_function + +import os +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +class PrintEmptyExpressionListCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + def test_print_empty_list_expressions(self): + """Test printing an empty list of expressions""" + import pexpect + prompt = "(lldb) " + + # This is so the child is torn down after the test. + self.child = pexpect.spawn( + "%s %s" % + (lldbtest_config.lldbExec, self.lldbOption)) + child = self.child + + # Turn on logging to see what the child sends back. + if self.TraceOn(): + child.logfile_read = sys.stdout + + # We expect a prompt, then send "print" to start a list of expressions, + # then an empty line. We expect a prompt back. + child.expect_exact(prompt) + child.sendline("print") + child.sendline("\n") + child.expect_exact(prompt) Index: source/Host/common/Editline.cpp =================================================================== --- source/Host/common/Editline.cpp +++ source/Host/common/Editline.cpp @@ -367,7 +367,7 @@ if (to == CursorLocation::EditingCursor) { toColumn = editline_cursor_position - (editline_cursor_row * m_terminal_width) + 1; - } else if (to == CursorLocation::BlockEnd) { + } else if (to == CursorLocation::BlockEnd && !m_input_lines.empty()) { toColumn = ((m_input_lines[m_input_lines.size() - 1].length() + GetPromptWidth()) % 80) +