AutoYADM commit: 2025-05-12 00:36:08
This commit is contained in:
parent
97b84921f3
commit
4cc2892f14
1 changed files with 16 additions and 1 deletions
|
@ -2,9 +2,24 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
line = sys.argv[1]
|
line_n = int(sys.argv[1])
|
||||||
col = int(sys.argv[2])
|
col = int(sys.argv[2])
|
||||||
width = int(sys.argv[3])
|
width = int(sys.argv[3])
|
||||||
count = int(sys.argv[4])
|
count = int(sys.argv[4])
|
||||||
path = sys.argv[5]
|
path = sys.argv[5]
|
||||||
|
direction = sys.argv[6]
|
||||||
|
digits = len(str(count))
|
||||||
|
wrap_width = width - (digits + 3)
|
||||||
|
line = ""
|
||||||
|
with open(path, "r") as f:
|
||||||
|
for n, l in enumerate(f, start=1):
|
||||||
|
if n == line_n:
|
||||||
|
line = l
|
||||||
|
|
||||||
|
chunks = [line[i : i + wrap_width] for i in range(0, len(line), wrap_width)]
|
||||||
|
visual_row = col // wrap_width
|
||||||
|
visual_col = col % wrap_width
|
||||||
|
|
||||||
|
new_visual_row = visual_row + (-1 if direction == "up" else 1)
|
||||||
|
if 0 <= new_visual_row < len(chunks):
|
||||||
|
target_chunk = chunks[new_visual_row]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue