zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
25.26k stars 1.18k forks source link

shift_jis encoding display unsupported in Find, FindLiteral etc #3514

Open zDEFz opened 1 month ago

zDEFz commented 1 month ago

Description of the problem or steps to reproduce

  1. micro -encoding shift_jis abc
  2. insert イギリス人
  3. ctrl+f
  4. ctrl+v イギリス人

both cases of Find

Find: @ @ @ @ Find (regex) @ @ @ @

Expected: Find shows イギリス人

Find still finds the result despite displaying @ @ @ @

image

Specifications

Version: 2.0.15-dev Commit hash: 04c57704 Compiled on August 28, 2024

niten94 commented 1 month ago

The encoding of files is not related with the reason why wide characters are not displayed in the find prompt, but the bug does occur. FYI, it has been reported in #2277.

By the way, what package manager did you use to install micro? It can be seen that the version installed is 2.0.14 when looking at the commit in the issue description, but I noticed that the version written is 2.0.15-dev so I am thinking of trying to see how the version became different. I have seen the version change in another platform (termux/termux-packages#21286) so I think there is another bug in micro introduced recently.

zDEFz commented 1 month ago

The encoding of files is not related with the reason why wide characters are not displayed in the find prompt, but the bug does occur. FYI, it has been reported in #2277.

By the way, what package manager did you use to install micro? It can be seen that the version installed is 2.0.14 when looking at the commit in the issue description, but I noticed that the version written is 2.0.15-dev so I am thinking of trying to see how the version became different. I have seen the version change in another platform (termux/termux-packages#21286) so I think there is another bug in micro introduced recently.

130 % sudo pacman -S micro
warning: micro-2.0.14-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) micro-2.0.14-1

Total Installed Size:  12.19 MiB
Net Upgrade Size:       0.00 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                     [#############] 100%
(1/1) checking package integrity                   [#############] 100%
(1/1) loading package files                        [#############] 100%
(1/1) checking for file conflicts                  [#############] 100%
(1/1) checking available disk space                [#############] 100%
:: Processing package changes...
(1/1) reinstalling micro                           [#############] 100%
:: Running post-transaction hooks...
(1/3) Arming ConditionNeedsUpdate...
(2/3) Updating icon theme caches...
(3/3) Updating the desktop file MIME type cache...

~
% micro -version
Version: 2.0.15-dev
Commit hash: 04c57704

... looking if I have it in paru but no!

~ took 2s
130 % paru micro edit
1 extra/micro 2.0.14-1 [0 B 12.19 MiB] [Installed]
    Modern and intuitive terminal-based text editor
2 aur/micro-git 2.0.12.r8.g1231d242-1 [+17 ~0.00]
    A modern and intuitive terminal-based text editor
3 aur/payara5-micro 5.2020.2-5 [+2 ~0.00]
    A Java EE application server, derived from GlassFish Open Source
    Edition. (Micro Edition)
4 aur/kong-community-edition 1.1.0-1 [+1 ~0.00] [Out-of-date: 2024-02-22]
    Kong is a distributed gateway for APIs and Microservices, focused
    on high performance and reliability.
5 aur/micro-cap 12-1 [+1 ~0.00]
    an integrated schematic editor and mixed analog/digital circuit
    simulator
6 aur/microemulator 2.0.4-3 [+1 ~0.00]
    This is Java 2 Micro Edition (J2ME) CLDC/MIDP Emulator.
:: Packages to install (eg: 1 2 3, 1-3):
::
JoeKar commented 1 month ago

It seems to be simple and we've to remove just this one single line: https://github.com/zyedidia/micro/blob/3cb8069e4a013b73cbe3835cd151e01abe9c309f/internal/display/infowindow.go#L129

zDEFz commented 1 month ago

It seems to be simple and we've to remove just this one single line:

https://github.com/zyedidia/micro/blob/3cb8069e4a013b73cbe3835cd151e01abe9c309f/internal/display/infowindow.go#L129

I commented on your PR as I found one corner case in which it isn't yet working fully.