Holding the option key and clicking in terminal lets me position the cursor with the mouse.
I’d like to be able to do the same thing when I’m running mysql in terminal, but it doesn’t work. Is there some kind of setting or escape character that will allow me to use the option click method? Or is there another way to click to position the cursor?
I typically write a long command in mysql with an accidental error, then I hit the up arrow to get that command again, so I can edit it and fix the error. It would be nice if I can use the mouse to click at the spot where the error is, instead of using the left/right arrow key to move the cursor.
For example:
mysql>
CREATE TABLE test_table (col1 INT, blah blah, col3 INT);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'blah, col3 int)' at line 1
After seeing that error, I’d like to hit up to get the command in the prompt again, and then just click at the word ‘blah’ to start editing.
alt+click works to position the cursor.
As @zneak points out in the comments above, it does so by simulating many arrow key inputs.
So, when I tried to position the cursor a few lines up in a multi line command, it would replace the current command with previous commands as if I pressed the up arrow key. So now, if I need to move the cursor one line up, I just alt click to the beginning of the line and press the left arrow key to get to the previous line.