From 31f188eef9af8a8ca3a7c493f18fcc74c00861a3 Mon Sep 17 00:00:00 2001 From: Petter Rodhelind Date: Thu, 11 May 2017 08:04:35 +0200 Subject: Add support for tab expansion (because everyone else is stupid and I am forced to follow along) Tab expansion inserts spaces instead of TAB character. Number of spaces is dependent upon your current tab stop setting, which can be changed by running "Tab n". As of now, it's not possible to turn it on and off during runtime. You can however see whether it's compiled or not by executing the command "Tabexpand". The console will show either 1 or 0. This will be taken care of in a later commit. --- src/cmd/acme/text.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/cmd/acme/text.c') diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c index 0452c2b1..faa87d99 100644 --- a/src/cmd/acme/text.c +++ b/src/cmd/acme/text.c @@ -758,6 +758,14 @@ texttype(Text *t, Rune r) } else textshow(t, t->file->b.nc, t->file->b.nc, FALSE); return; + case 0x09: /* ^I (TAB) */ + if(t->w->tabexpand == TRUE){ + for(i=0; i < t->w->body.tabstop; i++){ + texttype(t, ' '); + } + return; + }else + break; /* fall through to normal code */ case 0x01: /* ^A: beginning of line */ typecommit(t); /* go to where ^U would erase, if not already at BOL */ -- cgit v1.2.3