Hi,
When the tab width is other than 8, auto-indent-mode can
miscompute the indentation column. E.g. when (set-tab-width 4):
aaaa
bbbb
cccc
.
^
|
Cursor positioned here following return after cccc
This seems to be due to the value 8 being hard-coded in the the
doindent function in util.c. This patch appears to fix the issue:
--- util.c.orig Tue Jul 2 08:10:09 2024
+++ util.c Tue Jul 2 08:11:32 2024
@@ -354,9 +354,10 @@
if (curbp->b_flag & BFNOTAB)
return (linsert(cols, ' '));
- if ((n = cols / 8) != 0 && linsert(n, '\t') == FALSE)
+ if ((n = cols / curwp->w_bufp->b_tabw) != 0 &&
+ linsert(n, '\t') == FALSE)
return (FALSE);
- if ((n = cols % 8) != 0 && linsert(n, ' ') == FALSE)
+ if ((n = cols % curwp->w_bufp->b_tabw) != 0 && linsert(n, ' ') ==
FALSE)
return (FALSE);
return (TRUE);
}
Best Regards,
Mark
--
Mark Willson
mark.will...@hydrus.org.uk