Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Unexpected default keybinds when program "nano" is invoked by the command "editor" #21902

Closed
robertkirkman opened this issue Oct 20, 2024 · 1 comment
Labels
not-bug Issue is not a bug or has been resolved

Comments

@robertkirkman
Copy link
Contributor

robertkirkman commented Oct 20, 2024

Problem description

On Debian 12, a popular distro that implements the nano and editor commands in the commonly understood "update-alternatives" pattern, when I use the command

sudo apt remove vim-gtk3

In order to allow "update-alternatives" to automatically populate the editor command with nano, as shown by this result in Debian:

update-alternatives: using /bin/nano to provide /usr/bin/editor (editor) in auto mode

and then I launch nano using the editor command,

editor

The keybind to "Write Out" is Ctrl + O, and that is exactly the same as the result when I invoke the nano command in Debian instead of the editor command.

image

On the other hand, when I clean install Termux, either the beta or stable release from https://f-droid.org/en/packages/com.termux/, in both cases, if I invoke nano using the command nano, the keybind to "Write Out" is identical to Debian,

image

but if I invoke nano using the command editor, the keybind to "Write Out" is Ctrl + W instead.

image

I have determined this is an official upstream change implemented in the Nano 8.0 release. Quoted from the release notes:

  • 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".

The main reason this seems like a point of concern to me is, if the editor command is used to provide the default editor of the cvs package, then it would possibly make the default keybinds unfamiliar to people who are using the cvs command to make commits using the nano editor because they already have a lot of experience with older versions of these commands. Related: #21900

I personally do not use cvs or nano very often so I believe that the opinion of some users of cvs and nano is required to determine the best course of action for this issue.

Technically, I should admit that in the next future stable release of Debian, this behavior might end up also appearing there too because the Debian cvs package does use editor as its default

However, the mystery, to me, deepens further because, in an attempt to find out what the behavior will be in the next future release of Debian, I just now clean installed this official daily build of Debian Testing: http://cdimage.debian.org/cdimage/daily-builds/sid_d-i/current/amd64/iso-cd/debian-testing-amd64-netinst.iso, and these are the results I see in the resulting Debian 13 testing installation:

Debian Testing Image October 20 2024 behavior

  • nano version: 8.2

  • Invocation: nano

  • Result: "Write Out" keybind: Ctrl + O

image

  • Invocation: editor

  • Result: "Write Out" keybind: Ctrl + O

image

These are not the same screenshot. In Debian Testing, currently, the default editor launched by the editor command is nano, but the behavior of that nano is identical to that in Debian 12, i.e. it is not exhibiting the unexpected keybind behavior.

This means that the current default behavior of the editor command on the clean installed unmodified Termux app does not match the current default behavior of the clean installed unmodified Debian Testing image.

I am not sure what the exact root cause of this discrepancy is, but maybe if heavy users of nano see this issue, they might know how to provide some clarity and suggest what the future default behavior in Termux should be.

What steps will reproduce the bug?

  1. Clean install Termux
  2. Run the nano command and use the Ctrl + O keybind to save a file
  3. Run the editor command and try to use the Ctrl + O keybind to save a file

What is the expected behavior?

nano and editor having identical default behavior while "update-alternatives" has editor set to nano, similar to Debian 12 (and the Debian 13 Testing image as of October 20 2024)

System information

Termux Variables:
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=2351
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.1
TERMUX__USER_ID=0
Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://termux.3san.dev/termux/termux-main stable main
Updatable packages:
apt/stable 2.8.1-1 arm [upgradable from: 2.7.14]
bash/stable 5.2.37 arm [upgradable from: 5.2.26-1]
ca-certificates/stable 1:2024.09.24 all [upgradable from: 1:2024.03.11-2]
command-not-found/stable 2.4.0-47 arm [upgradable from: 2.4.0-29]
coreutils/stable 9.5-3 arm [upgradable from: 9.5]
curl/stable 8.10.1-1 arm [upgradable from: 8.8.0]
debianutils/stable 5.20 arm [upgradable from: 5.19]
dpkg/stable 1.22.6-1 arm [upgradable from: 1.22.6]
findutils/stable 4.10.0 arm [upgradable from: 4.9.0-2]
gpgv/stable 2.4.5-2 arm [upgradable from: 2.4.5-1]
less/stable 661 arm [upgradable from: 633-1]
libandroid-support/stable 29 arm [upgradable from: 28-3]
libassuan/stable 2.5.7-1 arm [upgradable from: 2.5.7]
libc++/stable 27b arm [upgradable from: 26b]
libcurl/stable 8.10.1-1 arm [upgradable from: 8.8.0]
libgcrypt/stable 1.11.0 arm [upgradable from: 1.10.3]
libgpg-error/stable 1.50 arm [upgradable from: 1.49]
liblz4/stable 1.10.0 arm [upgradable from: 1.9.4]
liblzma/stable 5.6.3 arm [upgradable from: 5.6.2]
libnettle/stable 3.10 arm [upgradable from: 3.9.1]
libnghttp2/stable 1.63.0 arm [upgradable from: 1.62.1]
libnghttp3/stable 1.6.0 arm [upgradable from: 1.3.0]
libsmartcols/stable 2.40.2-1 arm [upgradable from: 2.39.3-4]
libssh2/stable 1.11.1 arm [upgradable from: 1.11.0]
libtirpc/stable 1.3.6 arm [upgradable from: 1.3.4-1]
libunbound/stable 1.22.0 arm [upgradable from: 1.20.0]
libunistring/stable 1.3 arm [upgradable from: 1.1]
nano/stable 8.2 arm [upgradable from: 8.0]
ncurses/stable 6.5.20240831-1 arm [upgradable from: 6.4.20231001-4]
openssl/stable 1:3.3.2 arm [upgradable from: 1:3.2.1-1]
patch/stable 2.7.6-4 arm [upgradable from: 2.7.6-3]
readline/stable 8.2.13 arm [upgradable from: 8.2.10]
termux-am/stable 0.8.0-1 all [upgradable from: 0.8.0]
termux-keyring/stable 3.12-1 all [upgradable from: 3.12]
termux-tools/stable 1.44.1 all [upgradable from: 1.42.4]
util-linux/stable 2.40.2-1 arm [upgradable from: 2.39.3-4]
xz-utils/stable 5.6.3 arm [upgradable from: 5.6.2]
zstd/stable 1.5.6-2 arm [upgradable from: 1.5.6]
termux-tools version:
1.42.4
Android version:
7.1.2
Kernel build information:
Linux localhost 3.4.112-Lineage-g716f00ee2e8 #1 SMP PREEMPT Sun Oct 13 11:16:54 CDT 2019 armv7l Android
Device manufacturer:
samsung
Device model:
SPH-L710
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
@robertkirkman robertkirkman added bug report Something is not working properly untriaged labels Oct 20, 2024
@fornwall
Copy link
Member

fornwall commented Oct 20, 2024

I have determined this is an official upstream change implemented in the Nano 8.0 release. Quoted from the release notes:

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".

This behaviour was introduced in nano 8.0, but then reverted in nano 8.1 - https://nano-editor.org/news.php:

2024 July 12 - GNU nano 8.1 "de dag van de bitterkoekjespudding"

  • Modern bindings are not activated when nano's invocation namestarts with "e", as it jars with Debian's alternatives system.

The current version of nano in Termux is 8.2 (https://github.com/termux/termux-packages/blob/master/packages/nano/build.sh), so if you update packages with pkg up you get the desired behaviour. The screenshot shows that you are running version 8.0 of nano, and note the line nano/stable 8.2 arm [upgradable from: 8.0] in your termux-info output).

@Biswa96 Biswa96 added not-bug Issue is not a bug or has been resolved and removed bug report Something is not working properly labels Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-bug Issue is not a bug or has been resolved
Projects
None yet
Development

No branches or pull requests

3 participants