diff options
author | Omar Polo <op@cvs.openbsd.org> | 2024-07-08 14:33:30 +0000 |
---|---|---|
committer | Omar Polo <op@cvs.openbsd.org> | 2024-07-08 14:33:30 +0000 |
commit | 69d9547e9e5b0ad9c26bc3a3e1c712e464f3c336 (patch) | |
tree | f4fd0ed5a4d1e83fc49254293e8a6eadbcb8d3c4 /usr.bin/mg | |
parent | 83f2bf439331afbe60d1d5f1c4617b812d1c2a98 (diff) |
mg: fix auto-indent-mode with custom tab widths
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.
Diffstat (limited to 'usr.bin/mg')
-rw-r--r-- | usr.bin/mg/util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/mg/util.c b/usr.bin/mg/util.c index dd42085a24a..19b19a5b5a4 100644 --- a/usr.bin/mg/util.c +++ b/usr.bin/mg/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.50 2023/04/28 10:02:03 op Exp $ */ +/* $OpenBSD: util.c,v 1.51 2024/07/08 14:33:29 op Exp $ */ /* This file is in the public domain. */ @@ -354,9 +354,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); } |