summaryrefslogtreecommitdiff
path: root/editors/nvi/patches/patch-ay
blob: 6055d9a614b0da1f066f141a29142349632ffa07 (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.2 2013/01/23 17:26:08 wiz 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. */