From 55ac0eef453bc2cd2a3164b40612907de7b15a57 Mon Sep 17 00:00:00 2001 From: Tatamis <80774326+Tatamis@users.noreply.github.com> Date: Thu, 17 Sep 2026 18:29:46 +0300 Subject: [PATCH] fix: ConsoleRender.height reads terminal.width instead of terminal.height The height property returned self.terminal.width, so height and width were always identical. This breaks anything that positions output relative to the bottom of the terminal using self.terminal.location(), such as render_in_bottombar(), which can end up writing to a row outside the terminal and never showing the message. Fixes #164 --- src/inquirer/render/console/__init__.py | 2 +- tests/integration/console_render/test_basic.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/inquirer/render/console/__init__.py b/src/inquirer/render/console/__init__.py index 70ed6685..ade888c8 100644 --- a/src/inquirer/render/console/__init__.py +++ b/src/inquirer/render/console/__init__.py @@ -185,4 +185,4 @@ def width(self): @property def height(self): - return self.terminal.width or 24 + return self.terminal.height or 24 diff --git a/tests/integration/console_render/test_basic.py b/tests/integration/console_render/test_basic.py index 37bc2358..9c09cef6 100644 --- a/tests/integration/console_render/test_basic.py +++ b/tests/integration/console_render/test_basic.py @@ -1,4 +1,5 @@ import unittest +from unittest.mock import MagicMock import inquirer.errors as errors import inquirer.questions as questions @@ -13,3 +14,10 @@ def test_rendering_erroneous_type(self): sut = ConsoleRender() with self.assertRaises(errors.UnknownQuestionTypeError): sut.render(question) + + def test_height_uses_terminal_height_not_width(self): + sut = ConsoleRender() + sut.terminal = MagicMock(width=123, height=45) + + self.assertEqual(sut.height, 45) + self.assertEqual(sut.width, 123)