AutoYADM commit: 2025-05-12 03:15:08

This commit is contained in:
Daniel Fichtinger 2025-05-12 03:15:08 -04:00
parent dc8ac7f4cb
commit c6543d13f4
2 changed files with 23 additions and 10 deletions

View file

@ -3,15 +3,23 @@
# 3. Split the logical line into chunks based on wrap width # 3. Split the logical line into chunks based on wrap width
# 4. Move cursor to the same column offset on the wrapped line # 4. Move cursor to the same column offset on the wrapped line
define-command visual-down %{ define-command visual-vertical -params 1 %{
nop %sh{ execute-keys %sh{
line="$kak_cursor_line" line="$kak_cursor_line"
col="$kak_cursor_column" col="$kak_cursor_column"
width="$kak_window_width" width="$kak_window_width"
count="$kak_buf_line_count" count="$kak_buf_line_count"
path="$kak_buffile" path="$kak_buffile"
new_col=$($kak_config/scripts/nav.py "$line" "$col" "$width" "$count" "$path" "down") session="$kak_session"
distance=$($kak_config/scripts/nav.py "$session" "$line" "$col" "$width" "$count" "$path" "$1")
echo "$distance"
# TODO: figure out how to jump to this column? # TODO: figure out how to jump to this column?
} %sh{
if [ "$1" = "up" ]; then
echo h
else
echo l
fi
} }
} }

View file

@ -1,13 +1,15 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys import sys
# import subprocess
line_n = int(sys.argv[1]) session_id = sys.argv[1]
col = int(sys.argv[2]) line_n = int(sys.argv[2])
width = int(sys.argv[3]) col = int(sys.argv[3])
count = int(sys.argv[4]) width = int(sys.argv[4])
path = sys.argv[5] count = int(sys.argv[5])
direction = sys.argv[6] path = sys.argv[6]
direction = sys.argv[7]
digits = len(str(count)) digits = len(str(count))
wrap_width = width - (digits + 3) wrap_width = width - (digits + 3)
line = "" line = ""
@ -25,4 +27,7 @@ if 0 <= new_visual_row < len(chunks):
target_chunk = chunks[new_visual_row] target_chunk = chunks[new_visual_row]
new_col = min(visual_col, len(target_chunk) - 1) new_col = min(visual_col, len(target_chunk) - 1)
new_abs_col = new_visual_row * wrap_width + new_col new_abs_col = new_visual_row * wrap_width + new_col
print(new_abs_col) diff = abs(new_abs_col - col)
print(diff)
# _ = subprocess.run(args=["kak", "-c"])