From 80cb316bf414170ecc80237ba222c4d4e9188078 Mon Sep 17 00:00:00 2001 From: Hajime Nakagami Date: Sun, 25 Aug 2024 11:10:56 +0900 Subject: [PATCH] fix space width --- pyvim/key_bindings.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyvim/key_bindings.py b/pyvim/key_bindings.py index 54b566e..f76cf39 100644 --- a/pyvim/key_bindings.py +++ b/pyvim/key_bindings.py @@ -489,7 +489,11 @@ def tab_indent(event): """ b = event.app.current_buffer if b.expand_tab: - b.insert_text(' ' * b.shiftwidth) + sw = b.shiftwidth + col_mod = b.document.cursor_position_col % b.shiftwidth + if col_mod: + sw -= col_mod + b.insert_text(' ' * sw) else: b.insert_text('\t')