summaryrefslogtreecommitdiff
path: root/editors/nvi/patches/patch-ay
blob: bf1b6bd6e3b65c818ee100d73dc7cb9bed84653b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$NetBSD: patch-ay,v 1.1 2009/08/07 16:39:21 lukem Exp $

--- ../ex/ex_txt.c.orig	2007-11-19 03:41:42.000000000 +1100
+++ ../ex/ex_txt.c
@@ -403,8 +403,12 @@ txt_dent(SCR *sp, TEXT *tp)
 	 *
 	 * Count up spaces/tabs needed to get to the target.
 	 */
-	for (cno = 0, tabs = 0; cno + COL_OFF(cno, ts) <= scno; ++tabs)
-		cno += COL_OFF(cno, ts);
+	cno = 0;
+	tabs = 0;
+	if (!O_ISSET(sp, O_EXPANDTAB)) {
+		for (; cno + COL_OFF(cno, ts) <= scno; ++tabs)
+			cno += COL_OFF(cno, ts);
+	}
 	spaces = scno - cno;
 
 	/* Make sure there's enough room. */