Delete, Pos1, End, Enter Key Support in the Input Element #2

Closed
opened 2025-07-27 16:46:53 +08:00 by Eric-Bwr · 3 comments
Eric-Bwr commented 2025-07-27 16:46:53 +08:00 (Migrated from github.com)

Hello,

we have a Textbox and would like to know if we did something wrong, or if said keys are not yet supported.

Greetings :)

Hello, we have a Textbox and would like to know if we did something wrong, or if said keys are not yet supported. Greetings :)
AngusAU293 commented 2025-07-27 16:56:21 +08:00 (Migrated from github.com)

Already asked the owner this a while back.

Hey, i don't think that i'll add these features, because i want it to be simple, however this is all you need to make it working for yourself:

    input:onKey(function(self, key)
        local text = self.get("text")
        local width = self.get("width")
        if key == keys.home then
            self.set("cursorPos", 1)
            self.set("viewOffset", 0)
        elseif key == keys["end"] then
            self.set("cursorPos", #text + 1)
            self.set("viewOffset", math.max(0, #text - width + 1))
        end
    end)

- The creator of Basalt (NyoriE)
Original Discord message

Hope this helps!

Already asked the owner this a while back. > Hey, i don't think that i'll add these features, because i want it to be simple, however this is all you need to make it working for yourself: ```lua input:onKey(function(self, key) local text = self.get("text") local width = self.get("width") if key == keys.home then self.set("cursorPos", 1) self.set("viewOffset", 0) elseif key == keys["end"] then self.set("cursorPos", #text + 1) self.set("viewOffset", math.max(0, #text - width + 1)) end end) ``` \- The creator of Basalt (NyoriE) [Original Discord message](https://discord.com/channels/976905222251233320/1361184601212588192/1361911283716325467) Hope this helps!
Eric-Bwr commented 2025-07-27 18:30:17 +08:00 (Migrated from github.com)

Oh wow, thx for the quick reply, i wonder, why is this not merged yet?

Oh wow, thx for the quick reply, i wonder, why is this not merged yet?
Eric-Bwr commented 2025-07-27 18:32:41 +08:00 (Migrated from github.com)

Ah ok, sorry, didnt read it fully, it was answered in the comment. Ok thats sad :( Thx though :)

Ah ok, sorry, didnt read it fully, it was answered in the comment. Ok thats sad :( Thx though :)
Sign in to join this conversation.
No description provided.