Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: update fts5-html lib

Ammar Ahmed659b937852d8
diff --git a/apps/mobile/patches/react-native-quick-sqlite+8.0.6.patch b/apps/mobile/patches/react-native-quick-sqlite+8.0.6.patch
index 4e3b2752a..8bbf482b6 100644
--- a/apps/mobile/patches/react-native-quick-sqlite+8.0.6.patch
+++ b/apps/mobile/patches/react-native-quick-sqlite+8.0.6.patch
@@ -110719,10 +110719,10 @@ index 0000000..4e379d2
+0.0.2
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..21a952f
--- /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
+**
@@ -110736,6 +110736,7 @@ index 0000000..a426025
+*/
+#include "fts5-html.h"
+#include <ctype.h>
++#include <stdio.h>
+#include <string.h>
+
+#ifndef SQLITE_CORE
@@ -113032,10 +113033,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];
@@ -113400,6 +113408,7 @@ index 0000000..a426025
+ return fts5HtmlInit(db);
+}
+#endif
+\ No newline at end of file
diff --git a/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.h b/node_modules/react-native-quick-sqlite/sqlite3-fts5-html/fts5-html.h
new file mode 100755
index 0000000..ab224e9