#814197 less sails right past first entry in some UTF-8 searches

Package:
less
Source:
less
Description:
pager program similar to more
Submitter:
積丹尼 Dan Jacobson
Date:
2024-05-01 02:15:04 UTC
Severity:
normal
Tags:
#814197#5
Date:
2016-02-09 01:25:35 UTC
From:
To:
Of these two entries,
$ grep -c 1413 TaiwanAMFMSW.kml
2
$ LC_CTYPE=zh_TW.UTF-8 less -N +/1413 TaiwanAMFMSW.kml #works properly
$ LC_CTYPE=zh_TW.UTF-8 less    +/1413 TaiwanAMFMSW.kml # *** sails right
past first entry, landing on the second. Giant bug!

Now type "n". Notice nothing is highlighted anywhere on the screen any
more, but there is no "Pattern not found  (press RETURN)" warning (until
a second "n" is typed.) So less thinks it is showing the reader the
second match, but alas it is not...

#814197#10
Date:
2016-02-09 18:32:04 UTC
From:
To:
 Version table:
 *** 481-2 500
        500 http://free.nchc.org.tw/debian unstable/main i386 Packages
# su - nobody
No directory, logging in with HOME=/
$ env
SHELL=/bin/sh
TERM=xterm
USER=nobody
MAIL=/var/mail/nobody
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
PWD=/
SHLVL=1
HOME=/
LOGNAME=nobody
DISPLAY=:0
_=/usr/bin/env
$ stty size
39 149
MN> 4. Can you remove your $HOME/.less file and unset your LESS environment
user nobody has none.
MN> However I do notice some display problem if I use -N (the opposite of
MN> what you report); if I run

MN> LC_CTYPE=zh_TW.UTF-8 less -N TaiwanAMFMSW.kml

MN> the first line displayed is line 2 rather than line 1 and there is some
MN> corruption in line 5, the first long line.  I'll look into this.

I see corruption, but line 1 is still there.

Narrowing the window
$ stty size
39 73
$ LC_CTYPE=zh_TW.UTF-8 less  +/1413 TaiwanAMFMSW.kml
now works
But now I also see line 1 gone when doing as you do above.

OK I am betting that with a
$ stty size
39 149
you will see my initial problem too.