Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
weird nano cursor traversal
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
necktwi
Apprentice
Apprentice


Joined: 24 Aug 2018
Posts: 168

PostPosted: Fri Aug 24, 2018 3:57 pm    Post subject: weird nano cursor traversal Reply with quote

I have the following line in ~/.bashrc
Code:
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

traversing the cursor over the line with nano, changes the letters into
Code:
[ -x /usrr/bin/lsssspipe && && eva$( "$(SHEbiL=/bin/ssh lessp   pe)"

This doesn't happen in ubuntu

In Gentoo
Code:

# eval "$(SHELL=/bin/sh lesspipe)"
-su: syntax error near unexpected token `newline'

In Ubuntu it gives no output

In Gentoo
Code:

$ lesspipe
Usage: lesspipe <file>

In Ubuntu
Code:

$ lesspipe
export LESSOPEN="| /usr/bin/lesspipe %s";
export LESSCLOSE="/usr/bin/lesspipe %s %s";
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat Aug 25, 2018 12:07 am    Post subject: Re: weird nano cursor traversal Reply with quote

necktwi wrote:
I have the following line in ~/.bashrc
Code:
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

traversing the cursor over the line with nano, changes the letters into
Code:
[ -x /usrr/bin/lsssspipe && && eva$( "$(SHEbiL=/bin/ssh lessp   pe)"

This doesn't happen in ubuntu

necktwi ... by the looks of it this is a terminfo issue, what terminal is in use, and what does 'echo $TERM' show?

necktwi wrote:
In Gentoo
Code:
# eval "$(SHELL=/bin/sh lesspipe)"
-su: syntax error near unexpected token `newline'

In Ubuntu it gives no output

By default gentoo's lesspipe is the one bundled with app-text/less when USE="lesspipe" is set, whereas ubuntu's seems to be a variation of Wolfgang Friebel's lesspipe.sh ... and as you discovered they return different outputs. app-text/lesspipe is Wolfgang Friebel's so all you need do is to re-merge app-text/less with USE="-lesspipe" and emerge app-text/lesspipe. Whatever you use, you should probably be doing the following, and not relying on 'eval' to provide those variables:

~/.bash_profile:
export LESSOPEN="|lesspipe.sh %s 2>&-"

best ... khay
Back to top
View user's profile Send private message
necktwi
Apprentice
Apprentice


Joined: 24 Aug 2018
Posts: 168

PostPosted: Sat Aug 25, 2018 12:58 am    Post subject: $TERM = linux or $TERM = xterm-256color. Reply with quote

It is reproduced on both $TERM = linux or $TERM = xterm-256color.

Yes, I noticed that its not just the fault with
Code:

[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

but any uncommented bash code gives the issue.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat Aug 25, 2018 11:56 am    Post subject: Re: $TERM = linux or $TERM = xterm-256color. Reply with quote

necktwi wrote:
It is reproduced on both $TERM = linux or $TERM = xterm-256color.

necktwi ... can we assume that the issue only shows itself with nano, or are other ncurses applications similarly effected? Can you provide the output of the following:

Code:
% locale ; locale -a
% emerge -pvq app-editors/nano
% emerge --info

best ... khay
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6098
Location: Dallas area

PostPosted: Sat Aug 25, 2018 12:04 pm    Post subject: Reply with quote

Could be ncurses, could be the fonts that you're using.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
necktwi
Apprentice
Apprentice


Joined: 24 Aug 2018
Posts: 168

PostPosted: Sat Aug 25, 2018 2:06 pm    Post subject: Reply with quote

vi is good; nano stumbled
Code:

gentoo ~ # locale ; locale -a
LANG=en_US.utf8
LC_CTYPE=en_US.utf8
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE=C
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=
C
POSIX
en_US.utf8

gentoo ~ # emerge -pvq app-editors/nano
[ebuild   R   ] app-editors/nano-2.8.7  USE="magic ncurses nls spell unicode -debug -justify -minimal -slang -static"

gentoo ~ # emerge --info
Portage 2.3.40 (python 3.6.5-final-0, default/linux/amd64/17.0/desktop/gnome, gcc-7.3.0, glibc-2.26-r7, 4.14.65-gentoo x86_64)
=================================================================
System uname: Linux-4.14.65-gentoo-x86_64-Intel-R-_Core-TM-_i3-2350M_CPU_@_2.30GHz-with-gentoo-2.4.1
KiB Mem:     2016776 total,    611944 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sat, 25 Aug 2018 05:30:01 +0000
Head commit of repository gentoo: e9f35d58f60e07a39f4787d7a471fcc0e267081e
sh bash 4.4_p12
ld GNU ld (Gentoo 2.30 p2) 2.30.0
app-shells/bash:          4.4_p12::gentoo
dev-lang/perl:            5.24.3-r1::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.6.5::gentoo
dev-util/cmake:           3.9.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.34.11::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.15.1-r2::gentoo
sys-devel/binutils:       2.30-r2::gentoo
sys-devel/gcc:            7.3.0-r3::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r3::gentoo
sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)
sys-libs/glibc:           2.26-r7::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts:
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1

dantrell-gnome-3-26
    location: /usr/local/portage/dantrell-gnome-3-26
    sync-type: git
    sync-uri: https://github.com/dantrell/gentoo-overlay-dantrell-gnome-3-26.git
    masters: gentoo
    priority: 100

dantrell-gnome
    location: /usr/local/portage/dantrell-gnome
    sync-type: git
    sync-uri: https://github.com/dantrell/gentoo-overlay-dantrell-gnome.git
    masters: gentoo
    priority: 150

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirrors.163.com/gentoo/ http://ftp.jaist.ac.jp/pub/Linux/Gentoo/ rsync://ftp.jaist.ac.jp/pub/Linux/Gentoo/ ftp://ftp.jaist.ac.jp/pub/Linux/Gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi alsa amd64 berkdb bluetooth branding bzip2 cairo cdda cdr cli colord consolekit crypt cups cxx dbus dri dts dvd dvdr eds emboss encode evo exif fam flac fortran gdbm gif glamor gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk iconv introspection ipv6 jpeg lcms ldap libnotify libsecret libtirpc mad mng modules mp3 mp4 mpeg multilib nautilus ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds pulseaudio qt5 readline sdl seccomp spell ssl startup-notification svg tcpd tiff tracker truetype udev udisks unicode upower usb vorbis wayland wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon plan sheets stage words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby23" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Back to top
View user's profile Send private message
necktwi
Apprentice
Apprentice


Joined: 24 Aug 2018
Posts: 168

PostPosted: Tue Sep 11, 2018 3:54 am    Post subject: Reply with quote

I think PS1 has the effect on this because previously when my PS1 is as below I got the glitch and also an another glitch where terminal instead of wrapping lenghty commands on to the next line, it wrapped on to the same line overlapping current line
Code:

$ echo $PS1
\[\033]0;\u@\h:\w\007\]\[\033[00;36m\]\h\[\033[00m\]:\[\033[00;36m\]\W\[\033[00m\] ${USER}\[\e[00;33m\]\$\[\033[00m\]


but now when I changed my PS1 to the one below, the glitch disappeared, though I couldn't reproduce the glitch by setting PS1 to the above. May be an update!
Code:

$ echo $PS1
\[\033[00;36m\]\h\[\033[00m\]:\[\033[00;36m\]\W\[\033[00m\] ${USER}\[\e[00;33m\]\$\[\033[00m\]


Fixed the closing code tags, changed \ to /. -- desultory
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Tue Sep 11, 2018 12:17 pm    Post subject: Reply with quote

necktwi wrote:
Code:
$ echo $PS1
\[\033]0;\u@\h:\w\007\]\[\033[00;36m\]\h\[\033[00m\]:\[\033[00;36m\]\W\[\033[00m\] ${USER}\[\e[00;33m\]\$\[\033[00m\]

necktwi ... fortunately I'm saved from having to use ansi escape sequences (with zsh you just provide the number) but you might want to do the following and so make the opening/closing of those sequences more obvious:

Code:
reset='\e[0m'       # text reset
black='\e[0;30m'    # black
red='\e[0;31m'      # red
green='\e[0;32m'    # green
yellow='\e[0;33m'   # yellow
blue='\e[0;34m'     # blue
purple='\e[0;35m'   # purple
cyan='\e[0;36m'     # cyan
white='\e[0;37m'    # white

PS1="[\[$yellow\]\u\[$reset\]@\[$yellow\]\h\[$reset\]:\[$blue\] \W\[$reset]$ "

HTH & best ... khay
Back to top
View user's profile Send private message
necktwi
Apprentice
Apprentice


Joined: 24 Aug 2018
Posts: 168

PostPosted: Tue Sep 11, 2018 12:22 pm    Post subject: Reply with quote

Got you!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum