Skip to content

Commit f32770b

Browse files
authored
Merge pull request #1758 from python-cmd2/stage3-lifecycle-integration
Stage 3: ordinary lifecycle and mode selection
2 parents 7daf145 + 0c8c09f commit f32770b

35 files changed

Lines changed: 6879 additions & 346 deletions

‎CHANGELOG.md‎

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,55 @@
11
## 4.3.0 (TBD)
22

3+
- Bug Fixes
4+
- Background output printed above an active reserved prompt through `run_in_terminal()` or
5+
`patch_stdout()` is preserved when the prompt redraws.
6+
- Reserved rendering preserves unfinished command output when the main prompt returns by
7+
starting the prompt on a fresh line. Trailing control sequences do not count as unfinished
8+
output, and a line another program finished during a terminal handoff is not given an extra
9+
blank line.
10+
- Falling back from reserved rendering during a command restores the native toolbar layout and
11+
stdout proxy, so a recovered toolbar remains visible during the command, including when the
12+
fallback happens while the command has handed the terminal to another program or while the
13+
built-in pager is open. A fallback during paging no longer flashes the command output through
14+
the pager, and the pager's exit restores the display even if that exit fails.
15+
- Resuming the reserved command display after a terminal handoff preserves the cursor column of
16+
unfinished guest output, so later command output continues the same line.
17+
- A reserved toolbar started in a terminal below the minimum height now activates when the
18+
terminal grows, including during a quiet command.
19+
- Reserved bottom toolbars now indicate clipped content with a right-edge ellipsis (`…`). Long
20+
lines are truncated without wrapping, and newlines beyond the reserved row are indicated
21+
instead of silently hiding content, including when the first line is empty. Trailing
22+
whitespace and a trailing newline are not marked, since nothing visible is lost.
23+
- Reserved bottom toolbars display control characters in caret notation, as legacy rendering
24+
does, instead of sending them to the terminal.
25+
- Resizing the terminal while a reserved toolbar is active now reinstalls the reserved rows for
26+
the new size and repaints the toolbar at the new bottom row, instead of leaving the renderer
27+
wrapping to the old width. A stale toolbar is no longer left behind when the terminal grows.
28+
- Command output that does not end in a newline (for example a progress line updated with a
29+
carriage return) is no longer erased by a reserved toolbar's redraw, its shutdown, or a
30+
terminal resize. The line in progress is preserved and the next write continues it. When
31+
shrinking leaves that line in the rows the toolbar takes, the line and its cursor are moved up
32+
into the usable region before the toolbar is painted.
33+
- Reserved rendering is no longer left suppressed, and the main prompt invisible, when a
34+
terminal that shrank below the two-row minimum during a command grows back afterward.
35+
- The built-in pager (used by `Cmd.ppaged()`) again displays its content in reserved toolbar
36+
mode. It had rendered nothing while still accepting its keys, because the command display's
37+
renderer frames were being suppressed.
38+
- Command output that does not end in a newline is no longer erased when a command finishes in
39+
reserved toolbar mode. The command display's shutdown had cleared the line still in progress.
40+
- Resizing the terminal during a quiet command is now detected on its own, through
41+
prompt-toolkit's terminal-size poll, instead of only when another event forces a redraw.
42+
- Growing the terminal back after it had shrunk below the two-row minimum now reacquires the
43+
reserved rows. A 24-to-2-to-24 resize sequence had left reserved rendering inactive.
44+
45+
- Breaking Changes
46+
- Replaced `enable_bottom_toolbar` with `bottom_toolbar_mode` in `Cmd.__init__()`. The default,
47+
`cmd2.ToolbarMode.OFF`, disables the toolbar. Use `cmd2.ToolbarMode.AUTO` where you previously
48+
passed `enable_bottom_toolbar=True`.
49+
350
- Enhancements
4-
- `enable_bottom_toolbar=True` now keeps the toolbar visible and refreshing during command
5-
execution
51+
- `bottom_toolbar_mode=cmd2.ToolbarMode.AUTO` now keeps the toolbar visible and refreshing
52+
during command execution
653
- `Cmd.read_input()` and `Cmd.read_secret()` now keep the bottom toolbar visible while they wait
754
for input, refreshing at the same `refresh_interval` as the main prompt, instead of the
855
toolbar disappearing for the duration of the nested prompt. `Cmd.select()` is unchanged, since

‎cmd2/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
reset_theme,
6565
update_theme,
6666
)
67+
from .toolbar_mode import ToolbarMode
6768
from .utils import (
6869
CustomCompletionSettings,
6970
Settable,
@@ -120,6 +121,7 @@
120121
"stylize",
121122
# Styles
122123
"Cmd2Style",
124+
"ToolbarMode",
123125
# Theme
124126
"get_theme",
125127
"reset_theme",

0 commit comments

Comments
 (0)