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

Remove backwards in insert mode is broken #113

Open
iamevie opened this issue Dec 5, 2023 · 14 comments
Open

Remove backwards in insert mode is broken #113

iamevie opened this issue Dec 5, 2023 · 14 comments
Labels
bug Something isn't working

Comments

@iamevie
Copy link
Contributor

iamevie commented Dec 5, 2023

When I try to remove the character on the right of my cursor in insert mode using the remove key, Lilly won't remove it but kind of bug out. Below I've attached a video of me using remove in Neovim and in Lilly to demonstrate what I mean.

2023-12-05_21-44-27.mp4
@tauraamui
Copy link
Owner

Do you mean the DELETE key? :)

@iamevie
Copy link
Contributor Author

iamevie commented Dec 5, 2023

Yes that's the one. In German, it's called the remove key.
Nevertheless, is it suppose to work?

@tauraamui
Copy link
Owner

Yes that's the one. In German, it's called the remove key. Nevertheless, is it suppose to work?

No, specifically because it doesn't work, it's supposed to be disabled. Well, I say disabled but really what I mean is we've disabled the key as found on ISO standard layout keyboards. What's actually happening when you enter keys which don't technically represent a normal visible character (either ANSI or UTF-8) that we're not handling the functionality of, it's really inserting a bunch of values as UTF-8 code points into the document which don't make sense, and causing whitespace to appear and the cursor to freak out.

@tauraamui
Copy link
Owner

Can you please try this example project in the V lang repo: https://github.com/vlang/v/blob/master/examples/term.ui/event_viewer.v and provide a list of the output if you press practically every key?

@iamevie
Copy link
Contributor Author

iamevie commented Dec 5, 2023

No, specifically because it doesn't work, it's supposed to be disabled. Well, I say disabled but really what I mean is we've disabled the key as found on ISO standard layout keyboards. What's actually happening when you enter keys which don't technically represent a normal visible character (either ANSI or UTF-8) that we're not handling the functionality of, it's really inserting a bunch of values as UTF-8 code points into the document which don't make sense, and causing whitespace to appear and the cursor to freak out.

I'm not using a standard ISO layout, which is probably why it still inserts the UTF-8 bytes. That's on me, but good to know!

@tauraamui
Copy link
Owner

No, specifically because it doesn't work, it's supposed to be disabled. Well, I say disabled but really what I mean is we've disabled the key as found on ISO standard layout keyboards. What's actually happening when you enter keys which don't technically represent a normal visible character (either ANSI or UTF-8) that we're not handling the functionality of, it's really inserting a bunch of values as UTF-8 code points into the document which don't make sense, and causing whitespace to appear and the cursor to freak out.

I'm not using a standard ISO layout, which is probably why it still inserts the UTF-8 bytes. That's on me, but good to know!

It shouldn't be on you, we should be handling all layouts the same, I thought the module for term ui generalised this stuff, but it looks like we might need to do some locale handling after all.

@iamevie
Copy link
Contributor Author

iamevie commented Dec 5, 2023

image

Here you go :)

@valxntine
Copy link
Collaborator

valxntine commented Dec 5, 2023

image

Here you go :)

I believe it also captures mouse movements so if you press the key then move your mouse it'll change the event captured, if you're able to run it again, I'd take a screen recording of you pressing the delete key :)

@tauraamui
Copy link
Owner

I'm interested to see a list of all of the keys you have, probably in text form but you'd have to adjust the example slightly to append it's output to a file and show it within the console.

@iamevie
Copy link
Contributor Author

iamevie commented Dec 5, 2023

I've managed to capture the right key
image
In general, it may be good to know that I don't use a normal keyboard but instead this one. In addition, I don't use qwertz or qwerty but colemak as a layout.

@tauraamui
Copy link
Owner

I've managed to capture the right key image In general, it may be good to know that I don't use a normal keyboard but instead this one. In addition, I don't use qwertz or qwerty but colemak as a layout.

That's very helpful, thank you. That's interesting. In order to solve this issue, what I think we should really do is just have better support/understanding of different key layouts and board layouts and how to map between them. Let me go away and think of something to send you which we can use to send you to gather some data regarding your setup.

@tauraamui
Copy link
Owner

Basically, the functionality regarding key information we're receiving from term.ui currently is not good enough. It's identified your key's code as null which is not an identifier we can use. Therefore we will have to do some manual extra work to identify your keyboard's layout and do some internal mapping or similar.

@iamevie
Copy link
Contributor Author

iamevie commented Dec 5, 2023

Basically, the functionality regarding key information we're receiving from term.ui currently is not good enough. It's identified your key's code as null which is not an identifier we can use. Therefore we will have to do some manual extra work to identify your keyboard's layout and do some internal mapping or similar.

Is that something I could do or that could be automated using a script? Something along the lines of 'oh you have a custom layout? Please press these keys in order to configure Lilly'

@valxntine valxntine added the bug Something isn't working label Dec 5, 2023
@tauraamui
Copy link
Owner

tauraamui commented Dec 6, 2023

Basically, the functionality regarding key information we're receiving from term.ui currently is not good enough. It's identified your key's code as null which is not an identifier we can use. Therefore we will have to do some manual extra work to identify your keyboard's layout and do some internal mapping or similar.

Is that something I could do or that could be automated using a script? Something along the lines of 'oh you have a custom layout? Please press these keys in order to configure Lilly'

It's something which would ask X11 or Wayland, or (Windows UI?) whatever is being used as the window manager for the current layout and we would just need to have a set of mappings for each known one. For example, if I run localectl list-x11-keymap-layouts | tr -s '\n' ',' | pbcopy on my machine this tells me there's approx 99 different language specific layouts known to X11.

af,al,am,ara,at,au,az,ba,bd,be,bg,br,brai,bt,bw,by,ca,cd,ch,
cm,cn,cz,de,dk,dz,ee,epo,es,et,fi,fo,fr,gb,ge,gh,gn,gr,hr,hu,
id,ie,il,in,iq,ir,is,it,jp,jv,ke,kg,kh,kr,kz,la,latam,lk,lt,lv,ma,mao,
md,me,mk,ml,mm,mn,mt,mv,my,nec_vndr/jp,ng,nl,no,np,ph,
pk,pl,pt,ro,rs,ru,se,si,sk,sn,sy,tg,th,tj,tm,tr,tw,tz,ua,us,uz,vn,za,

Having said that, I doubt Neovim is doing something similar to this, but I have yet to do enough research and reading to check. If Neovim is doing some magical easier technique realistically we should be doing the same. This is the first time I'm trying to solve a problem such as this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants