Summary: The comment in the Editine.h header made it sound like editline was just unable to handle terminal resizing. We were not ever telling editline that the terminal had changed size, which might explain why it wasn't working. This patch threads a `TerminalSizeChanged()` callback through the IOHandler and invokes it from the SIGWINCH handler in the driver. Our `Editline` class already had a `TerminalSizeChanged()` method which was invoked only when editline was configured. This patch also changes `Editline` to not apply the changes right away in `TerminalSizeChanged()`, but instead defer that to the next character read. During my testing, it happened once that the signal was received while our `ConnectionFileDescriptor::Read` was allocating memory. As `el_resize` seems to allocate memory too, this crashed. Reviewers: labath, teemperor Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D79654
37 lines
986 B
Python
37 lines
986 B
Python
"""
|
|
Test resizing in our IOHandlers.
|
|
"""
|
|
|
|
import os
|
|
|
|
import lldb
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
from lldbsuite.test.lldbpexpect import PExpectTest
|
|
|
|
class IOHandlerCompletionTest(PExpectTest):
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
|
|
# PExpect uses many timeouts internally and doesn't play well
|
|
# under ASAN on a loaded machine..
|
|
@skipIfAsan
|
|
@skipIfEditlineSupportMissing
|
|
def test_resize(self):
|
|
|
|
# Start with a small window
|
|
self.launch(dimensions=(10,10))
|
|
|
|
self.child.send("his is a long sentence missing its first letter.")
|
|
|
|
# Now resize to something bigger
|
|
self.child.setwinsize(100,500)
|
|
|
|
# Hit "left" 60 times (to go to the beginning of the line) and insert
|
|
# a character.
|
|
self.child.send(60 * "\033[D")
|
|
self.child.send("T")
|
|
|
|
self.child.expect_exact("(lldb) This is a long sentence missing its first letter.")
|
|
self.quit()
|