head	1.4;
access;
symbols
	perseant-exfatfs-base-20261102:1.4;
locks; strict;
comment	@# @;


1.4
date	2026.11.02.08.33.37;	author nia;	state Exp;
branches;
next	1.3;
commitid	ucqMIuYKSxjczR1H;

1.3
date	2026.10.30.22.32.03;	author nia;	state Exp;
branches;
next	1.2;
commitid	6T7w00qf5Byajy1H;

1.2
date	2026.10.30.16.14.35;	author nia;	state Exp;
branches;
next	1.1;
commitid	APhM1lBKq2HGdw1H;

1.1
date	2026.10.26.07.52.39;	author nia;	state Exp;
branches;
next	;
commitid	vNbxcBbERAW3xX0H;


desc
@@


1.4
log
@atto(1): fatal cannot take special format string arguments other than
the initial %s for the program name. Gain some safety by not having
callers pass a format string in the first place.

With this, we can raise WARNS to 5.
@
text
@#	$NetBSD: Makefile,v 1.3 2026/10/30 22:32:03 nia Exp $

.include <bsd.own.mk>

USE_FORT?= yes	# data-driven bugs?

PROG=	atto
SRCS=	command.c display.c gap.c key.c search.c buffer.c replace.c
SRCS+=	window.c complete.c hilite.c main.c

LDADD+=	-lcurses -lterminfo
DPADD+=	${LIBCURSES} ${LIBTERMINFO}

.ifndef SMALLPROG
SRCS+=	menu.c
LDADD+=	-lmenu
DPADD+=	${LIBMENU}
.else
CPPFLAGS+=	-DSMALL
.endif

WARNS=	5

COPTS.replace.c+=	${CC_WNO_FORMAT_TRUNCATION}

MLINKS+=	atto.1 natto.1
LINKS+=		${BINDIR}/atto ${BINDIR}/natto

.include <bsd.prog.mk>
@


1.3
log
@atto(1): Rename to natto via symlink/alias.

This is different enough from the spirit of the original editor now
that it has libmenu support.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.2 2026/10/30 16:14:35 nia Exp $
d22 1
a22 1
WARNS=	3
@


1.2
log
@atto(1): For users who can't easily remember key bindings, add a menu
which is opened by pressing the escape key twice, and operated using
the cursor keys. This uses libedit, so is conditional on SMALLPROG
to still allow easy inclusion of a minimal editor in ramdisks and so
on.

As the copyright might reveal, I nicked some code from blymn@@'s editor
from othersrc to implement the menu. Thanks!

XXX it should really be renamed to natto now, since this is totally
beyond the vision of the original atto.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile,v 1.1 2026/10/26 07:52:39 nia Exp $
d5 2
d26 3
@


1.1
log
@atto(1): Initial import of tiny text editor, as discussed on
tech-userlevel@@.

This is Hugh Barney's atto text editor modified for inclusion in
NetBSD. Since the upstream repository is inactive and the original
author wishes to keep the code base below 2000 lines of C, this is
effectively a fork that lives in usr.bin/atto. It serves as an
alternative to vi(1) for users more accustomed to modeless text
editors.

Notable changes include reworked keyboard input code to handle a wider
range of terminals (via libcurses cursor key translation), more useful
help for unrecognized key presses, and standardized option handling
using getopt (with syntax highlighting disabled by default).

Thanks martin and other folks for feedback and testing.

ATTO(1)                 General Commands Manual                ATTO(1)

NAME
     atto - simple modeless text editor

SYNOPSIS
     atto [-C] file ...

DESCRIPTION
     atto is a screen-based text editor.  It serves as an alternative
     to vi(1) for users who are not accustomed to text editors with
     separate insertion and editing modes, and includes support for
     editing UTF-8 text.

     Perhaps all that needs to be known to use atto at a basic level
     is that holding the control key, pressing x, then pressing w will
     write the currently open file, and holding the control key,
     pressing x, then pressing c will exit the editor.

     The options are as follows:

     -C          Use colours, if available, for basic language-unaware
                 syntax highlighting.

   Cursor movement commands
     C is used as an abbreviation for the control key, commonly
     rendered as "ctrl" on English language keyboards.

     Arrow keys or the navigation cluster can also be used to move the
     cursor when the keyboard has such features.

           C-a        move cursor to beginning of current line (i.e.
                      "home")
           C-b        move cursor back one character (i.e. "left")
           C-e        move cursor to end of current line (i.e. "end")
           C-f        move cursor forward one character (i.e. "right")
           C-n        move cursor to next line (i.e. "down")
           C-p        move cursor to previous line (i.e. "up")
           C-v        move cursor to next page of text (i.e. "page
                      down")
           Esc-b      move cursor back one word
           Esc-f      move cursor forward one word
           Esc-g      jump to a specific line number in the file
           Esc-v      move cursor to previous page of text (i.e. "page
                      up")
           Esc-<      jump to the start of the file
           Esc->      jump to the end of the file

   Text editing commands
           C-d        delete character under cursor (i.e. "del")
           C-h        move cursor backwards and delete previous
                      character (i.e. "backspace")
           C-g        abort at prompts (cancel task when asked a
                      question)
           C-i        insert tab character
           C-j        insert newline character (i.e. "enter",
                      "return")
           C-k        cut text up to the end of the line (i.e. "kill
                      line")
           C-l        refresh the screen
           C-m        insert carriage return character
           C-r        search for text backwards, jump to next result
           C-s        search for text forwards, jump to next result
           C-y        paste the text in the cut buffer (i.e. "yank")
           Esc-r      search for text and replace it

   Buffer commands
     atto supports multiple editing buffers, allowing users to edit
     multiple files from a single instance of the program.

           C-x C-c    close all open buffers and exit atto, prompting
                      if changes would be discarded
           C-x C-f    open a file into a new buffer
           C-x C-k    close the current buffer, prompting if changes
                      would be discarded (i.e. "kill")
           C-x C-s    save current buffer to disk, overwriting the
                      file
           C-x C-w    save current buffer to disk, prompting for file
                      name ("write")
           C-x n      cycle to next buffer
           C-x i      read another file and insert it into the current
                      buffer
           C-x =      display cursor position in current buffer

   Region commands
     As well as cutting text on a line basis (i.e. C-k), a region can
     be selected by setting a mark at the beginning of the region, and
     then moving the cursor to the end of the region.

           C-space    set the beginning of the region at the current
                      position
           C-w        cut the marked region
           Esc-w      copy the marked region without deleting it

   Window management commands
     Simple split-screen window management is included.  For more
     advanced use cases, consider using tmux(1).

           C-x 1      delete windows except the currently active one
           C-x 2      split current window into two windows
           C-x o      switch to the next open window

SEE ALSO
     ed(1), ex(1), vi(1), xedit(1)

STANDARDS
     atto is not the standard editor.

AUTHORS
     atto was written primarily by Hugh Barney, and was originally
     based on public domain code from Anthony Howe's editor (commonly
     known as Anthony's Editor).

     It has been modified for inclusion in NetBSD, including with
     enhanced option handling.

NetBSD 11.99.9             October 15, 2026             NetBSD 11.99.9
@
text
@d1 1
a1 1
#	$NetBSD$
d12 8
@

