Comments (4)
from textadept.
Thanks for the very quick response :) . In SciTE I am using also a double/triple keypress of Ctrl key and need the release event in order to refrain from coping with timing and side-effects which are unavoidable in case of not being able to track key releases. I suppose that it should be relatively easy to modify the Textadept code to be aware of key releases like SciTE is. It probably needs only one or two lines somewhere to register for key release events with GTK ... is it that simple I suppose it to be? I am ready to cope with C-code if necessary ... Or are any good reasons why key releases are not exposed I am not aware of? By the way: what do you mean with "you'd connect with an index of 1"? And why do is see two calls of the handler function for each single keypress in case of control keys or control+anotherKey presses?
from textadept.
local scc = _SCINTILLA.constants
local sccShift, sccCtrl, sccAlt, sccMeta = scc.MOD_SHIFT, scc.MOD_CTRL, scc.MOD_ALT, scc.MOD_META
local LCtrl=65507 local RCtrl=65508 local otherKeyBefore=1
events.connect(events.KEY,
function(keycode, mods) local shift, ctrl, alt, meta = mods&sccShift>0, mods&sccCtrl>0, mods&sccAlt>0,mods&sccMeta>0
print(keycode, otherKeyBefore,"|",shift,ctrl,alt,meta)
if otherKeyBefore and ctrl and (keycode==LCtrl or keycode==RCtrl) then
otherKeyBefore=nil print("Double CTRL detected!")
-- nil because 0 is true in Lua
else otherKeyBefore=1 end end)
does the job, but ... Cursor keys are not detected ... AND ... because of the double call of the callback function in case of a single keypress of Ctrl it is necessary to suppress the second detection of double CTRL on the second function call.
from textadept.
After some further considerations it seems that for my use-case lifting the restriction: "Textadept does not emit key release events." at cost of responsiveness of the interface is not worth the effort ... What is annoying and should probably be fixed is the double call of the event handler in case of pressing control keys, but to address exactly this issue opening another issue is sure a better way to go, so I am closing this issue here. The not documented events.KEY
was the missing piece I needed to achieve the desired functionality.
from textadept.
Related Issues (20)
- `events.connect(events.LEXER_LOADED,...)` strange behaviour in nightly HOT 2
- Cannot load built-in modules on macOS HOT 2
- how to make current line number have a different color? HOT 5
- ui.print_silent_to() doesn't update the Tab label HOT 1
- lua interpeter scope not working properly HOT 7
- Going for new style snippets, I can't makethem work as per documentation HOT 2
- Problem expanding snippet with $0 HOT 4
- HTML doc files missing from source archive HOT 6
- Feature Request: Help in curses mode should show md files HOT 4
- Textadept Windows support history HOT 1
- lfs.walk() hangs when passed a non-existent directory path. HOT 1
- Building nightly failed on target `termkey-populate` HOT 4
- Stack overflow error with Linux release v12.4 HOT 4
- Closing a non-active buffer via the tab button switches the active buffer when it shouldn't. HOT 2
- Textadept freezes on large csv file HOT 14
- open normal html file and it gives error HOT 6
- not able to open this file HOT 1
- Buggy text in terminal version when maximizing HOT 2
- Suggestion for Find & Replace HOT 4
- 12.4 build failure: invalid use of incomplete typedef ‘WINDOW’ {aka ‘struct _win_st’} HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textadept.