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