Skip to content

Commit

Permalink
Fix auto-indent-mode with custom tab widths
Browse files Browse the repository at this point in the history
dointent() didn't know about set-tab-width so it was mis-indenting
the lines.  Diff from Mark Willson (mark dot willson at hydrus.org.uk),
with a tiny change by me.

Signed-off-by: Omar Polo <[email protected]>
Signed-off-by: Joachim Wiberg <[email protected]>
  • Loading branch information
omar-polo authored and troglobit committed Aug 1, 2024
1 parent d52324c commit cbf5e31
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/util.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: util.c,v 1.49 2023/04/21 14:14:13 op Exp $ */
/* $OpenBSD: util.c,v 1.51 2024/07/08 14:33:29 op Exp $ */

/* This file is in the public domain. */

Expand Down Expand Up @@ -351,9 +351,9 @@ doindent(int cols)

if (curbp->b_flag & BFNOTAB)
return (linsert(cols, ' '));
if ((n = cols / 8) != 0 && linsert(n, '\t') == FALSE)
if ((n = cols / curbp->b_tabw) != 0 && linsert(n, '\t') == FALSE)
return (FALSE);
if ((n = cols % 8) != 0 && linsert(n, ' ') == FALSE)
if ((n = cols % curbp->b_tabw) != 0 && linsert(n, ' ') == FALSE)
return (FALSE);
return (TRUE);
}
Expand Down

0 comments on commit cbf5e31

Please sign in to comment.