|
|
Subscribe / Log in / New account

GNU nano 8.0 released

Version 8.0 of the terminal text editor GNU nano has been released. This update includes several changes to keybindings to be more newcomer-friendly, such as remapping Ctrl-F to forward-search and adding an option for modern bindings:

Command-line option --modernbindings (-/) makes ^Q quit, ^X cut, ^C copy, ^V paste, ^Z undo, ^Y redo, ^O open a file, ^W write a file, ^R replace, ^G find again, ^D find again backwards, ^A set the mark, ^T jump to a line, ^P show the position, and ^E execute.

The release also provides access to 14 levels of gray scale in xterm (up from four), as well as many bug fixes.


From:  Benno Schulenberg <bensberg-AT-telfort.nl>
To:  nano-devel-AT-gnu.org, info-nano-AT-gnu.org
Subject:  [ANNOUNCE] nano-8.0 is released
Date:  Wed, 01 May 2024 11:23:03 +0200
Message-ID:  <88472161-f293-4283-be9f-db1f81fca8c8@telfort.nl>
Cc:  info-gnu-AT-gnu.org


2024.05.01 - GNU nano 8.0  "Grus grus"

• By default ^F is bound to starting a forward search, and ^B to
   starting a backward search, while M-F and M-B repeat the search
   in the corresponding direction.  (See the documentation if you
   want the old bindings back.)
• Command-line option --modernbindings (-/) makes ^Q quit, ^X cut,
   ^C copy, ^V paste, ^Z undo, ^Y redo, ^O open a file, ^W write a
   file, ^R replace, ^G find again, ^D find again backwards, ^A set
   the mark, ^T jump to a line, ^P show the position, and ^E execute.
• Above modern bindings are activated also when the name of nano's
   executable (or a symlink to it) starts with the letter "e".
• To open a file at a certain line number, one can now use also
   `nano filename:number`, besides `nano +number filename`.
• <Alt+Home> and <Alt+End> put the cursor on the first and last
   row in the viewport, while retaining the horizontal position.
• When the three digits in an #RGB color code are all the same,
   the code is mapped to the xterm grey scale, giving access to
   fourteen levels of grey instead of just four.
• For easier access, M-" is bound to placing/removing an anchor,
   and M-' to jumping to the next anchor.
• Whenever an error occurs, the keystroke buffer is cleared, thus
   stopping the execution of a macro or a string bind.
• The mousewheel scrolls the viewport instead of moving the cursor


GNU nano is a simple and easy-to-use editor for on the terminal.
   https://nano-editor.org/manual.html

A concise overview of nano's shortcut keystrokes:
   https://nano-editor.org/cheatsheet.html

The tarball and its signature are here:
   https://nano-editor.org/dist/v8/nano-8.0.tar.xz
   https://nano-editor.org/dist/v8/nano-8.0.tar.xz.asc


Specific issues that were addressed in this release:

   https://sv.gnu.org/bugs/?63520  (nano could crash when linting)
   https://sv.gnu.org/bugs/?63691  (wrong Replace-With help text)
   https://sv.gnu.org/bugs/?63702  ("{verbatim}" in a bind failed)
   https://sv.gnu.org/bugs/?63964  (format string vulnerabilities)
   https://sv.gnu.org/bugs/?64019  (flashing filename with --zero)

   https://sv.gnu.org/bugs/?64125  (nonstandard synopsis in man page)
   https://sv.gnu.org/bugs/?64168  (replacing gave unwanted feedback)
   https://sv.gnu.org/bugs/?64226  (misleading "Unbound key" message)
   https://sv.gnu.org/bugs/?64340  (URL in C was colorized as comment)
   https://sv.gnu.org/bugs/?64465  (vanishing folder could cause crash)

   https://sv.gnu.org/bugs/?64578  (spurious error with --mouse)
   https://sv.gnu.org/bugs/?64632  (X11 F13 symbol was not understood)
   https://sv.gnu.org/bugs/?64945  (poor wrapping with long words)
   https://sv.gnu.org/bugs/?64996  (pasting 39 bytes could hang)
   https://sv.gnu.org/bugs/?65193  ("specified" was misspelled)

   https://sv.gnu.org/bugs/?65196  (empty formatter string would crash)
   https://sv.gnu.org/bugs/?65204  (empty linter string would hang)
   https://sv.gnu.org/bugs/?65278  (crash after nested search)
   https://sv.gnu.org/bugs/?65279  (use-after-free during undo)
   https://sv.gnu.org/bugs/?65289  (heap-buffer-overflow during undo)

   https://sv.gnu.org/bugs/?65301  (macro could insert unwanted text)
   https://sv.gnu.org/bugs/?65317  (undoing justification could eat line)
   https://sv.gnu.org/bugs/?65334  ([wish] recognize also .mjs extension)
   https://sv.gnu.org/bugs/?65365  (uninitialized value during verbatim)
   https://sv.gnu.org/bugs/?65369  (crash after search during replace)

   https://sv.gnu.org/bugs/?65381  (searching overwrote replace string)
   https://sv.gnu.org/bugs/?65394  (invalid read when typing M-: fast)
   https://sv.gnu.org/bugs/?65396  ("Missing multidata" when justifying)
   https://sv.gnu.org/bugs/?65407  (overlong include path could crash)
   https://sv.gnu.org/bugs/?65426  ("Missing" when undoing justification)

   https://sv.gnu.org/bugs/?65428  ("Misplaced cursor" for Bsp at EOF)
   https://sv.gnu.org/bugs/?65435  ("Missing" when justifying a region)
   https://sv.gnu.org/bugs/?65445  (mis-sized indicator with --softwrap)
   https://sv.gnu.org/bugs/?65482  ("Missing" when justifying a region)
   https://sv.gnu.org/bugs/?65501  (no light background on Linux VT)

   https://sv.gnu.org/bugs/?65505  (setting a color twice leaked memory)
   https://sv.gnu.org/bugs/?65516  ("Missing" during macro replay)
   https://sv.gnu.org/bugs/?65560  (confusing feedback when converting)
   https://sv.gnu.org/bugs/?65565  (reading from stdin was undoable)
   https://sv.gnu.org/bugs/?65586  (misadjusted mark with --autoindent)

   https://sv.gnu.org/bugs/?65591  (new Makefile did not use syntax)
   https://sv.gnu.org/bugs/?65604  ("Span underflowed" for a hard-wrap)
   https://sv.gnu.org/bugs/?65611  ("Span underflowed" for redo of wrap)
   https://sv.gnu.org/bugs/?65636  (--break with --zap could crash)
   https://sv.gnu.org/bugs/?65649  (on laggy machine macro could hang)

   Almost half of these issues were reported by `correctmost`, who has
   been generating scripts that hammer nano with random keystrokes.


Changes between v7.2 and v8.0:
------------------------------

Andy Koppe (2):
       input: scroll on mousewheel events instead of moving the cursor
       rcfile: map the gray #rgb codes (#111 to #EEE) to the xterm grayscale

Benjamin Valentin (1):
       new feature: interpret also <filename>:<linenumber> when opening a file

Jordi Mallach (1):
       docs: fix "availabilty" typo in the manual and the nanorc manpage

Matteo Raso (1):
       syntax: python: colorize decorators specially

Mike Frysinger (2):
       build: link in $(GETRANDOM_LIB) from gnulib
       gnulib: import canonicalize-lgpl for realpath

Benno Schulenberg (156):
       bindings: allow speller and friends to be rebound also in restricted mode
       bindings: in the tiny version, bind M-6 only in main, not at the prompts
       bindings: let <Alt+Home/End> move the cursor to top/bottom of viewport
       bindings: let M-" place/remove an anchor, and let M-' jump to one
       bindings: let M-& show the ncurses version+patch, as a small Easter egg
       bindings: make ^F start a forward search by default
       bindings: make ^F start a forward search by default
       bindings: set up modern bindings also when binary's name starts with "e"
       bindings: show ^- instead of ^/ for 'flipgoto' when on a Linux console
       bindings: with --modern, do not let ^Q^Q quit nano without saving
       bindings: with --modern, use ^H for Help when the terminal allows it
       browser: report an error instead of crashing when the folder disappears
       browser: restore typing position at prompt after "^R name ^T ^F ^V ^C"
       bump version numbers and add a news item for the 8.0 release
       chars: add a helper function for stripping leading blanks from a string
       copyright: update the years for the FSF
       display: add a wnoutrefresh() call for NetBSD, to force a cursor update
       display: do not attempt to draw a line that is outside the viewport
       display: draw a new magic line rightaway when there are multiline regexes
       display: show the help lines down to the tiniest possible terminal size
       docs: add a caveat in the FAQ about bracketed pastes
       docs: add a clarifying note to the description of --tabstospaces
       docs: add an example binding for normalizing Unicode to the sample nanorc
       docs: add a reference to the 'help-nano' mailing list
       docs: add M-C and M-Z to the cheatsheet, and reshuffle for balance
       docs: add ^T^S (spell check) and M-S (softwrap) to the cheatsheet
       docs: add two examples of custom key bindings to the nanorc manpage
       docs: adjust an example help line in the README to the current state
       docs: adjust the cheatsheet for the changed meanings of ^F, ^B, M-F, M-B
       docs: clarify that a fileregex is matched against the absolute filename
       docs: delete a remark about libvte that is no longer relevant
       docs: describe nano more specifically as a text editor
       docs: document the <filename>:<linenumber> thing for cursor positioning
       docs: document the new bindable functions 'toprow' and 'bottomrow'
       docs: document the new --modernbindings option
       docs: fix a ten-year-old typo, reported by `correctmost`
       docs: improve the description of the 'flipexecute' bindable function
       docs: in a synopsis, use braces around a choice of required parts
       docs: in the sample nanorc, set the guidestripe to a soft grey
       docs: mention backreferences (for replacements with regular expressions)
       docs: mention how to get the old behavior of ^F, ^B, M-F, and M-B back
       docs: mention that a restricted nano does not access the history files
       docs: mention that 'light' background colors do not work on Linux console
       docs: mention that --modernbindings overrides --preserve
       docs: mention the changed meanings of ^F/^B and also in the texi manual
       docs: mention the missing two options that override --bold
       docs: say "mini bar", not "minibar", when referring to the actual bar
       docs: trim stuff that is more than five years old from the changelog
       docs: use a space after #, like everywhere else in the sample nanorc
       editing: adjust the mark before trimming redundant blanks
       execute: show "Older" and "Newer" in the help lines, to allow rebinding
       feedback: drop an unnecessary warning, to not bother the user
       feedback: lowercase a letter, as the phrase is not a full sentence
       feedback: raise the level of "Macro is empty", to match similar messages
       feedback: suppress filename and linecount when --zero is active
       feedback: suppress format-conversion messages for --zero and --mini
       files: do not allow M-U to remove text read from standard input
       files: run `chmod` and `chown` on the descriptor, not on the filename
       formatter: do not crash when the formatter command is empty
       general: include the Copy function (M-6 or ^C) into the tiny version
       general: let the constant-show toggle override the zero-interface mode
       gnulib: update to current upstream state, to make a fresh checkout work
       gnulib: update to its current upstream state
       help: give the "Replace with" prompt its own help text
       help: mention M-Home and M-End in the help text and help lines
       help: rebalance the help items when --preserve is used
       help: restore ^H and ^D as the primary shortcuts for Backspace and Delete
       help: show ^F/^B as primary shortcuts for search, not as secondary
       indicator: do not oversize the scroller when softwrapping
       input: avoid hanging after a 39-character paste on a VSCode terminal
       input: flush the keystroke buffer upon any kind of error condition
       input: for one bump of the mousewheel scroll two lines, not three
       input: intercept a spurious keycode and say what the actual problem is
       input: let the handler of string binds return a byte whenever possible
       input: neutralize two spurious keycodes from VTE terminals
       input: prevent 'macro_length' from underflowing when hammering M-:
       input: recognize certain escape sequences for F13 to F16 again
       input: snip the `recordmacro` and `runmacro` keystrokes in a better way
       input: store key codes in the macro buffer as they come in from ncurses
       justify: keep as much of the marked region onscreen as possible
       justify: keep the cursor at the original end of a marked region
       justify: recompute the multidata for paragraphs larger than the viewport
       justify: set the correct starting point also with --cutfromcursor
       justify: set `x = 0` for the undo item, for when using --cutfromcursor
       linter: do not mess up the input stream when the linter command is empty
       linter: use a format string, to deflect format-string attacks
       memory: prevent a leak by freeing a possibly already existing color combo
       minibar: mention the file format when it's DOS or Mac
       moving: preserve horizontal position when jumping to top or bottom row
       new feature: functions that jump to the top or bottom of the viewport
       new feature: option --modernbindings sets up more widespread key bindings
       options: make --modernbindings actually override --preserve
       po: update translations and regenerate POT file and PO files
       rcfile: add bindable functions for moving the cursor to top or bottom row
       rcfile: avoid crashing on an include path that is way too long
       replacing: stash the string to be replaced while asking for replacement
       revert the previous commit -- forget about -? as a synonym for --help
       screen: recalculate the multidata when detecting the need for it
       search: avoid a crash after a nested search, reported by `correctmost`
       search: avoid crashing after searching a help text during a regex replace
       shutdown: ignore a modified buffer when in view mode
       softwrap: adjust start-of-screen when the 'edittop' line is hard-wrapped
       softwrap: realign start-of-screen when redoing an automatic hard-wrap
       softwrap: remember the actual breaking point when wrapping at blanks
       startup: use a format string, to deflect format-string attacks
       syntax: c: require a preceding blank when a line comment contains a quote
       syntax: javascript: recognize also the .mjs extension
       syntax: makefile: ensure that the <Tab> key always produces a tab
       syntax: makefile, sh: recognize also a fresh Makefile and fresh .profile
       syntax: nanorc: colorize {toprow} and {bottomrow} for string binds
       syntax: sh: recognize more shells than `sh` on a shebang line for busybox
       tweaks: add a comment that refers to the VTE spurious-code issue
       tweaks: add a missing 'type' attribute to a <style> tag
       tweaks: add an extra variable, to avoid reusing one for another purpose
       tweaks: add another translator hint, to help avoid overlong key tags
       tweaks: adjust a comment for the changed handling of gray #rgb codes
       tweaks: avoid calling isblank()/isalpha() on what could be a signed char
       tweaks: condense the code that searches for a colon plus line number
       tweaks: delete a redundant fragment of code from do_replace_loop()
       tweaks: elide a redundant variable
       tweaks: express an 'if' more concisely, and add two blank lines
       tweaks: implement the fix of the previous commit somewhat differently
       tweaks: improve three translator hints
       tweaks: make two strings equal to a third, to slightly ease translation
       tweaks: move two static declarations to the only function that uses them
       tweaks: normalize the indentation after the previous change
       tweaks: normalize the indentation after the previous changes
       tweaks: pull a fragment of code a bit forward, to enable the next commit
       tweaks: remove two pairs of unneeded braces, and normalize a line
       tweaks: rename a function and variable, to describe better what they do
       tweaks: rename a function, for contrast, and update antiquated comments
       tweaks: rename a struct element, to avoid a theoretical name collision
       tweaks: rename a symbol (to be clearer), and add three missing comments
       tweaks: rename a variable, away from an abbreviation
       tweaks: rename a variable, away from an abbreviation
       tweaks: rename a variable, to be a bit more indicative
       tweaks: rename a variable, to be clearer when seen in context
       tweaks: rename a variable, to be more readable
       tweaks: rename a variable, to better indicate what it represents
       tweaks: rename two variables, to be clearer and to match others
       tweaks: reshuffle four lines, to allow folding some #ifdefs together
       tweaks: reshuffle three fragments of code, moving related things together
       tweaks: rewrap a comment, and reshuffle seven declarations
       tweaks: rewrap two old news items
       tweaks: shrink the set of characters recognized as line-column separator
       tweaks: slightly improve a comment, to be more accurate
       tweaks: slightly reword the help text for the Replace-With prompt
       tweaks: ungettextize three strings, to make a translator hint right again
       tweaks: use a pair of parentheses to clarify the order of operations
       undo: force a screen refresh also for the special case Bsp-at-EOF
       undo: prevent a use-after-free, reported by `correctmost`
       undo: recompute the multidata when a piece of text is replaced
       undo the prelast commit in order to redo it with a fuller commit message
       verbatim: avoid referencing an uninitialized value
       wrapping: delete only single characters, not a possibly marked region


-- 

Benno


to post comments

GNU nano 8.0 released

Posted May 1, 2024 19:36 UTC (Wed) by fraetor (subscriber, #161147) [Link] (13 responses)

Great to see further improvements to my favourite text editor!

Its nice to see the modern key bindings, as to be more consistent with most other software. It'll take a bit to change my muscle memory though.

GNU nano 8.0 released

Posted May 1, 2024 20:40 UTC (Wed) by josh (subscriber, #17465) [Link] (12 responses)

Given nano's role as a user-friendly terminal text editor for new users, I think this change is going to be extremely welcome. I hope that distributions install an `enano` symlink or similar, and reference enano when they tell brand new users how to edit files.

GNU nano 8.0 released

Posted May 1, 2024 21:16 UTC (Wed) by sub2LWN (subscriber, #134200) [Link] (7 responses)

> Above modern bindings are activated also when the name of nano's
> executable (or a symlink to it) starts with the letter "e".

Does this mean nano could be installed as "emacs" to activate the new bindings? :-) Not that this would ultimately help users, of course.

GNU nano 8.0 released

Posted May 1, 2024 21:41 UTC (Wed) by josh (subscriber, #17465) [Link] (6 responses)

I am curious what use case they had in mind to motivate "starts with e" over "is this exact name".

GNU nano 8.0 released

Posted May 1, 2024 22:33 UTC (Wed) by fraetor (subscriber, #161147) [Link]

From the commit message:
This allows activating the "modern" bindings without having to pass an option, by simply invoking nano through a symlink -- for example: `en` (short for "editor nano"), or `et` (short for "edit"), or just `e`.

GNU nano 8.0 released

Posted May 1, 2024 22:35 UTC (Wed) by coriordan (guest, #7544) [Link] (3 responses)

My guess was so that it covers "edit" and "editor".

I found the mail where this change was announced on the dev list: https://lists.gnu.org/archive/html/nano-devel/2023-02/msg...

...but the replies don't raise or answer your question. I guess it's just an arbitrary decision between two fine options.

GNU nano 8.0 released

Posted May 2, 2024 0:47 UTC (Thu) by sub2LWN (subscriber, #134200) [Link] (2 responses)

I looked at the code to see if it uses argv 0 or actually checks the paths (/proc/self/cmdline vs /proc/self/exe), and it does the former. There's a similar rule next to it in nano.c for an "r" at the beginning of the command-name, to enable restricted mode:

if (*(tail(argv[0])) == 'r')
SET(RESTRICTED);
else if (*(tail(argv[0])) == 'e')
SET(MODERN_BINDINGS);

So the logic was likely based on the restricted code (which is also in nano 2.9.8 which I have on my system). Unfortunately it's mutually exclusive :-( can't invoke nano as "err" and have a restricted editor with modern bindings.

"git blame nano.c" says the earlier argv check for restricted mode was added 2017-12-29 so perhaps there's more rationale in an old changelog or message somewhere.

GNU nano 8.0 released

Posted May 2, 2024 5:29 UTC (Thu) by NYKevin (subscriber, #129325) [Link] (1 responses)

Restricted mode is frankly not very useful. If you want to let somebody edit a file, the proper way to do it is to copy the file into /tmp with permissions set so that they can read and write it, let them edit it in-place with an unprivileged editor, and then copy it back. If you need to do something more elaborate than that, then you probably should be reaching for a container or VM, not restricted mode.

GNU nano 8.0 released

Posted May 3, 2024 5:43 UTC (Fri) by grawity (subscriber, #80596) [Link]

I'm reminded of the various captive interfaces I've seen back in the day, when shell accounts and telnet/ssh BBSes were more of a thing. They used restricted editors because the user (e.g. a free BBS-only user with no shell access) wasn't supposed to do anything in the account even in places where their UID would've granted them the access.

Spinning up a new VM for each user wasn't an option back then.

GNU nano 8.0 released

Posted May 1, 2024 23:00 UTC (Wed) by sub2LWN (subscriber, #134200) [Link]

Whatever their motivation, the e-ffects of this change may cause some users to change how they perceive and use argv 0: Rethinking Argv 0. :-)

My first thought was to overload argv to make distinct instances of the e* editor (as I'll now remember nano), such that you could kill a particular one when several are running (elinux, eblog, ecommerce, enlightenment).

I tried "$ (exec -a en nano)" in bash, and that seems to change argv and /proc/self/cmdline for that process to the new name. I don't have the new e* v8 yet to check the modern bindings however.

(Un)fortunately this doesn't affect the likes of "pgrep electricnano" by default, and needs "pgrep -f electricnano; pkill -f electricnano" to use the process cmdlines. I suspect this is due to /proc/self/exe being a symlink to the real path, and the design of certain tools limiting trust in user inputs to prevent complete chaos. The given argv 0 does show up in "ps a" and "systemctl status".

GNU nano 8.0 released

Posted May 1, 2024 21:25 UTC (Wed) by patrick_g (subscriber, #44470) [Link] (3 responses)

> Given nano's role as a user-friendly terminal text editor for new users

For this role the "micro" terminal text editor is even better : https://micro-editor.github.io/

GNU nano 8.0 released

Posted May 2, 2024 11:02 UTC (Thu) by Deleted user 129183 (guest, #129183) [Link]

I think that for that role, this one is probably the best:

https://os.ghalkes.nl/tilde/

GNU nano 8.0 released

Posted May 5, 2024 0:51 UTC (Sun) by marcH (subscriber, #57642) [Link] (1 responses)

For people "hardcoded" to readline and emacs bindings, my favorite "nano" editor is https://www.jedsoft.org/jed/.

Probably more "micro" than "nano" but you get the idea.

GNU nano 8.0 released

Posted May 5, 2024 0:55 UTC (Sun) by marcH (subscriber, #57642) [Link]

> For people "hardcoded" to readline and emacs bindings,

Forgot to say: you can change the default bindings of course. But the point of a "nano" editor is IMHO that you can just "apt install" it on some random new system that you've never used before and it works out of the box.

GNU nano 8.0 released

Posted May 1, 2024 21:33 UTC (Wed) by flussence (guest, #85566) [Link] (1 responses)

That grey scale mapping thing is clever; neat to see things like that still being done when most software nowadays would probably just abdicate to telling users to get a 24-bit terminal.

GNU nano 8.0 released

Posted May 15, 2024 13:10 UTC (Wed) by mina86 (guest, #68442) [Link]

Shameless plug if you’re interested in this topic: https://github.com/mina86/ansi_colours


Copyright © 2024, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds