Skip to content

Commit c2dc175

Browse files
committed
Use all available width for traceback panel and code display.
1 parent 96224cf commit c2dc175

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cmd2/cmd2.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
Table,
7474
)
7575
from rich.text import Text
76+
from rich.traceback import Traceback
7677

7778
from . import (
7879
argparse_completer,
@@ -1357,12 +1358,14 @@ def pexcept(
13571358

13581359
# Only print a traceback if we're in debug mode and one exists.
13591360
if self.debug and sys.exc_info() != (None, None, None):
1360-
console.print_exception(
1361-
width=console.width,
1361+
traceback = Traceback(
1362+
width=None, # Use all available width
1363+
code_width=None, # Use all available width
13621364
show_locals=True,
13631365
max_frames=0, # 0 means full traceback.
13641366
word_wrap=True, # Wrap long lines of code instead of truncate
13651367
)
1368+
console.print(traceback)
13661369
console.print()
13671370
return
13681371

0 commit comments

Comments
 (0)