endorh / smart-completion

Better Completion for Minecraft Commands
https://www.curseforge.com/minecraft/mc-mods/smart-completion
MIT License
4 stars 1 forks source link

[1.21][sc ? - 2.0.2] Using completion in the middle of an incomplete command truncates subsequent content #6

Closed PTALTS-LK closed 1 week ago

PTALTS-LK commented 2 weeks ago

Describe the bug

Using completion in the middle of an incomplete command truncates subsequent content. This is not friendly to modifications when entering long commands. This issue also existed in previous SC versions.

To Reproduce

Steps to reproduce the behavior:

  1. install minecraft 1.21 and fabric 0.16 and sc 2.0.1
  2. Enter a world (multiplayer or singleplayer)
  3. Perform the following operations in the chat box or command block
  4. Type "/summon minecraft: ~ ~ ~" and move the cursor to "minecraft:" after the colon, use completion, and confirm

Expected behavior

Completes normally like vanilla and doesn't truncate the rest of the content

Screenshots sc:

image image

vanilla:

image image

Additional context nope

endorh commented 2 weeks ago

Oh, I actually did this intentionally. I planned to make it happen only depending on the key used to accept the completion but I forgot 😅

I'm used to the IntelliJ convention of replacing text after the caret when accepting a suggestion with <Tab>, but in this context, since accepting suggestions with <Ctrl> + <Space> inserts a space, I think it'd be more intuitive if completing with <Tab> kept the vanilla behavior of respecting text after the caret, and <Ctrl> + <Space> cleared it, in addition of inserting a space.

In the end, I should make it configurable, but that seems like a sensible default.

I'll change it once I get some free time, probably this week.

endorh commented 2 weeks ago

Also, maybe instead of deleting the text I could only select the remaining text, so any further key would replace it, but it could be kept if desired.

Another improvement would be proper text undo history in the chat bar with <Ctrl>+<Z>/<Y>, but Ig that's a whole new feature. I think that'd be best done across the whole Minecraft UI with a separate mod, one properly designed to minimize potential conflicts with other mods.

I could probably release a new mod that did that, and all the other QoL fixes I'd like to make to UI in general, but I can't give you an ETA for that with how busy I'm gonna be soon.

endorh commented 1 week ago

I've just released a new version (v2.1.0 on CurseForge), which should bring back the Vanilla behavior.

I added options to configure when to erase the input after the cursor depending on the keys used to accept a suggestion. By default, it now erases the text after the cursor only if a suggestion is accepted with <Ctrl>+<Space> or by clicking with the middle mouse button on a suggestion.

Feel free to close the issue if it works for you ^^

PTALTS-LK commented 1 week ago

I've just released a new version (v2.1.0 on CurseForge), which should bring back the Vanilla behavior.

I added options to configure when to erase the input after the cursor depending on the keys used to accept a suggestion. By default, it now erases the text after the cursor only if a suggestion is accepted with <Ctrl>+<Space> or by clicking with the middle mouse button on a suggestion.

Feel free to close the issue if it works for you ^^

👍