Skip to content

Commit

Permalink
cursor up 1 is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
rsalmei committed Apr 28, 2021
1 parent 1ca9649 commit 93c919c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions alive_progress/animations/bars.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ..utils.cells import VS_15, combine_cells, fix_cells, has_wide, is_wide, join_cells, \
mark_graphemes, split_graphemes, strip_marks, to_cells
from ..utils.colors import BLUE, BLUE_BOLD, CYAN, DIM, GREEN, ORANGE, ORANGE_BOLD, RED, YELLOW_BOLD
from ..utils.terminal import clear_end, factory_cursor_up, hide_cursor, show_cursor
from ..utils.terminal import clear_end, cursor_up_1, hide_cursor, show_cursor


def bar_factory(chars=None, *, tip=None, background=None, borders=None, errors=None):
Expand Down Expand Up @@ -224,7 +224,6 @@ def animate(bar): # pragma: no cover
bar_gen = exhibit_bar(bar, 15)
hide_cursor()
try:
cursor_up_1 = factory_cursor_up(1)
while True:
rendition, percent = next(bar_gen)
print(f'\r{join_cells(rendition)}', CYAN(percent, "6.1%"))
Expand Down
3 changes: 1 addition & 2 deletions alive_progress/animations/spinner_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .utils import fix_signature
from ..utils.cells import fix_cells, is_wide, join_cells, strip_marks, to_cells
from ..utils.colors import BLUE, BLUE_BOLD, CYAN, DIM, GREEN, ORANGE, ORANGE_BOLD, RED, YELLOW_BOLD
from ..utils.terminal import clear_end, factory_cursor_up, hide_cursor, show_cursor
from ..utils.terminal import clear_end, cursor_up_1, hide_cursor, show_cursor


def spinner_controller(*, natural, skip_compiler=False):
Expand Down Expand Up @@ -337,7 +337,6 @@ def animate(spec): # pragma: no cover
cycles, frames = cycle(range(1, spec.cycles + 1)), cycle(range(1, spec.total_frames + 1))
hide_cursor()
try:
cursor_up_1 = factory_cursor_up(1)
while True:
c = next(cycles)
for i, f in enumerate(spec.runner(), 1):
Expand Down
1 change: 1 addition & 0 deletions alive_progress/utils/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ def terminal_cols(): # pragma: no cover
hide_cursor = _send_ansi_escape('?25l') # hides the cursor: CSI ? 25 l.
show_cursor = _send_ansi_escape('?25h') # shows the cursor: CSI ? 25 h.
factory_cursor_up = partial(_send_ansi_escape, 'A') # sends cursor up: CSI {x}A.
cursor_up_1 = factory_cursor_up(1)

0 comments on commit 93c919c

Please sign in to comment.