diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1581,10 +1581,19 @@ def layout(mode): maxy, maxx = stdscr.getmaxyx() helplen = len(helplines(mode)) + mainlen = maxy - helplen - 12 + if mainlen < 1: + raise error.Abort( + _(b"terminal dimensions %d by %d too small for curses histedit") + % (maxy, maxx), + hint=_( + b"enlarge your terminal or use --config ui.interface=text" + ), + ) return { b'commit': (12, maxx), b'help': (helplen, maxx), - b'main': (maxy - helplen - 12, maxx), + b'main': (mainlen, maxx), } def drawvertwin(size, y, x):