hluk/FakeVim

Control + S shortcut is not passed to Qt Creator in non-insertion mode

Opened this issue · 23 comments

Control + S shortcut is not passed to Qt Creator in non-insertion mode under Linux.
In Mac, if I press Command + S and file is not changed, fakevim behaves like only key 's' is pressed. It deletes the character under cursor and goes into insertion mode. If there is file change unsaved, it will save the file.

hluk commented

If I press Ctrl+S in FakeVim, file is not saved but nothing happens -- i.e. s command is not triggered either.

Did you test it under Linux or Mac? If it is Linux, nothing happens. In Mac, fakevim interprets Command + s (not ctrl + s) as 's' command.

hluk commented

Yup, I've tested it under Linux. It seems that it checks Ctrl but not Command key. Also I wonder why it's not treated as shortcut.

hluk commented

Patches here and here though they need a bit more testing.

After I updated the fakevimhandler.cpp file to this version https://codereview.qt-project.org/#patch,sidebyside,78305,2,src/plugins/fakevim/fakevimhandler.cpp. The problem became worse in Mac. Some shortcuts, like EasyMotion shortcut <Ctrl+;> that previously can be catched in normal mode now can not be catched by EasyMotion.

hluk commented

You'll have to use both patches in that order for this to work.

Doesn't the second patch already contain the changes from the first patch? I downloaded the second patch, I saw the changes in the first patch is already in the second patch.

hluk commented

If you downloaded the zip file, then the changes from both patches should be there.

That is what I did

hluk commented

Was at least the "<C-S> treated as s" issue fixes with the previous patch?

hluk commented

The reason why shortcut <C-;> for EasyMotion plugin is "eaten" by FakeVim is that the shortcut generate text ; which can be handled by FakeVim.

This really needs to be solved because otherwise you won't be able to differentiate between <C-S-X> and <S-X>.

after the patch the problem is even worse in Mac. Even if there is unsaved
change, fakevim always interprets cmd + s as s commad. before the patch, it
saves the file if there is unsaved change.
On Feb 17, 2014 4:39 AM, "Lukas Holecek" notifications@github.com wrote:

The reason why shortcut <C-;> for EasyMotion plugin is "eaten" by FakeVim
is that the shortcut generate text ; which can be handled by FakeVim.

This really needs to be solved because otherwise you won't be able to
differentiate between and .


Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-35241393
.

hluk commented

Here is fix for <C-S> and s (and others).

If you can, please try mapping some non-US keys -- I've tested few non-latin characters which worked but I expect there to be some exceptions.

I just tested it in Mac, the problem still exists. If there is unsaved change, fakevim saves the file. If there is no change in the file, fakevim interprets cmd + s as s command.

hluk commented

You could uncomment this line and remove this one (sorry, long time nobody has used it) and post the standard output after <C-S> key press.

The following output is from the case when there is unsaved change, and I press cmd +s
SHORTCUT OVERRIDE 16777249 PASSING: false
NO SHORTCUT OVERRIDE 16777249
SHORTCUT OVERRIDE 16777249 PASSING: false
NO SHORTCUT OVERRIDE 16777249
KEYPRESS 16777249 "" '!'
PLAIN MODIFIER
SHORTCUT OVERRIDE 83 PASSING: false
NO SHORTCUT OVERRIDE 83

the following is the output from the case when there is no change and I press cmd + s
SHORTCUT OVERRIDE 16777249 PASSING: false
NO SHORTCUT OVERRIDE 16777249
SHORTCUT OVERRIDE 16777249 PASSING: false
NO SHORTCUT OVERRIDE 16777249
KEYPRESS 16777249 "" '!'
PLAIN MODIFIER
SHORTCUT OVERRIDE 83 PASSING: false
NO SHORTCUT OVERRIDE 83
SHORTCUT OVERRIDE 83 PASSING: false
NO SHORTCUT OVERRIDE 83
SHORTCUT OVERRIDE 83 PASSING: false
NO SHORTCUT OVERRIDE 83
KEYPRESS 83 "s" 'S'

hluk commented

I get the same output. I'll try to put some more useful debug info to the Input class later.

Hello, is there an update? 4.5 years later this is still present in latest Qt Creator :(

hluk commented

Hello, is there an update? 4.5 years later this is still present in latest Qt Creator :(

@pvaibhav I haven't updated the code in a while. You try opening an bug report for Qt Creator if it's not reported there.

A lot might have changed from 2014 to 2015.
QtCreator gives an option to "Pass Control Key" for FakeVim mode. (Tools -> Options -> FakeVim).
When you check that option Ctrl+s was passed to Qt.

Hello, is there an update? 4.5 years later this is still present in latest Qt Creator :(

Tools -> Options -> FakeVim -> Check "Pass Control Key" should do the trick.

Unfortunately that doesn't help (on a Mac). Cmd + S still clears out the whole line, instead of saving the file if there are no unsaved changes.

@pvaibhav one workaround is to put map S <Nop> into the vimrc file used by Qt Creator