getch and arrow codes

By pressing one arrow key getch will push three values into the buffer: ‘\033’ ‘[‘ ‘A’, ‘B’, ‘C’ or ‘D’ So the code will be something like this: if (getch() == ‘\033’) { // if the first value is esc getch(); // skip the [ switch(getch()) { // the real value case ‘A’: // code … Read more

How to speed up the left and right arrow keys for editing text? [closed]

To change how fast a key repeats when holding it down, adjust this setting: “System Preferences” -> “Keyboard” -> “Keyboard Tab” -> “Keyboard Repeat” To change how long you have to hold it down before it registers as repeating, adjust this setting: “System Preferences” -> “Keyboard” -> “Keyboard Tab” -> “Delay Until Repeat”

Disable arrow key scrolling in users browser

Summary Simply prevent the default browser action: window.addEventListener(“keydown”, function(e) { if([“Space”,”ArrowUp”,”ArrowDown”,”ArrowLeft”,”ArrowRight”].indexOf(e.code) > -1) { e.preventDefault(); } }, false); If you need to support Internet Explorer or other older browsers, use e.keyCode instead of e.code, but keep in mind that keyCode is deprecated and you need to use actual codes instead of strings: // Deprecated code! … Read more