Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor remains as if suspending on the link after clicking it #325

Closed
OnceThenEver opened this issue Apr 10, 2021 · 48 comments
Closed

Cursor remains as if suspending on the link after clicking it #325

OnceThenEver opened this issue Apr 10, 2021 · 48 comments

Comments

@OnceThenEver
Copy link

OnceThenEver commented Apr 10, 2021

屏幕截图(253)
屏幕截图(256)
屏幕截图(255)
↑↑↑↑ New page, new tab ↑↑↑↑

屏幕截图(254)
↑↑↑↑ Then turn back, and the Wikipedia Page Preview emerged (my cursor wasn't on it). ↑↑↑↑

I have to use LinkHints.activateModeToLeave to remove it.
Nasty, though trivial.

@OnceThenEver OnceThenEver changed the title Mouth pointer remains as if suspending the link after clicking it Mouse pointer remains as if suspending the link after clicking it Apr 10, 2021
@OnceThenEver OnceThenEver changed the title Mouse pointer remains as if suspending the link after clicking it Cursor remains as if suspending on the link after clicking it Apr 10, 2021
@gdh1995
Copy link
Owner

gdh1995 commented Apr 10, 2021

Does Escape work and make it hide?

@OnceThenEver
Copy link
Author

OnceThenEver commented Apr 10, 2021

Does Escape work and make it hide?

Neither

@gdh1995
Copy link
Owner

gdh1995 commented Apr 10, 2021

The card shows because when you switch back, the page finds the link of goals "gets focused again". And this behavior also occurs when I hold on Ctrl+Shift, click the link, move mouse to blank area and switch back.

To work around it, use map f LinkHints.activateMode autoUnhover.

@gdh1995
Copy link
Owner

gdh1995 commented Apr 10, 2021

BTW, autoUnhover may prevent LinkHints from making some websites show a card and then clicking it. So if you want you may use a trick to make it only for Wikipedia - https://github.com/gdh1995/vimium-c/wiki/Map-a-key-to-different-commands-on-different-websites .

@OnceThenEver
Copy link
Author

OnceThenEver commented Apr 10, 2021

In the tutorial you provided, map <c-j:i> confused me;

To work around it, use map f LinkHints.activateMode autoUnhover.

there are plenty of parameters and commands, like <c-j:i> and autoUnhover, that I didn't see in any place, including Vimium-C setting page, tutorials in GitHub, and the page you provided in List of all commands at wiki: https://github.com/gdh1995/vimium-c/blob/master/types/messages.d.ts (abandoned).

So I think there must be more interesting commands that worth leanring, that I didn't know and can't find in normal ways.
I hope that the tutorials at github.com/gdh1995/vimium-c/wiki will get an augmentation.

@gdh1995
Copy link
Owner

gdh1995 commented Apr 10, 2021

Um I haven't written a help page friendly to non programmers. Up to now, there's only raw source code declaring them.

I've updated the wiki page of https://github.com/gdh1995/vimium-c/wiki/List-of-all-commands , and you can take a look at types/messages.d.ts#CmdOptions and background/typed_commands.d.ts.

@gdh1995
Copy link
Owner

gdh1995 commented Apr 10, 2021

@OnceThenEver
Copy link
Author

OnceThenEver commented Apr 11, 2021

map ' runKey expect={"input":"blank"} keys="<esc>"
env input element="input"

My lines. ↑
When not focus on the input box I can't use ' to cancel enterInsertMode

map ' runKey expect={"input":"blank"} keys="<f1>"
mapKey <f1> <esc>

Neither did these. ↑

map <':i> runKey expect={"input":"blank"} keys=<f1>
Even after adding :i

But f1 works in Insert Mode.

@gdh1995
Copy link
Owner

gdh1995 commented Apr 11, 2021

Update: https://github.com/gdh1995/vimium-c/wiki/Map-a-key-to-different-commands-on-different-websites has been updated.

<esc> seems not a valid key sequence in your mappings. Here the "keys" field means a valid "key sequence" which has been used in map xxxKeys xxxCommand.

The value of expect field can be a Map of env-name and key-sequence, so it should not be blank.

That is to say, corrected mappings may be:

env input element="input"
map ' runKey expect={"input":"<v-blank>"} keys="gF"
map <v-blank> blank
# note: the below "gF" has been mapped to "mainFrame" by default
map gF mainFrame

As for mapKey, it does not affect runKey - it's consumed when recognizing keyboard events - before triggering map rules.

Currently there's no command which works exactly as the key <esc> does. So why do you want it?

@OnceThenEver
Copy link
Author

I'd like to make ' act as Escape to exit Insert Mode for that Escape is a tiny and marginal key on keyboard, and actually type in character ' when in input box.

In practice, mapKey ' <esc> will always behave like Escape whether or not it's in input box.

@gdh1995

This comment has been minimized.

@gdh1995
Copy link
Owner

gdh1995 commented Apr 11, 2021

Sorry, the last commit is wrong. Please try:

mapKey ' <esc>
mapKey <':i> '

@gdh1995
Copy link
Owner

gdh1995 commented Apr 11, 2021

As for this specific requirement, I have a different idea: I use AutoHotKey to map keys in system level:

!CapsLock:: CapsLock
CapsLock:: Escape

The code means CapsLock is treated as Escape, and Alt+CapsLock switches the "Caps" mode.

@OnceThenEver
Copy link
Author

mapKey ' <esc>
mapKey <':i> '

These didn't work neither ↑

!CapsLock:: CapsLock
CapsLock:: Escape

These were really confusing to me and I pasted them into Shortcut Customization only to get an error message:
"Error: Unknown mapping command: "CapsLock::" in CapsLock:: Escape."

@gdh1995
Copy link
Owner

gdh1995 commented Apr 11, 2021

The second is code for AutoHotKey: https://www.autohotkey.com/

@gdh1995
Copy link
Owner

gdh1995 commented Apr 11, 2021

I'd like to make ' act as Escape to exit Insert Mode for that Escape is a tiny and marginal key on keyboard, and actually type in character ' when in input box.

This sentence itself is inconsistent. When an input box gets focused, Vimium C auto enters an Insert Mode.

@OnceThenEver
Copy link
Author

OnceThenEver commented Apr 11, 2021

The Insert Mode I meant is enterInsertMode 暂停识别快捷键

@gdh1995
Copy link
Owner

gdh1995 commented Apr 11, 2021

map xxx enterInsertMode key="'".

Or you may use https://github.com/gdh1995/vimium-c/wiki/Enable-or-Disable-all-frames-by-a-shortcut .

@OnceThenEver
Copy link
Author

map xxx enterInsertMode key="'".

Though I still can't figure out what does key="'" mean and this line doesn't work,

Or you may use https://github.com/gdh1995/vimium-c/wiki/Enable-or-Disable-all-frames-by-a-shortcut .

is exactly what I need.

Thank you for your help!

@gdh1995
Copy link
Owner

gdh1995 commented Apr 11, 2021

What I expect is, key is an option of the command enterInsertMode, and if given, enterInsertMode will wait for such a key (in this case, it's ') before exiting. But such a key option won't take document.activeElement into consideration, which means ' will still exit the global InsertMode even when <input> is focused.

As a result, I once added a limit to this option: its length must > 1 - only those like <longName> or <a-/> are accepted. This is why key="'" doesn't work yet today...

Sorry for my mistake.

Do you think it's a common requirement to allow such printable characters as enterInsertMode's "exiting key"?

@OnceThenEver
Copy link
Author

OnceThenEver commented Apr 11, 2021

Every user of this extension must be one who cannot tolerate the hand movement between mouse and keyboard, though it just takes about 0.1s, because even 0.1s is forever long.

I can even describe this fetish as sensitive and idle, but I was not being negative about it, because technology's existence, to some extent, attributes to human's idleness to saving labor.

So users would like to have all kinds of action done as few hand movements as possible.

I think it's uncommon, really, but when geeks' right forefinger is on J, isn't ' just the nearest key from little finger, if not ; (as the majority, my handedness is the right)?

@gdh1995
Copy link
Owner

gdh1995 commented Apr 11, 2021 via email

@OnceThenEver
Copy link
Author

Add , & ., they two are also common keys.

@OnceThenEver
Copy link
Author

OnceThenEver commented May 3, 2021

In 1.89.1,

map <v-f1> LinkHints.activateMode autoUnhover
map <v-f2> LinkHints.activate clickable="#thumbnail"
map f runKey expect={"youtube":"<v-f2>"} keys="<v-f1>"

<v-f2> works at YouTube, but autoUnhover in <v-f1> remains as if doesn't exist.

map f LinkHints.activate autoUnhover
did work, though.

@OnceThenEver
Copy link
Author

map <v-f1> LinkHints.activateMode autoUnhover
map <v-f2> LinkHints.activate clickable="#thumbnail"

map f runKey expect={"youtube":"<v-f2>"} keys="<v-f1>"

env youtube host="https://www.youtube.com/"

@OnceThenEver
Copy link
Author

My codes are the same as when in 1.89.0

@gdh1995

This comment has been minimized.

@gdh1995
Copy link
Owner

gdh1995 commented May 5, 2021

Confirmed that runKey will directly select the first item in its expect option, whatever your "env" is.

This bug should only exist in the developing code, but not released versions.

And this can be worked around by adding a new option of $if={} to map ... runKey .....

@OnceThenEver
Copy link
Author

1.89.1 is from #328.

This bug should only exist in the developing code, but not released versions.

For your words, I'll wait until the next release.
Thank you!

gdh1995 added a commit that referenced this issue May 7, 2021
for #325 (comment)

key mappings: make all instructions accept `$if`, to reduce mental burden
@OnceThenEver
Copy link
Author

Reopen this issue for one dilemma:
Due to #439, I have to give up using autoUnhover to select between choices of the list, but if so, the consequence will be as the above. Even though I may resort to your trick, configuring so many sites is cumbersome and tiring. Being able to cancel the focus by Esc after LinkHinting is properly logical, isn't it?

@OnceThenEver OnceThenEver reopened this Oct 10, 2021
@OnceThenEver
Copy link
Author

@gdh1995

@gdh1995
Copy link
Owner

gdh1995 commented Oct 11, 2021

Got. I'd like to update autoUnhover to skip <select>, and make it a boolean or a string of CSS-selector, to allow you to customize its logic.

And add autoUnhover="<esc>" to hook Escape/Ctrl+[ to do "unhover".

@gdh1995
Copy link
Owner

gdh1995 commented Oct 11, 2021

I'll update the action for long-pressed <esc> in normal mode, from target.blur() to unhover(target) and target.blur(). Then you won't need any special parameters - just a repeated Escape is enough. If you doesn't like it you may use autoUnhover="<esc>" to use a simple Escape key.

@OnceThenEver
Copy link
Author

Next release, right?

@OnceThenEver
Copy link
Author

I was directed to here from release v1.93.0.
Can I use parameter autoUnhover="<a-m>" or even autoUnhover="<esc>, <a-m>"?

@gdh1995
Copy link
Owner

gdh1995 commented Oct 29, 2021

if autoUnhover[0] is "<", then it can only be <esc>, which has a same effect with true. And then it will means to <esc> and <c-[>.

Updated: if autoUnhover is true, then Vimium C will unhover at once.

You may use pre-mode mapKey to make other keys act like <esc> in LinkHints, like mapKey <a-m:l> <esc>

@OnceThenEver
Copy link
Author

Before getting your advice, I have mapKey <a-m> <esc>, but it doesn't help.
Now my whole mappings are:

mapKey <a-m> <esc>
mapKey <a-m:l> <esc>
map f LinkHints.activate autoUnhover="<esc>"

and it's still the case.

@gdh1995
Copy link
Owner

gdh1995 commented Oct 29, 2021

what did you mean by the case? Are you using macOS?

@OnceThenEver
Copy link
Author

OnceThenEver commented Oct 29, 2021

what did you mean by the case?

I mean my whole mappings still can't make ⌥m cancel the focus.
And, yes, I use macOS. My preferences are following.
截屏2021-10-29 14 39 01

@gdh1995
Copy link
Owner

gdh1995 commented Oct 29, 2021

What is ⌥⏎?

@OnceThenEver
Copy link
Author

OnceThenEver commented Oct 29, 2021

for macOS: option + enter
for Windows: Alt + enter
BTW, I like symbols^_^

@gdh1995
Copy link
Owner

gdh1995 commented Oct 29, 2021

But <a-m> is Alt + English Letter M. So what's the misunderstanding between us?

@gdh1995
Copy link
Owner

gdh1995 commented Oct 29, 2021

OK. sorry but I just find a bug. When you press Alt, a function will exit itself at once and then no <a-m> will be consumed by LinkHints.

@OnceThenEver
Copy link
Author

Sorry, that's a typo, I mean ⌥m.

@OnceThenEver
Copy link
Author

Solved to the 2nd term of release note 1.95.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants