mirror of
https://github.com/kepler155c/opus
synced 2025-01-05 21:30:28 +00:00
better text entry
This commit is contained in:
parent
c9ef150605
commit
78402e89cd
@ -361,7 +361,7 @@ function Entry:process(ie)
|
|||||||
local action = mappings[ie.code]
|
local action = mappings[ie.code]
|
||||||
|
|
||||||
self.textChanged = false
|
self.textChanged = false
|
||||||
|
_debug(ie)
|
||||||
if action then
|
if action then
|
||||||
local pos = self.pos
|
local pos = self.pos
|
||||||
local line = self.value
|
local line = self.value
|
||||||
|
@ -76,11 +76,18 @@ function input:translate(event, code, p1, p2)
|
|||||||
if p1 then -- key is held down
|
if p1 then -- key is held down
|
||||||
if not modifiers[code] then
|
if not modifiers[code] then
|
||||||
self.fired = true
|
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
|
end
|
||||||
else
|
else
|
||||||
self.state[code] = true
|
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
|
self.fired = true
|
||||||
return { code = input:toCode(keys.getName(code), code) }
|
return { code = input:toCode(keys.getName(code), code) }
|
||||||
else
|
else
|
||||||
@ -89,8 +96,7 @@ function input:translate(event, code, p1, p2)
|
|||||||
end
|
end
|
||||||
|
|
||||||
elseif event == 'char' then
|
elseif event == 'char' then
|
||||||
if not keyboard.state[keys.leftAlt] and
|
if not self.fired then
|
||||||
not keyboard.state[keys.rightAlt] then
|
|
||||||
self.fired = true
|
self.fired = true
|
||||||
return { code = event, ch = code }
|
return { code = event, ch = code }
|
||||||
-- return { code = event, ch = input:toCode(code) }
|
-- return { code = event, ch = input:toCode(code) }
|
||||||
|
@ -362,6 +362,7 @@ local Config = require('config')
|
|||||||
local Entry = require('entry')
|
local Entry = require('entry')
|
||||||
local History = require('history')
|
local History = require('history')
|
||||||
local Input = require('input')
|
local Input = require('input')
|
||||||
|
local Sound = require('sound')
|
||||||
local Terminal = require('terminal')
|
local Terminal = require('terminal')
|
||||||
|
|
||||||
local colors = _G.colors
|
local colors = _G.colors
|
||||||
@ -640,6 +641,8 @@ local function shellRead(history)
|
|||||||
entry:unmark()
|
entry:unmark()
|
||||||
entry:updateScroll()
|
entry:updateScroll()
|
||||||
redraw()
|
redraw()
|
||||||
|
else
|
||||||
|
Sound.play('entity.villager.no')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user