fix: right-justify line numbers in text_editor:read for consistent alignment

linuztx committed Feb 27, 2026 at 13:36 UTC a811364f5ef51f73adcd7322dd7584045409bc9b
1 file changed +2 -1
plugins/text_editor/helpers/file_ops.py
+2 -1
@@ -79,6 +79,7 @@ def read_file(
79 idx_from = line_from - 1
80 idx_to = line_to # slice is exclusive, line_to is inclusive 1-based
81 selected = all_lines[idx_from:idx_to]
82 + num_width = len(str(line_to))
83
84 warn_parts: list[str] = []
85 cropped_lines: list[int] = []
@@ -103,7 +104,7 @@ def read_file(
104 break
105
106 running_tokens += line_tok
106 - output_lines.append(f"{line_no} {stripped}")
107 + output_lines.append(f"{line_no:>{num_width}} {stripped}")
108
109 if cropped_lines:
110 nums = " ".join(str(n) for n in cropped_lines)