User menu: pattern matching acts not as expected
Eugen Fabian Karban via mc <[email protected]> Wed, 12 Mar 2025 08:48:27 +0000
| Newsgroups | gmane.comp.gnome.apps.mc.general |
|---|---|
| Message-ID | <trinity-356bc803-0870-4541-8989-1cd8eff71175-1741769307308@trinity-msg-rest-webde-webde-live-844f75477-t5dw8> |
--===============4288973046174721004== Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span = style=3D"background-color: rgb(255, 255, 255);">Hello </span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"background-color: rgb(255, 255, 255);"> </span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">I'm n= ot really sure if it's mc problem=2E</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">Tryin= g to match files with spaces in name=2E This fails with foreign chars=2E=2E= =2Ebut strange=2E=2E=2Ejust in mc=2E</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">I'm u= sing:</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;"> </span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;">$ mc -V</span><br><span sty= le=3D"font-family: 'courier new', courier;">GNU Midnight Commander 4=2E8=2E= 22</span><br><span style=3D"font-family: 'courier new', courier;">Kompilier= t mit GLib 2=2E58=2E2</span><br><span style=3D"font-family: 'courier new', = courier;">Benutze die S-Lang Bibliothek mit der terminfo-Datenbank</span><b= r><span style=3D"font-family: 'courier new', courier;">Mit eingebautem Edit= or</span><br><span style=3D"font-family: 'courier new', courier;">Mit optio= naler Subshell-Unterst=C3=BCtzung als Standard</span><br><span style=3D"fon= t-family: 'courier new', courier;">Mit Unterst=C3=BCtzung f=C3=BCr Hintergr= undt=C3=A4tigkeiten</span><br><span style=3D"font-family: 'courier new', co= urier;">Mit Maus-Unterst=C3=BCtzung im xterm und der Linux-Konsole</span><b= r><span style=3D"font-family: 'courier new', courier;">Mit Unterst=C3=BCtzu= ng f=C3=BCr X11-Ereignisse</span><br><span style=3D"font-family: 'courier n= ew', courier;">Mit Internationalisierungs-Unterst=C3=BCtzung</span><br><spa= n style=3D"font-family: 'courier new', courier;">Mit mehrfach Codepage-Unte= rst=C3=BCtzung</span><br><span style=3D"font-family: 'courier new', courier= ;">Virtuelles Dateisystem: cpiofs, tarfs, sfs, extfs, ext2undelfs, ftpfs, s= ftpfs, fish</span><br><span style=3D"font-family: 'courier new', courier;">= Datentyp: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;</s= pan></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;"> Operating System: De= bian GNU/Linux 10 (buster)</span><br><span style=3D"font-family: 'courier n= ew', courier;"> Kernel: Linux 4=2E= 19=2E0-27-amd64</span><br><span style=3D"font-family: 'courier new', courie= r;"> Architecture: x86-64</span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;">$ locale</span><br><span st= yle=3D"font-family: 'courier new', courier;">LANG=3Dde_DE=2EUTF-8</span><br= ><span style=3D"font-family: 'courier new', courier;">LANGUAGE=3D</span><br= ><span style=3D"font-family: 'courier new', courier;">LC_CTYPE=3D"de_DE=2EU= TF-8"</span><br><span style=3D"font-family: 'courier new', courier;">LC_NUM= ERIC=3D"de_DE=2EUTF-8"</span><br><span style=3D"font-family: 'courier new',= courier;">LC_TIME=3D"de_DE=2EUTF-8"</span><br><span style=3D"font-family: = 'courier new', courier;">LC_COLLATE=3D"de_DE=2EUTF-8"</span><br><span style= =3D"font-family: 'courier new', courier;">LC_MONETARY=3D"de_DE=2EUTF-8"</sp= an><br><span style=3D"font-family: 'courier new', courier;">LC_MESSAGES=3D"= de_DE=2EUTF-8"</span><br><span style=3D"font-family: 'courier new', courier= ;">LC_PAPER=3D"de_DE=2EUTF-8"</span><br><span style=3D"font-family: 'courie= r new', courier;">LC_NAME=3D"de_DE=2EUTF-8"</span><br><span style=3D"font-f= amily: 'courier new', courier;">LC_ADDRESS=3D"de_DE=2EUTF-8"</span><br><spa= n style=3D"font-family: 'courier new', courier;">LC_TELEPHONE=3D"de_DE=2EUT= F-8"</span><br><span style=3D"font-family: 'courier new', courier;">LC_MEAS= UREMENT=3D"de_DE=2EUTF-8"</span><br><span style=3D"font-family: 'courier ne= w', courier;">LC_IDENTIFICATION=3D"de_DE=2EUTF-8"</span><br><span style=3D"= font-family: 'courier new', courier;">LC_ALL=3D</span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><br>H= ere my mc user menu:<br>################################<br><span style=3D"= font-family: 'courier new', courier;">shell_patterns=3D0</span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;">+? f [[:space:]] & t r<= /span><br><span style=3D"font-family: 'courier new', courier;">R Rename - R= eplace " " in Name</span><br><span style=3D"font-family: 'courier new', cou= rier;"> rename 's/ /\=2E/g' %f -v</span><br>####= ############################</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">case = 1:<br>filename=3D'file_without_spaces'<br>debug=3DFalsch: f [[:space:]]<br>= result=3Dworks as expected</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"> = ;</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">case = 2:<br>filename=3D'file with spaces'<br>debug=3DWahr: f [[:space:]]<br>resul= t=3Dworks as expected</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"> = ;</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">case = 3:<br>filename=3D'file_without_spaces_utf8_local_chars_=C3=A4_=C3=BC_=C3=B6= _=C3=9F_'<br>debug=3DFalsch: f [[:space:]]<br>result=3Dworks as expected</d= iv> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"> = ;</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">case = 4:<br>filename=3D'file_without_spaces_utf8_nonlocal_chars_=C3=A0_=C3=A1_'<b= r>debug=3DWahr: f [[:space:]]<br>result=3Dworks NOT as expected (WRONG)</di= v> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"> = ;</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">On th= e otherside on the bash level everything works as expected:</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"> = ;</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;">$ var=3D'file_without_space= s'</span><br><span style=3D"font-family: 'courier new', courier;">$ [[ $var= =3D~ [[:space:]] ]] && echo "var has spaces" || echo "var has NO s= paces"</span><br><span style=3D"font-family: 'courier new', courier;">var h= as NO spaces</span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;"> </span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;">$ var=3D'file with spaces'<= /span><br><span style=3D"font-family: 'courier new', courier;">$ [[ $var = =3D~ [[:space:]] ]] && echo "var has spaces" || echo "var has NO sp= aces"</span><br><span style=3D"font-family: 'courier new', courier;">var ha= s spaces</span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;"> </span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;">$ var=3D'file_without_space= s_utf8_local_chars_=C3=A4_=C3=BC_=C3=B6_=C3=9F_'</span><br><span style=3D"f= ont-family: 'courier new', courier;">$ [[ $var =3D~ [[:space:]] ]] &&am= p; echo "var has spaces" || echo "var has NO spaces"</span><br><span style= =3D"font-family: 'courier new', courier;">var has NO spaces</span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;"> </span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;">$ var=3D'file_without_space= s_utf8_nonlocal_chars_=C3=A0_=C3=A1_'</span><br><span style=3D"font-family:= 'courier new', courier;">$ [[ $var =3D~ [[:space:]] ]] && echo "va= r has spaces" || echo "var has NO spaces"</span><br><span style=3D"font-fam= ily: 'courier new', courier;">var has NO spaces</span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"> = ;</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">Using= the pattern "\s" as replacement for "[[:space:]]": the same problems=2E</d= iv> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><br>M= uch more in mc user menu setting the match pattern as :</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;"> </span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;">+? f =C3=A0 & t r</span= ></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"><span= style=3D"font-family: 'courier new', courier;"> </span></div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">filen= ame=3D'file_without_spaces_utf8_nonlocal_chars_=C3=A0_=C3=A1_'<br>debug=3DW= ahr: f =C3=A0<br>result=3Dworks as expected</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;"> = ;</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">Any h= int? Thank You in advance</div> <div style=3D"font-family: 'verdana'; font-size: 12px; color: #000;">Eugen= </div> </div> --===============4288973046174721004== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- mc mailing list [email protected] https://lists.midnight-commander.org/mailman/listinfo/mc --===============4288973046174721004==--