diff --git a/sys/apis/entry.lua b/sys/apis/entry.lua index e19f55c..8126960 100644 --- a/sys/apis/entry.lua +++ b/sys/apis/entry.lua @@ -361,7 +361,7 @@ function Entry:process(ie) local action = mappings[ie.code] self.textChanged = false - +_debug(ie) if action then local pos = self.pos local line = self.value diff --git a/sys/apis/input.lua b/sys/apis/input.lua index a1e91a6..94d9c91 100644 --- a/sys/apis/input.lua +++ b/sys/apis/input.lua @@ -76,11 +76,18 @@ function input:translate(event, code, p1, p2) if p1 then -- key is held down if not modifiers[code] then self.fired = true - return { code = input:toCode(keys.getName(code), code) } + local ch = input:toCode(keys.getName(code), code) + if #ch == 1 then + return { + code = 'char', + ch = ch, + } + end + return { code = ch } end else self.state[code] = true - if self:modifierPressed() and not modifiers[code] or code == 57 then + if self:modifierPressed() and not modifiers[code] then --or code == 57 then self.fired = true return { code = input:toCode(keys.getName(code), code) } else @@ -89,8 +96,7 @@ function input:translate(event, code, p1, p2) end elseif event == 'char' then - if not keyboard.state[keys.leftAlt] and - not keyboard.state[keys.rightAlt] then + if not self.fired then self.fired = true return { code = event, ch = code } -- return { code = event, ch = input:toCode(code) } diff --git a/sys/apps/shell.lua b/sys/apps/shell.lua index 5c9ecea..d415c11 100644 --- a/sys/apps/shell.lua +++ b/sys/apps/shell.lua @@ -362,6 +362,7 @@ local Config = require('config') local Entry = require('entry') local History = require('history') local Input = require('input') +local Sound = require('sound') local Terminal = require('terminal') local colors = _G.colors @@ -640,6 +641,8 @@ local function shellRead(history) entry:unmark() entry:updateScroll() redraw() + else + Sound.play('entity.villager.no') end end