How to exit menu in mutt when for instance searching - mutt

I have accidentally pressed, say, n in mutt which puts me into search at the bottom of the screen Search for:. How do I exit from this if I don't want to search? I have tried esc and ctrl-c, but the first doesn't work and the second asks me whether I want to quit mutt, which I don't...

Ctrl-G will exit from all mutt prompts.
This is the standard quit keybinding in Emacs, so its probably inherited from there. Also works in bash.

Related

How to detect when Ctrl+R or tab is pressed on linux?

I am trying to code a custom shell implementation in C++ for linux. In that, I have to implement a functionality which will run when Ctrl+R is pressed, and another when the Tab key is pressed. How do I detect when these two keys are pressed in C++? For Ctrl+C and Ctrl+Z, I used signal() function, but I am at a loss about what to do for these two.

Is there a way to use getChar() in console and not have it include the tabs?

I'm trying to use getchar() to read characters one at a time from a windows console. However, when I hit tab it visually inserts the spacing of a tab in the console, rather than just registering to stdin as \t.
I want to hit tab in the console and not have anything change visually in a console, I want be able to have my code interpret tabs separately.
Is there any way to do this?
I know _getch() does this, it doesn't insert a tab in the console, but I can't use that function because I need signals to be able to be sent.
No, that's not possible because it's unrelated to your program and your code. Most terminals are line buffered (and so are Windows terminal and PowerShell). The terminal will send the input to your program after you pressed enter. Before you press enter your program won't know about any input. You need conio.h with getch or something similar. You can't achieve this behavior with standard library only.

Close a program if a key is being pressed when opening it in osx

I'm trying to make a program that closes itself -or only runs the line of code that closes it- whenever a certain key is in the pressed state when the program is run, so, if I start the program and the 'c' key is pressed, the program must stop.
Note that cin or read doesn't help here, because it waits until you press enter to detect a keystroke. In a way, I'm looking for a way to detect the async key state(because the cursor may not be focused in the program's console window) in osx using c++.

Emulating alt-tab keys causes the menu to get stuck on screen

I need to make a custom hotkey for the alt-tab function. I'm doing this with SendInput by sending the corresponding keys, and it works fine.
However, if a hotkey already includes the alt key, the program only needs to press and release tab; but doing so causes the alt-tab menu to get stuck on screen even, and the only way to make it go away is to close my program. How could that possibly happen, and what does closing my program have to do with the menu disappearing?
On the other hand, sending (alt down)(tab down)(tab up)(alt up) keys regardless of whether alt is already down works in all cases, but I can't rely on this behavior for other reasons.
I'm using WinXP if that helps, I haven't tried it on the Win7 computer yet.
Had a similar problem caused by doing PostMessage WM_KEYDOWN, VK_TAB, in an event triggered by operator clicking ALT-N to cancel an action. The ALT key was thus still down when the tab was sent. Since our code never sends a WM_KEYUP, it must have confused Win XP. Left the alt-tab menu on the screen until the application exited.
I don't know if this related, but Alt+Ctrl+Tab causes the menu to stuck, just like if Alt would stick when press Alt+Tab. So may be you are sending Ctrl signal somehow.

CPP:How to pause resume a running script in cmd line console using mouse?

I am in desperate need of help.... :). I am running a script from cmd line console. It does a sequence of operations. whats the best way to pause the script in between to check the results and resume it back using mouse????? or any key
I would appreciate for your reply back,
-Abishek
If I understand your question correctly, and if your program is writing to the standard output (the console window) and you are running on Windows:
You can turn on 'quick edit' in the console window by editing the cmd.exe window properties.
Open a command prompt (start | run | cmd.exe)
Click the upper left corner of the window and choose 'Defaults'.
Click the Options tab and then in Edit Options section make sure the QuickEdit Mode box is checked.
Click OK and you should be set.
If you click with the mouse inside the console window when quick edit is enabled, it will block the program from continuing while it is waiting to be able to write the next message to the output. If you then hit 'esc', the program will continue.
It's a useful shortcut for pausing a running console program that I use all of the time.
try cin.get()
There isn't any easy way to do that. You'd need to create a wrapper to run the program (for example, a debugger is a wrapper to a program), and this wrapper would have to have mouse functions programmed into it.
Without use of the mouse, use cin.get();. It will take an input from the keyboard before continuing.
I'm not sure about using the mouse to pause, but you can pause the execution of command line process by pressing the Pause / Break key or Ctrl + NumLock .
You can then resume the execution with Ctrl + Z