pyallel 1.3.5__tar.gz → 1.3.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyallel-1.3.5 → pyallel-1.3.6}/PKG-INFO +1 -1
- {pyallel-1.3.5 → pyallel-1.3.6}/pyproject.toml +1 -1
- {pyallel-1.3.5 → pyallel-1.3.6}/src/pyallel/printer.py +33 -15
- {pyallel-1.3.5 → pyallel-1.3.6}/LICENSE +0 -0
- {pyallel-1.3.5 → pyallel-1.3.6}/README.md +0 -0
- {pyallel-1.3.5 → pyallel-1.3.6}/src/pyallel/__init__.py +0 -0
- {pyallel-1.3.5 → pyallel-1.3.6}/src/pyallel/colours.py +0 -0
- {pyallel-1.3.5 → pyallel-1.3.6}/src/pyallel/constants.py +0 -0
- {pyallel-1.3.5 → pyallel-1.3.6}/src/pyallel/errors.py +0 -0
- {pyallel-1.3.5 → pyallel-1.3.6}/src/pyallel/main.py +0 -0
- {pyallel-1.3.5 → pyallel-1.3.6}/src/pyallel/parser.py +0 -0
- {pyallel-1.3.5 → pyallel-1.3.6}/src/pyallel/process.py +0 -0
- {pyallel-1.3.5 → pyallel-1.3.6}/src/pyallel/process_group.py +0 -0
- {pyallel-1.3.5 → pyallel-1.3.6}/src/pyallel/process_group_manager.py +0 -0
- {pyallel-1.3.5 → pyallel-1.3.6}/src/pyallel/py.typed +0 -0
|
@@ -298,18 +298,18 @@ class InteractiveConsolePrinter(ConsolePrinter):
|
|
|
298
298
|
|
|
299
299
|
def print(self, process_group_manager: ProcessGroupManager) -> None:
|
|
300
300
|
output = process_group_manager.get_cur_process_group_output()
|
|
301
|
-
self.
|
|
301
|
+
self.print_process_group_output(output, process_group_manager._interrupt_count)
|
|
302
302
|
|
|
303
303
|
poll = process_group_manager.poll()
|
|
304
304
|
if poll is not None:
|
|
305
305
|
self.clear_last_printed_lines()
|
|
306
306
|
self.reset()
|
|
307
|
-
self.
|
|
307
|
+
self.print_process_group_output(
|
|
308
308
|
output, process_group_manager._interrupt_count, tail_output=False
|
|
309
309
|
)
|
|
310
310
|
self.reset()
|
|
311
311
|
|
|
312
|
-
def
|
|
312
|
+
def print_process_group_output(
|
|
313
313
|
self,
|
|
314
314
|
output: ProcessGroupOutput,
|
|
315
315
|
interrupt_count: int = 0,
|
|
@@ -318,6 +318,7 @@ class InteractiveConsolePrinter(ConsolePrinter):
|
|
|
318
318
|
columns = constants.COLUMNS()
|
|
319
319
|
self.generate_process_group_output(output, interrupt_count, tail_output)
|
|
320
320
|
|
|
321
|
+
num_lines_to_print = len(self._to_print)
|
|
321
322
|
num_last_printed_lines = len(self._last_printed)
|
|
322
323
|
|
|
323
324
|
# If we don't have any last printed lines or we don't want to tail the output,
|
|
@@ -333,25 +334,42 @@ class InteractiveConsolePrinter(ConsolePrinter):
|
|
|
333
334
|
# Move the cursor up the amount the lines that were last printed so we can start
|
|
334
335
|
# comparing the last printed lines with the new lines that were generated
|
|
335
336
|
print(f"\033[{num_last_printed_lines}A", end="")
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if i >= num_last_printed_lines:
|
|
339
|
-
include_prefix, line, end = line_parts
|
|
340
|
-
self.write(
|
|
341
|
-
line, include_prefix, end, truncate=tail_output, columns=columns
|
|
342
|
-
)
|
|
337
|
+
cursor_line = 0
|
|
338
|
+
for cur_line, line_parts in enumerate(self._last_printed):
|
|
343
339
|
# If the current line is not the same as it's newly generated version, we update the line
|
|
344
|
-
|
|
345
|
-
include_prefix, line, end =
|
|
340
|
+
if line_parts[1] != self._to_print[cur_line][1]:
|
|
341
|
+
include_prefix, line, end = self._to_print[cur_line]
|
|
342
|
+
# Jump to the line that needs to be changed
|
|
343
|
+
lines_to_jump = cur_line - cursor_line
|
|
344
|
+
if lines_to_jump:
|
|
345
|
+
print(f"\033[{lines_to_jump}B\r", end="")
|
|
346
346
|
# Clear the current line
|
|
347
347
|
print(f"{constants.CLEAR_LINE}\r", end="")
|
|
348
348
|
# Write the new line, this will move the cursor to the next line automatically
|
|
349
349
|
self.write(
|
|
350
350
|
line, include_prefix, end, truncate=tail_output, columns=columns
|
|
351
351
|
)
|
|
352
|
-
|
|
353
|
-
#
|
|
354
|
-
|
|
352
|
+
# Need to set the cursor_line to be the current line + 1 as the above write
|
|
353
|
+
# will move the cursor to the next line
|
|
354
|
+
cursor_line = cur_line + 1
|
|
355
|
+
|
|
356
|
+
if num_lines_to_print > num_last_printed_lines:
|
|
357
|
+
# Jump to the start of the new lines that needs to be printed
|
|
358
|
+
lines_to_jump = num_last_printed_lines - cursor_line
|
|
359
|
+
if lines_to_jump:
|
|
360
|
+
print(f"\033[{lines_to_jump}B\r", end="")
|
|
361
|
+
|
|
362
|
+
# Just print the new lines as normal
|
|
363
|
+
for line_parts in self._to_print[num_last_printed_lines:]:
|
|
364
|
+
include_prefix, line, end = line_parts
|
|
365
|
+
self.write(
|
|
366
|
+
line, include_prefix, end, truncate=tail_output, columns=columns
|
|
367
|
+
)
|
|
368
|
+
else:
|
|
369
|
+
# Jump to the end of the output
|
|
370
|
+
lines_to_jump = num_lines_to_print - cursor_line
|
|
371
|
+
if lines_to_jump:
|
|
372
|
+
print(f"\033[{lines_to_jump}B\r", end="")
|
|
355
373
|
|
|
356
374
|
# Force a flush to return the cursor to the bottom immediately
|
|
357
375
|
print("", end="", flush=True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|