jendrikseipp / rednotebook

RedNotebook is a cross-platform journal
https://rednotebook.app
GNU General Public License v2.0
477 stars 109 forks source link

Hashtags that happen to contain HEX characters (A - F) and are 6 characters or more are not captured as hashtags #738

Closed bpowell2008 closed 5 months ago

bpowell2008 commented 7 months ago

Describe the bug If a hashtag happens to consist of hex characters in the first 6 characters, the application will format them as Hashtags, but will not add them to the hashtag word cloud, or allow searching on that particular hash-tag... for example:

Deadbedroom

aeacba

Those two hashtags are not searchable .... the first is an actual term .... the second is just a set of characters I put together for testing.

To Reproduce

  1. Go to 'Journal entry'
  2. Add a #hashtag that consists of hex characters, and is at least 6 characters long, e.g. #aeacba
  3. Restart application and check hashtag cloud for the new hashtag; or, try to select it from the drop-down
  4. The hashtag is not there.

Expected behavior I would expect any hashtag would be searchable, and included in the hashtag cloud.

Screenshots

Versions:

Log output when reproducing bug 2023-12-13 20:36:09,086 INFO Writing log to file "/config/.rednotebook/rednotebook.log" 2023-12-13 20:36:09,086 INFO System encoding: utf-8 2023-12-13 20:36:09,086 INFO Language code: en_US 2023-12-13 20:36:09,096 INFO Spell checking languages: ['en_US'] 2023-12-13 20:36:09,096 INFO Spell checking dictionaries: [('en_US', )] 2023-12-13 20:36:09,173 INFO Using LibYAML 2023-12-13 20:36:09,174 INFO Connected Signals: [<Signals.SIGHUP: 1>, <Signals.SIGINT: 2>, <Signals.SIGQUIT: 3>, <Signals.SIGABRT: 6>, <Signals.SIGTERM: 15>, <Signals.SIGTSTP: 20>] 2023-12-13 20:36:09,175 INFO Running in portable mode: False 2023-12-13 20:36:09,176 INFO First Start: False 2023-12-13 20:36:09,176 INFO RedNotebook version: 2.31 2023-12-13 20:36:09,177 INFO System info: machine: x86_64, platform: Linux-5.15.0-89-generic-x86_64-with-glibc2.35, processor: x86_64, python_version: 3.10.12, release: 5.15.0-89-generic, system: Linux, GTK: (3, 24, 33), Glib: (2, 71, 3), PyGObject: (3, 42, 1), YAML: 5.4.1, WebKit2: (2, 42, 2) 2023-12-13 20:36:09,331 DEBUG Default font: Ubuntu 11 2023-12-13 20:36:09,332 DEBUG Default size: 11.0 2023-12-13 20:36:09,450 INFO Cloud ignore list: [] 2023-12-13 20:36:09,450 INFO Cloud include list: ['mtv', 'spam', 'work', 'job', 'play'] 2023-12-13 20:36:09,450 DEBUG Start compiling regexes 2023-12-13 20:36:09,450 DEBUG Finished 2023-12-13 20:36:09,459 DEBUG Tray icon visible: False 2023-12-13 20:36:09,460 INFO Opening journal at '/config/Nextcloud/MyJournal' 2023-12-13 20:36:09,460 DEBUG Starting to load files in dir "/config/Nextcloud/MyJournal" 2023-12-13 20:36:09,460 DEBUG Loading file "/config/Nextcloud/MyJournal/2017-11.txt" 2023-12-13 20:36:09,460 DEBUG Loading file "/config/Nextcloud/MyJournal/2018-08.txt" 2023-12-13 20:36:09,460 DEBUG Loading file "/config/Nextcloud/MyJournal/2019-02.txt" 2023-12-13 20:36:09,460 DEBUG Loading file "/config/Nextcloud/MyJournal/2019-04.txt" 2023-12-13 20:36:09,461 DEBUG Loading file "/config/Nextcloud/MyJournal/2019-08.txt" 2023-12-13 20:36:09,461 DEBUG Loading file "/config/Nextcloud/MyJournal/2020-01.txt" 2023-12-13 20:36:09,461 DEBUG Loading file "/config/Nextcloud/MyJournal/2020-02.txt" 2023-12-13 20:36:09,461 DEBUG Loading file "/config/Nextcloud/MyJournal/2020-03.txt" 2023-12-13 20:36:09,461 DEBUG Loading file "/config/Nextcloud/MyJournal/2020-06.txt" 2023-12-13 20:36:09,461 DEBUG Loading file "/config/Nextcloud/MyJournal/2022-02.txt" 2023-12-13 20:36:09,461 DEBUG Loading file "/config/Nextcloud/MyJournal/2022-03.txt" 2023-12-13 20:36:09,462 DEBUG Loading file "/config/Nextcloud/MyJournal/2022-10.txt" 2023-12-13 20:36:09,462 DEBUG Loading file "/config/Nextcloud/MyJournal/2022-11.txt" 2023-12-13 20:36:09,462 DEBUG Loading file "/config/Nextcloud/MyJournal/2023-10.txt" 2023-12-13 20:36:09,462 DEBUG Loading file "/config/Nextcloud/MyJournal/2023-11.txt" 2023-12-13 20:36:09,462 DEBUG Loading file "/config/Nextcloud/MyJournal/2023-12.txt" 2023-12-13 20:36:09,462 DEBUG Pictures is not a valid month filename 2023-12-13 20:36:09,462 DEBUG Finished loading files in dir "/config/Nextcloud/MyJournal" 2023-12-13 20:36:09,534 DEBUG Update the cloud 2023-12-13 20:36:09,542 DEBUG Background color: rgb(255,255,255) 2023-12-13 20:36:09,542 DEBUG Foreground color: rgb(0,0,0) 2023-12-13 20:36:09,544 DEBUG Cloud updated 2023-12-13 20:36:09,546 INFO Last backup was made 5 days ago 2023-12-13 20:36:19,230 DEBUG Main frame destroyed 2023-12-13 20:36:19,230 INFO Nothing to save 2023-12-13 20:36:19,230 INFO Goodbye! 2023-12-13 20:36:19,249 INFO Peak memory: 117826880 KiB

jendrikseipp commented 7 months ago

Thanks for the report! Do you know Python and want to prepare a pull request?

bpowell2008 commented 7 months ago

Hi @jendrikseipp ... I don't know Python that well, and am not sure what a pull-request is. If you have some suggested edits to a file, if you could point me to the location of that file, I'm happy to make a backup and then edit the file to make any changes and re-test!

If you can walk me through a pull request process, I'm happy to give it a shot!

bpowell2008 commented 7 months ago

Note: The issue is resolved by changing: /usr/share/rednotebook/rednootbook/data.py

Change the following; (remark out the first line, and add a second line)

HASHTAG_EXCLUDES = "|".join((HEX_COLOR, CPP_DIRECTIVES))

HASHTAG_EXCLUDES = (CPP_DIRECTIVES)

Basically, I just remove the "HEX_COLOR" from the excludes...this fixes the issue; but I'm not sure why HEX COLOR was excluded in the first place, so I'm not sure about the downstream impacts.