mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 11:47:54 +01:00
mobile: update fts5-html patch
This commit is contained in:
committed by
Abdullah Atta
parent
817a58611e
commit
c389a1ce4d
@@ -110281,17 +110281,17 @@ index 0000000..4881922
|
||||
+```
|
||||
diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/VERSION b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/VERSION
|
||||
new file mode 100755
|
||||
index 0000000..4e379d2
|
||||
index 0000000..bcab45a
|
||||
--- /dev/null
|
||||
+++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/VERSION
|
||||
@@ -0,0 +1 @@
|
||||
+0.0.2
|
||||
+0.0.3
|
||||
diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.c b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.c
|
||||
new file mode 100755
|
||||
index 0000000..a426025
|
||||
index 0000000..4c0b47d
|
||||
--- /dev/null
|
||||
+++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.c
|
||||
@@ -0,0 +1,2677 @@
|
||||
@@ -0,0 +1,2685 @@
|
||||
+/*
|
||||
+** 2023-12-25
|
||||
+**
|
||||
@@ -110305,6 +110305,7 @@ index 0000000..a426025
|
||||
+*/
|
||||
+#include "fts5-html.h"
|
||||
+#include <ctype.h>
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#ifndef SQLITE_CORE
|
||||
@@ -112601,10 +112602,17 @@ index 0000000..a426025
|
||||
+ htmlEscape *e = p->pEscape;
|
||||
+
|
||||
+ int iActualStart = p->iOriginalCur;
|
||||
+ // This breaks the trigram tokenizer
|
||||
+ // if (p->iPlainCur > iStart) {
|
||||
+ // return SQLITE_ERROR;
|
||||
+ // }
|
||||
+
|
||||
+ // if the cursor in plain text is ahead of the position
|
||||
+ // shared by the actual tokenizer, that means we are moving
|
||||
+ // by a different offset instead of from token to token.
|
||||
+ // This is especially the case in trigram tokenizers that
|
||||
+ // iterate over the same word multiple times, each time
|
||||
+ // moving by offset 1.
|
||||
+ if (p->iPlainCur > iStart) {
|
||||
+ // move back the cursor in the actual document
|
||||
+ iActualStart = iActualStart - (p->iPlainCur - iStart);
|
||||
+ }
|
||||
+
|
||||
+ for (int i = p->iPlainCur; i < iStart; i++) {
|
||||
+ iActualStart += e->pLengths[i];
|
||||
@@ -113018,10 +113026,10 @@ index 0000000..ab224e9
|
||||
+#endif /* ifndef SQLITE_FTS5_HTML_H */
|
||||
diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.test.ts b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.test.ts
|
||||
new file mode 100755
|
||||
index 0000000..afcf64e
|
||||
index 0000000..81ce97d
|
||||
--- /dev/null
|
||||
+++ b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.test.ts
|
||||
@@ -0,0 +1,193 @@
|
||||
@@ -0,0 +1,213 @@
|
||||
+/*
|
||||
+ ** 2024-10-21
|
||||
+ **
|
||||
@@ -113180,6 +113188,26 @@ index 0000000..afcf64e
|
||||
+ }
|
||||
+});
|
||||
+
|
||||
+describe("highlight", () => {
|
||||
+ const db = initDatabase();
|
||||
+ afterAll(() => db.close());
|
||||
+
|
||||
+ test("1.0", () => {
|
||||
+ [
|
||||
+ `CREATE VIRTUAL TABLE test USING fts5(x, y, tokenize = 'html trigram remove_diacritics 1');`,
|
||||
+ `INSERT INTO test VALUES('a', '<pre>describe(ContactFormComponent, () => {<br> let component:</pre>');`,
|
||||
+ ].forEach((stmt) => db.query(stmt).run());
|
||||
+ });
|
||||
+
|
||||
+ sqlTest(
|
||||
+ db,
|
||||
+ `1.1`,
|
||||
+ `SELECT highlight(test, 1, '<b>', '</b>') as res FROM test WHERE test MATCH 'component'`,
|
||||
+ [],
|
||||
+ "<pre>describe(ContactForm<b>Component</b>, () => {<br> let <b>component</b>:</pre>",
|
||||
+ );
|
||||
+});
|
||||
+
|
||||
+function sqlTest(
|
||||
+ db: Database,
|
||||
+ version: string,
|
||||
|
||||
Reference in New Issue
Block a user