-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Implement very basic find API #704
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general the code looks great. I made a couple of documentation comments.
My main concern about this is that it is bloating the core of the library, since "search" functionality is not essentially part of a terminal emulator.
I would prefer if we could offload this somehow to an add-on or something like that that can be "excluded" at build time.
Edit: I definitely want to see this merged into the code base, but I want us to consider a different place, rather than the core.
src/SelectionManager.ts
Outdated
@@ -156,6 +157,9 @@ export class SelectionManager extends EventEmitter { | |||
this._buffer = buffer; | |||
} | |||
|
|||
public get selectionStart(): [number, number] { return this._model.finalSelectionStart; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you document these with JSDoc please?
@@ -566,14 +521,22 @@ export class SelectionManager extends EventEmitter { | |||
return charIndex; | |||
} | |||
|
|||
public setSelection(col: number, row: number, length: number): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you document this with JSDoc please?
👍 I can look into pulling this out into an addon. It will have to use private API. as long as we have good testing to prevent regressions that shouldn't matter though. |
Since we are the ones implementing and maintaining it, I think it's totally OK to use private APIs in add-ons. |
@parisk any comments on the current approach? I managed to get search working as both the first multi-file and first TypeScript addon. Right now we can't touch anything outside of TODO:
|
@Tyriar the implementation looks good to me 👍 . I also liked that this introduces the first TypeScript add-on 😄 . A couple of to-dos after merging this PR:
|
df0303a
to
0a15877
Compare
@parisk ready for review, after wrestling with Travis for 30 minutes 😛 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing! 🚀
Wooo 🎉 ! |
This PR exposes 2 new functions on
Terminal
:Currently they scroll to and select the matching search term (using the selection model introduced in #670).
Fixes #553