Open calebmeyer opened 6 years ago
The code I'm using to test this is on my fix-search branch on the vim-mode-plus-macros repo. When I run a macro that includes a search, dispatching the search commands gives me a promise, which is resolved as [undefined]
(an array containing one element, undefined
).
The buffer I'm testing on just contains two lines, each with the word "hello"
Here's the console log statement
Here's a successful search (found the h
character):
And here's a failed search (did not find z
):
Sorry for my late response. Before going to implement your request, I want clarify basic understanding.
Could you replay macro which include search(/
) as long as search can find match?
I didn't check detail of your packages, but implementing macro on Atom editor is not easy in some situation.
When you search(/
) keyword normally, activeElement become search's mini-editor then your keystrokes would be sent to that activeElement.
When you replay keystroke by dispatch, you need to keep track of shift of activeElement which might or might not be introduced by each keystroke.
Btw what is "Search API command" you are mentioning?
Search API command is the result of dispatching core:confirm
against the mini-editor. I believe it runs search internally.
Ok, its not search API, it’s just atom’s api yo dispatch command programatically.
So, to simplify the issue are you saying you want the promise retuned by core:confirm to the search-mini-editor return different value depending of result, which is curtently same undefined valued arrray.
Am I understanding your request correctly?
Yes. I would either like to be able to determine the success/failure of the search as the result of dispatching core:confirm, or I would like another way to determine it.
Vim-mode-plus knows whether the last search command succeeded or failed, since it has search-state and it is giving me a beep/flash. I just want a way to find that out from my package.
debug info
```json { "atom": "1.26.1", "platform": "win32", "release": "10.0.16299", "vmpVersion": "1.32.0", "vmpConfig": { "automaticallyEscapeInsertModeOnActivePaneItemChange": true, "keymapBackslashToInnerCommentOrParagraphWhenToggleLineCommentsIsPending": true, "keymapCCToChangeInnerSmartWord": true, "keymapPToPutWithAutoIndent": true, "keymapUnderscoreToReplaceWithRegister": true, "keymapYToYankToLastCharacterOfLine": true, "showHoverSearchCounter": true, "statusBarModeStringStyle": "long", "useSmartcaseForSearch": true, "useSmartcaseForSearchCurrentWord": true, "wrapLeftRightMotion": true, "blackholeRegisteredOperators": [], "startInInsertModeScopes": [], "charactersToAddSpaceOnSurround": [], "highlightSearchExcludeScopes": [], "flashOnOperateBlacklist": [] } } ```Read and check all "Check list" bellow.
Check list
You have to check all before open issue.
Vim Mode Plus: Clip Debug Info
command.atom --version
), vim-mode-plus version, and OS version(e.g. macOS Sierra 10.12.3).What
I would like for the search commands to globally store or return some programmatic indication whether the search found any results.
I am aware that searching gives auditory (beep) feedback and visual (flash) feedback, but I don't know that either of those have happened when I dispatch a search command.
Why
I'm maintaining a simplified macro system for vim mode plus over at https://github.com/calebmeyer/vim-mode-plus-macros . This is one of the pieces I think I need to properly support https://github.com/calebmeyer/vim-mode-plus-macros/issues/4 . If I know whether a search is failed, I can stop processing a macro once I hit a search failure.
Versions