Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Fri, 24 Mar 2023 22:43:44 UTC
Commit: 97c3c9f3be4d68403a47149767e3d02daee1cc7f
https://github.com/geany/geany-osx/commit/97c3c9f3be4d68403a47149767e3d02da…
Log Message:
-----------
pygments shouldn't be needed now when building Geany modules
Modified Paths:
--------------
README.md
Modified: README.md
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -124,13 +124,13 @@ To create the bundle, you need to first install JHBuild and GTK as described bel
6. Install GTK and all of its dependencies by running the following
command inside the `geany-osx` directory:
```
- jhbuild bootstrap-gtk-osx && jhbuild build pygments meta-gtk-osx-bootstrap meta-gtk-osx-gtk3
+ jhbuild bootstrap-gtk-osx && jhbuild build meta-gtk-osx-bootstrap meta-gtk-osx-gtk3
```
The upstream project is sometimes in an unstable state and fails to build;
if this happens, you can use our snapshot of modulesets which was used
to build the last release of Geany:
```
- jhbuild bootstrap-gtk-osx && jhbuild -m "https://raw.githubusercontent.com/geany/geany-osx/master/modulesets-stable/…" build pygments meta-gtk-osx-bootstrap meta-gtk-osx-gtk3
+ jhbuild bootstrap-gtk-osx && jhbuild -m "https://raw.githubusercontent.com/geany/geany-osx/master/modulesets-stable/…" build meta-gtk-osx-bootstrap meta-gtk-osx-gtk3
```
7. To build Geany, plugins and all of their dependencies, run one of
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Tue, 21 Mar 2023 14:46:46 UTC
Commit: dea43baf477ab71650cdfc54fa976714def9c170
https://github.com/geany/geany/commit/dea43baf477ab71650cdfc54fa976714def9c…
Log Message:
-----------
ctags: Add quick path for looking up too long strings in the keyword table
Parser code like
vString *str = vStringNew();
while (someCondition)
{
int c = getcFromInputFile();
vStringPut(str, c);
if (lookupCaseKeyword (vStringValue(str), some_lang))
{
do_stuff();
vStringClear(str);
}
}
is prone to quadratic complexity because when someCondition isn't
satisfied in the parsed file, the string str grows by one in each
iteration and in each iteration lookupCaseKeyword() has to go
through strlen(str) characters to compute the hash.
Since we know the maximum length of the strings inside the keyword
hash table, we can store this value and if the queried string is
longer than this value, we can be sure it isn't present in the hash
table and return quickly without having to compute the full hash of the
string.
Modified Paths:
--------------
ctags/main/keyword.c
Modified: ctags/main/keyword.c
29 lines changed, 25 insertions(+), 4 deletions(-)
===================================================================
@@ -36,6 +36,7 @@ typedef struct sHashEntry {
*/
static const unsigned int TableSize = 2039; /* prime */
static hashEntry **HashTable = NULL;
+static unsigned int MaxEntryLen = 0;
/*
* FUNCTION DEFINITIONS
@@ -70,7 +71,8 @@ static hashEntry *getHashTableEntry (unsigned long hashedValue)
return entry;
}
-static unsigned int hashValue (const char *const string, langType language)
+static unsigned int hashValue (const char *const string, langType language,
+ unsigned int maxLen, bool *maxLenReached)
{
const signed char *p;
unsigned int h = 5381;
@@ -79,11 +81,19 @@ static unsigned int hashValue (const char *const string, langType language)
/* "djb" hash as used in g_str_hash() in glib */
for (p = (const signed char *)string; *p != '\0'; p++)
+ {
h = (h << 5) + h + tolower (*p);
+ if (p - (const signed char *)string > maxLen)
+ {
+ *maxLenReached = true;
+ return 0;
+ }
+ }
/* consider language as an extra "character" and add it to the hash */
h = (h << 5) + h + language;
+ *maxLenReached = false;
return h;
}
@@ -107,8 +117,13 @@ static hashEntry *newEntry (
*/
extern void addKeyword (const char *const string, langType language, int value)
{
- const unsigned int index = hashValue (string, language) % TableSize;
+ bool dummy;
+ const unsigned int index = hashValue (string, language, 1000, &dummy) % TableSize;
hashEntry *entry = getHashTableEntry (index);
+ size_t len = strlen (string);
+
+ if (len > MaxEntryLen)
+ MaxEntryLen = len;
if (entry == NULL)
{
@@ -139,10 +154,16 @@ extern void addKeyword (const char *const string, langType language, int value)
static int lookupKeywordFull (const char *const string, bool caseSensitive, langType language)
{
- const unsigned int index = hashValue (string, language) % TableSize;
- hashEntry *entry = getHashTableEntry (index);
+ bool maxLenReached;
+ const unsigned int index = hashValue (string, language, MaxEntryLen, &maxLenReached) % TableSize;
+ hashEntry *entry;
int result = KEYWORD_NONE;
+ if (maxLenReached)
+ return KEYWORD_NONE;
+
+ entry = getHashTableEntry (index);
+
while (entry != NULL)
{
if (language == entry->language &&
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Fri, 24 Mar 2023 22:10:09 UTC
Commit: eaadbdeba0045d06d0d8a751c5057ed3386f7c3c
https://github.com/geany/geany-osx/commit/eaadbdeba0045d06d0d8a751c5057ed33…
Log Message:
-----------
Patch Scintilla to use \1 as the indicator of block copy
This probably doesn't work well when pasting to other applications and is kind of
hack (on top of another hack) so not submitting to Scintilla as it would probably
be rejected.
Modified Paths:
--------------
geany.modules
geany_patches/01-geany_scintilla_block_copy.patch
Modified: geany.modules
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -116,6 +116,7 @@
<patch file="https://github.com/geany/geany-osx/raw/master/geany_patches/02-geany_scinti…" strip="1" />
<patch file="https://github.com/geany/geany-osx/raw/master/geany_patches/03git-geany_vte…" strip="1" />
<patch file="https://github.com/geany/geany-osx/raw/master/geany_patches/04-geany_workar…" strip="1" />
+ <patch file="https://github.com/geany/geany-osx/raw/master/geany_patches/01-geany_scinti…" strip="1" />
</branch>
<dependencies>
<dep package="geany-deps" />
@@ -134,6 +135,7 @@
<patch file="https://github.com/geany/geany-osx/raw/master/geany_patches/01-geany_config…" strip="1" />
<patch file="https://github.com/geany/geany-osx/raw/master/geany_patches/02-geany_scinti…" strip="1" />
<patch file="https://github.com/geany/geany-osx/raw/master/geany_patches/03-geany_vte_lo…" strip="1" />
+ <patch file="https://github.com/geany/geany-osx/raw/master/geany_patches/01-geany_scinti…" strip="1" />
<!-- TODO: remove for the next release -->
<patch file="https://github.com/geany/geany-osx/raw/master/geany_patches/01-geany_colors…" strip="1" />
</branch>
Modified: geany_patches/01-geany_scintilla_block_copy.patch
54 lines changed, 54 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,54 @@
+From 31d01326bbe39a8b11d1ab0b0f01fe433288c19c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ji=C5=99=C3=AD=20Techet?= <techet(a)gmail.com>
+Date: Fri, 24 Mar 2023 22:55:17 +0100
+Subject: Scintilla: replace \0 indicating block copy with \1
+
+This will almost surely include \1 in other applications but at least
+block copy paste will work within Geany.
+
+diff --git a/scintilla/gtk/ScintillaGTK.cxx b/scintilla/gtk/ScintillaGTK.cxx
+index 7a8c4d0b5..717bb3560 100644
+--- a/scintilla/gtk/ScintillaGTK.cxx
++++ b/scintilla/gtk/ScintillaGTK.cxx
+@@ -1520,14 +1520,14 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio
+ return;
+ }
+
+- // Check for "\n\0" ending to string indicating that selection is rectangular
++ // Check for "\n\1" ending to string indicating that selection is rectangular
+ bool isRectangular;
+ #if PLAT_GTK_WIN32
+ isRectangular = ::IsClipboardFormatAvailable(cfColumnSelect) != 0;
+ #else
+- isRectangular = ((len > 2) && (data[len - 1] == 0 && data[len - 2] == '\n'));
++ isRectangular = ((len > 2) && (data[len - 1] == 1 && data[len - 2] == '\n'));
+ if (isRectangular)
+- len--; // Forget the extra '\0'
++ len--; // Forget the extra '\1'
+ #endif
+
+ #if PLAT_GTK_WIN32
+@@ -1681,8 +1681,14 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se
+ // All other tested applications behave benignly by ignoring the \0.
+ // The #if is here because on Windows cfColumnSelect clip entry is used
+ // instead as standard indicator of rectangularness (so no need to kludge)
+- const char *textData = text->Data();
++
++ // Jiri Techet: Even more evil thing: \0 is dropped by macOS so let's use \1.
++ // This will probably lead to pasting \1 in other applications but at least
++ // makes rectangular copy work in Geany.
++ const char *textData1 = text->Data();
+ gint len = static_cast<gint>(text->Length());
++ char *textData = g_strdup(textData1);
++ textData[len] = '\1';
+ #if PLAT_GTK_WIN32 == 0
+ if (text->rectangular)
+ len++;
+@@ -1695,6 +1701,7 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se
+ static_cast<GdkAtom>(GDK_SELECTION_TYPE_STRING),
+ 8, reinterpret_cast<const guchar *>(textData), len);
+ }
++ g_free(textData);
+ }
+
+ void ScintillaGTK::StoreOnClipboard(SelectionText *clipText) {
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).