def keyboard_frame_did_change(self, frame):
        """
        This is needed to make sure the extra key row is not covered by the
        keyboard frame when it pops up.
        :param frame:
        :return:
        """
        if self.on_screen:
            if frame[3] > 0:  # when keyboard appears
                self.vks.hidden = False
                self.txts.height = self.height - frame[3]
                # Leave space for the virtual key row
                self.terminal.size = self.txts.width, self.txts.height - (self.vks.height + 8)
            else:  # when keyboard goes away
                # hide the virtual key row as well
                self.vks.hidden = True
                self.txts.height = self.height
                # Take all space as virtual key row is now hidden
                self.terminal.size = self.txts.width, self.txts.height
            # TODO: Scroll to end? may not be necessary

        This is needed to make sure the extra key row is not covered by the
        keyboard frame when it pops up.
        :param frame:
        :return:
        
system/shui/pythonista_ui.py