Can we say that the delete key works on Stack and backspace works on Queue datastructures ?
Are there any other keyboard functions that work on datastructures that everyone should know ?
Assuming you are just talking about using a keyboard to enter text into a text field, then if you aren't moving your cursor around it is like a stack of characters. Hitting any character-key puts that letter on top of the stack, and hitting the backspace key pops the topmost character off of the stack.
Related
When I am using letter keys and move to arrow keys it's a waste of my time. For that, I use vim in vscode but problem is that I don't use h,j,k,l, etc letter when type. For example: when I type "j" my cursor down but I don't type the letter "j" ..how can I solve the problem?
you can give a try to touchcursor-linux. It basically provides arrow keys and other button functionalities by making space button work as shift. I think it's really intutive and easy....and you don't have to switch to vim keyboard layout as well.
On what action do the NSTextEndEditing notifications contain NSLeftTextMovement & NSRightTextMovement? I was trying to catch left/right/up/down key press inside a text field, but the NSTextMovement key value is always either Tab/BackTab or Return.
This will not work to catch arrow key presses in a text field.
The NSTextDidEndEditingNotification is only sent when focus leaves the field editor. So, NSLeftTextMovement would only be used if/when a press of the left arrow press actually caused focus to leave the field. That's not something that normally happens. I don't know if it might happen when using a matrix of text fields or an NSForm. One could arrange to use a custom field editor and have that end editing on an arrow key press, too, I suppose.
In the Atom Editor i am not able to use the Space bar to insert a space and the delete button to delete characters. It works as a pointer and moves forward and backwards
This is probably caused by having vim-mode enabled, which will cause Atom to use the same behavior as Vi(m).
When you're not in Insert Mode in Vi(m), the Space and Backspace keys will simply move the cursor.
Please try one of the following:
Enter Insert Mode by pressing the "i" key, then try the Space bar again.
Or, disable the vim-mode package to use the regular Atom bindings, which will allow you to use Space for entering a space character.
I have a Firefox extension written in XUL. It takes a hotkey. I want to have an input field where the user can press any key and I can programmatically determine what key was pressed.
I don't care about key combos which have meta meanings inside the OS (I don't need to capture Ctrl + Alt + Del).
If the key is already defined by Firefox, I'm OK with not capturing it (for instance, if the user presses F1 and help pops up instead of the key being captured, I'm fine).
I would also love to have some way to determine programmatically whether the key pressed already has some other meaning inside of Firefox, but that is likely out of scope for this request. I just mention it in case it's easy.
My current solution, which seems to have been adopted by a number of add-ons, is to provide a text box where the user can type a printable character and then a series of check boxes for modifier keys. This solution is barely workable but terrible for a number of reasons (it doesn't allow users to use non-printing keys such as function keys in their combos, it allows the user to input invalid characters (such as Unicode characters with no physical key on the keyboard), and it's just awkward to use).
Thanks!
You can use Inline Options
https://developer.mozilla.org/en-US/Add-ons/Inline_Options
You can detect the key pressed in the text input and write your modifiers like accel or alt.
Source example:
http://git.io/vez1o
sometimes i just want to move either left or right a couple of characters (or go to the end of the line) but don't really want to leave insert mode just to move a couple chars.
I don't know about viemu and visual studio, but in vim, you can use <Ctrl-o> to enter a single command while in insert mode, so <ctrl-o>2l will move you 2 characters to the left, and <ctrl-o>$ will move you to the end of the line.
There is no way of moving the cursor which is easier than just using the arrow keys, thats what they are there for. Insert mode is for inserting text, not navigating the file. If you would like to be so pedantic about not using the arrow key then there is a solution for you:
press
use 'HJKL' keys until at destination
press 'i'