[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] updates, etc.

From: David L. Ramsey
Subject: [Nano-devel] updates, etc.
Date: Tue, 20 Apr 2004 11:42:05 -0400

No, I'm not dead; I've just been very busy again.  I've found time to
check some minor bugfixes into CVS, though.  As for actual patches,
here's what I've been working on:

No more real progress on this yet; I'll get to it, though.

Note on input overhauls: I may have to do one again at some point,
because putting a lot of hardcoded escape sequences in has made things
more and more of a mess (although translating them all into the control
sequences nano expects was a step in the right direction).  I've
discovered tigetstr() and tgetstr(), which get the sequences out of the
terminfo/termcap file, and which should finally clean some of that mess
up (although I'll still have to specify sequences for Ctrl-[arrow key],
Shift-Up, and Shift-Down, since there are no entries for those keys). 
In accordance with that, get_verbatim_kbinput() may end up being the new
lowest-level input routine, since it's the only one that can grab escape
sequences without having to check for hardcoded values, as
get_accepted_kbinput() does now ('O', 'o', and '[').

I know I keep redesigning the input routines, but given the problems
with them before, I want to make sure I get them right.  Besides, once I
do, it will make it a lot easier to switch everything over to wide
characters when UTF-8 support is added, which is why that keeps being
put off.  (I could try and switch over now, especially since
Slackware-current finally got UTF-8 locales and ncursesw a few months
ago, but if I have to restructure all the input routines after that,
it'll end up being a lot of effort, and if I can avoid some of that
effort by making sure that the input routines we have now are designed
properly, I'd prefer to.)

By the way, there's apparently a curses-specific function to sleep for a
specified number of milliseconds, which isn't obsolete like usleep(),
and which isn't only available on POSIX-1b compatible machines like
nanosleep(): napms().  The other functions may come in handy if someone
writes a non-curses frontend for nano (there'll probably have to be more
abstraction before that will be really feasible, in any case), but as
things stand now, maybe nano should switch to using that?

The modified version of IO ERROR's restricted mode patch from before,
with the changes documented in the Changelog.  Basically, it disables a
few more ways files not specified on the command line could be written
to: file backups (and hence backup directories) are turned off, spell
checking is turned off (it could leave a backup copy of the
non-spell-checked file in $TMPDIR), and toggles that have no meaning due
to features' being disabled in restricted mode are turned off.  The way
file saves are handled has been changed as well: the old way wouldn't
work if the filename was blank, so the code now lets you save a file
under any name if the filename is blank, but afterwards makes the
filename uneditable at the prompt.  Also a few consistency tweaks: the
shortcuts in the main list that are disabled now call
nano_disabled_msg() instead of being left out, and nano no longer acts
as though TEMPFILE is set when exiting after saving a modified file,
since the above changes to the prompt handle that case.  Needs testing.

An attempt at making file navigation faster.  With this patch applied,
instead of calling update_line() every time we move, we call it only if
the mark is on, if we've moved onto a different virtual page (for
horizontal movement), or if we're not on the first virtual page (for
vertical movement).  Needs testing, especially by people on slower

An attempt at working around the so-called NumLock glitch (best-behaved:
Eterm, close behind: xterm, worst behaved: rxvt).  Seems to work fine so
far with ncurses in xterm, rxvt, and Eterm.  Slang works properly in
xterm but generates incorrect values for some of the keys when in rxvt
or Eterm (e.g. function key values, so I have no way of working around
it; Insert [0] also generated a value greater than KEY_MAX at one

An attempt at fixing the problem where, on systems lacking
_POSIX_VDISABLE and which end up being put into raw mode, the flow
control characters would always be passed through raw even when -p was
used.  In the new scheme, the terminal is put into raw mode, which is
the closest to what we want in most circumstances (and which saves us
the trouble of having to individually disable the special control keys),
and then termios is used to turn the flow control characters back on if
-p is being used.  It also has to use termios to turn signal
interpretation back on temporarily in open_pipe() so that rerouting
SIGINT to cancel_fork() will work (obviously ^C has to generate SIGINT
then).  Also, savetty() was called at one point, but resetty() never
was; I've fixed it so savetty() is called after the initial terminal
setup and resetty() is called in handle_sigwinch() so that we don't have
to manually set all the flags again, which seems to work well so far. 
Needs testing, especially by people with _POSIX_VDISABLE-less systems
(such as Cygwin, according to the comments).

An attempt at implementing the "smart home" feature Stephan T. Lavavej
mentioned.  I'm interested in this because it seems to be in the same
vein as Meta-W (repeat last search) in that it could save a few
keystrokes and hence some time when editing a file.  New command line
option -A/--smarthome, rcfile option "smarthome", and toggle Meta-H. 
Disabled in tiny mode.

Adds is_blank_char(), an equivalent of isblank() (essentially, is c a
tab or space), and converts the rest of the code to use it.  This saves
us the trouble of having to check for those same two characters all over
the code.  (What to do about iswblank() when nano gets UTF-8 support,
since there are also Unicode spacing characters?)

Attachment: signature.asc
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]