Fix some issues with search functionality
All checks were successful
timw4mail/scroll/pipeline/head This commit looks good
All checks were successful
timw4mail/scroll/pipeline/head This commit looks good
This commit is contained in:
parent
85dbd506c6
commit
cd448f74d6
3
justfile
3
justfile
@ -18,6 +18,9 @@ fmt:
|
||||
# Run tests with all the runtimes
|
||||
test: deno-test bun-test
|
||||
|
||||
# Run all code-quality related tasks
|
||||
quality: check test
|
||||
|
||||
# Clean up any generated files
|
||||
clean:
|
||||
rm -rf .deno-cover
|
||||
|
@ -305,14 +305,17 @@ class Editor {
|
||||
'Search: %s (Use ESC/Arrows/Enter)',
|
||||
(query: string, key: string) => {
|
||||
if (key === KeyCommand.Enter || key === KeyCommand.Escape) {
|
||||
this.#document.resetFind();
|
||||
return;
|
||||
if (key === KeyCommand.Escape) {
|
||||
this.#document.resetFind();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (query !== null && query.length > 0) {
|
||||
const pos = this.#document.find(query, key);
|
||||
if (pos !== null) {
|
||||
this.#cursor = pos;
|
||||
this.scroll();
|
||||
} else {
|
||||
this.setStatusMessage('Not found');
|
||||
}
|
||||
@ -322,7 +325,7 @@ class Editor {
|
||||
|
||||
// Return to document position before search
|
||||
// when you cancel the search (press the escape key)
|
||||
if (query !== null) {
|
||||
if (query === null) {
|
||||
this.#cursor = Position.from(savedCursor);
|
||||
this.#offset = Position.from(savedOffset);
|
||||
}
|
||||
|
@ -42,10 +42,7 @@ const DenoFFI: IFFI = {
|
||||
getPointer: Deno.UnsafePointer.of,
|
||||
close: () => {
|
||||
if (!closed) {
|
||||
// Closing appears to do bad things on macOS
|
||||
if (Deno.build.os !== 'darwin') {
|
||||
cStdLib.close();
|
||||
}
|
||||
cStdLib.close();
|
||||
closed = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user