Skip to content

Commit 6c612df

Browse files
committed
Add new visibletab functionality, etc.
1 parent b569d19 commit 6c612df

10 files changed

Lines changed: 42 additions & 30 deletions

File tree

ChangeLog

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
OpenVi 7.0.3 -> OpenVi 7.0.4 (Unreleased): Wed Jan 26 08:37:21 2022
2-
+ Nothing yet ...
1+
OpenVi 7.0.3 -> OpenVi 7.0.4: Wed Jan 26 13:09:45 2022
2+
+ New feature: "set visibletab" (abbrev "set vt") which toggles
3+
displaying tabs visibly while editing, useful for Makefiles, etc.
4+
+ Decrease the width of the line-number column by one row
5+
+ Increase the length of the divider decoration string (by 2x)
6+
+ Improve the GNUmakefile to avoid remaking any non-stale targets
7+
+ Portably seed the standard random number generator
38

49
OpenVi 7.0.2 -> OpenVi 7.0.3: Wed Jan 26 08:31:28 2022
510
+ GNUmakefile "install" targets now install documentation (man pages)

GNUmakefile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# Default C compiler and CFLAGS
66
CC ?= cc
77
CFLAGS += -std=gnu99 -I./cl -I./include -I. -MD
8-
#CFLAGS += -DVISIBLE_TAB_CHARS
98

109
###############################################################################
1110

@@ -255,7 +254,7 @@ endif # DEBUG
255254

256255
###############################################################################
257256

258-
all: vi ex view docs/USD.doc/vi.man/vi.1
257+
all: bin/vi bin/ex bin/view docs/USD.doc/vi.man/vi.1
259258

260259
###############################################################################
261260

@@ -313,16 +312,16 @@ vi: bin/vi
313312

314313
###############################################################################
315314

316-
bin/ex: vi
315+
bin/ex: bin/vi
317316
$(LNS) "vi" "./bin/ex"
318317

319318
.PHONY: ex
320319
ex: bin/ex
321320
@$(TRUE)
322321

323-
###############################################################################
322+
##############################################################################
324323

325-
bin/view: vi
324+
bin/view: bin/vi
326325
$(LNS) "vi" "./bin/view"
327326

328327
.PHONY: view
@@ -331,7 +330,7 @@ view: bin/view
331330

332331
###############################################################################
333332

334-
install: vi ex view virecover docs/USD.doc/vi.man/vi.1
333+
install: bin/vi bin/ex bin/view build/virecover docs/USD.doc/vi.man/vi.1
335334
$(TEST) -d "/tmp/vi.recover" || \
336335
$(MKDIR) "/tmp/vi.recover"
337336
$(TEST) -d "/tmp/vi.recover" && \
@@ -370,7 +369,7 @@ install-strip: install
370369

371370
###############################################################################
372371

373-
strip: vi
372+
strip: /bin/vi
374373
$(STRIP) "./bin/vi"
375374

376375
###############################################################################

common/mkstemp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <errno.h>
44
#include <fcntl.h>
55
#include <stdio.h>
6+
#include <time.h>
7+
#include <bsd_unistd.h>
68
#include <bsd_stdlib.h>
79
#include <bsd_string.h>
810
#include <sys/stat.h>
@@ -13,6 +15,8 @@ obsd_mkstemp (char *template_name)
1315
{
1416
int i, j, fd, len, index;
1517

18+
srand(time(NULL) ^ getpid());
19+
1620
static const char letters[]
1721
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
1822

common/options.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ OPTLIST const optlist[] = {
171171
{"ttywerase", f_ttywerase, OPT_0BOOL, 0},
172172
/* O_VERBOSE 4.4BSD */
173173
{"verbose", NULL, OPT_0BOOL, 0},
174+
/* O_VISIBLETAB OpenVi */
175+
{"visibletab", f_reformat, OPT_0BOOL, 0},
174176
/* O_W1200 4BSD */
175177
{"w1200", f_w1200, OPT_NUM, OPT_NDISP|OPT_NOSAVE},
176178
/* O_W300 4BSD */
@@ -227,6 +229,7 @@ static OABBREV const abbrev[] = {
227229
{"ts", O_TABSTOP}, /* 4BSD */
228230
{"tty", O_TERM}, /* 4BSD (undocumented) */
229231
{"ttytype", O_TERM}, /* 4BSD (undocumented) */
232+
{"vt", O_VISIBLETAB}, /* OpenVi */
230233
{"w", O_WINDOW}, /* O'Reilly */
231234
{"wa", O_WRITEANY}, /* 4BSD */
232235
{"wi", O_WINDOW}, /* 4BSD (undocumented) */

docs/USD.doc/vi.man/vi.1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,6 +2534,10 @@ Select an alternate erase algorithm.
25342534
.Nm vi
25352535
only.
25362536
Display an error message for every error.
2537+
.It Cm visibletab Bq off
2538+
.Nm vi
2539+
only.
2540+
Displays tabs visibly while editing.
25372541
.It Cm w300 Bq no default
25382542
.Nm vi
25392543
only.

docs/help

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,15 @@ unabbreviate: delete an abbreviation
209209
Edit options:
210210
noaltwerase filec="" nomodeline nosearchincr timeout
211211
autoindent flash noprint="" nosecure nottywerase
212-
autoprint hardtabs=0 nonumber shiftwidth=8 noverbose
213-
noautowrite noiclower nooctalr noshowmatch warn
214-
backup="" noignorecase open noshowmode window=35
215-
nobeautify keytime=6 optimize sidescroll=16 nowindowname
216-
cedit="" noleftright print="" noslowopen wraplen=0
217-
columns=80 lines=36 prompt nosourceany wrapmargin=0
218-
comment nolisp readonly tabstop=8 wrapscan
219-
noedcompatible nolist noredraw taglength=0 nowriteany
220-
escapetime=2 lock remap tags="tags"
212+
autoprint hardtabs=0 nonumber shiftwidth=8 novisibletab
213+
noautowrite noiclower nooctalr noshowmatch noverbose
214+
backup="" noignorecase open noshowmode warn
215+
nobeautify keytime=6 optimize sidescroll=16 window=35
216+
cedit="" noleftright print="" noslowopen nowindowname
217+
columns=80 lines=36 prompt nosourceany wraplen=0
218+
comment nolisp readonly tabstop=8 wrapmargin=0
219+
noedcompatible nolist noredraw taglength=0 wrapscan
220+
escapetime=2 lock remap tags="tags" nowriteany
221221
noerrorbells magic report=5 term="xterm"
222222
exrc matchtime=7 ruler noterse
223223
noextended mesg scroll=17 notildeop

ex/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636

3737
#if defined(DB185EMU) || defined(_DB_185_H_)
3838
#define VI_VERSION \
39-
"Version 7.0.4-dev (OpenVi) 10/25/2021 - using Berkeley DB 1.85 emulation"
39+
"Version 7.0.4 (OpenVi) 10/25/2021 - using Berkeley DB 1.85 emulation"
4040
#else
4141
#define VI_VERSION \
42-
"Version 7.0.4-dev (OpenVi) 10/25/2021"
42+
"Version 7.0.4 (OpenVi) 10/25/2021"
4343
#endif /* if defined(DB185EMU) || defined(_DB_185_H_) */
4444

4545
#endif /* ifndef _VERSION_H */

vi/vi.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ typedef struct _vi_private {
316316
/* Vi private area. */
317317
#define VIP(sp) ((VI_PRIVATE *)((sp)->vi_private))
318318

319-
#define O_NUMBER_FMT "%7lu " /* O_NUMBER format, length. */
320-
#define O_NUMBER_LENGTH 8
319+
#define O_NUMBER_FMT "%6lu " /* O_NUMBER format, length. */
320+
#define O_NUMBER_LENGTH 7
321321
#define SCREEN_COLS(sp) /* Screen columns. */ \
322322
((O_ISSET((sp), O_NUMBER) ? (sp)->cols - O_NUMBER_LENGTH : (sp)->cols))
323323

vi/vs_line.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@
2121
#include "../common/common.h"
2222
#include "vi.h"
2323

24-
#ifdef VISIBLE_TAB_CHARS
25-
# define TABCH '~'
26-
#else
27-
# define TABCH ' '
28-
#endif /* ifdef VISIBLE_TAB_CHARS */
29-
3024
/*
3125
* vs_line --
3226
* Update one line on the screen.
@@ -411,7 +405,10 @@ empty: (void)gp->scr_addstr(sp,
411405
while (chlen--) {
412406
if (cbp >= ecbp)
413407
FLUSH(gp, sp, cbp, cbuf);
414-
*cbp++ = TABCH;
408+
if (O_ISSET(sp, O_VISIBLETAB))
409+
*cbp++ = '~';
410+
else
411+
*cbp++ = ' ';
415412
}
416413
else {
417414
if (cbp + chlen >= ecbp)

vi/vs_msg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ vs_divider(SCR *sp)
854854
GS *gp;
855855
size_t len;
856856

857-
#define DIVIDESTR "+=+=+=+=+=+=+=+"
857+
#define DIVIDESTR "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"
858858
len =
859859
sizeof(DIVIDESTR) - 1 > sp->cols ? sp->cols : sizeof(DIVIDESTR) - 1;
860860
gp = sp->gp;

0 commit comments

Comments
 (0)