[BUG] State of "All Matches" (size, selected line) not saved

Home Forums cherrytree [BUG] State of "All Matches" (size, selected line) not saved

This topic contains 14 replies, has 3 voices, and was last updated by  GenuZ 1 year, 2 months ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
  • #124204


    Ciao, Giuseppe!

    I have noticed that saving the state of line in “All matches” dialog window are broken. Earlier it opens on the same line that it hides on, but now it always change selection to the first line.

    Now it’s hard to edit branches successively selecting them from “All matches” dialog window, because of loosing current edit state.



    Ciao GenuZ, thanks I’ll fix this shortly!



    Also I suggest to make a second Save and VACUUM menu – with “VACUUM REINDEX;”

    I use this way of VACUUMing SQL base of CherryTree for a long time. It helps me to fix some visible lags after hard editing branches with over 600-700 lines.

    After Save and VACUUM from menu lags are still existing, but after manual external “VACUUM REINDEX;” the database, lags in editing are lost for some time.



    Can you explain the benefits of vacuming? Would it be better to enable this as a silent setting which optimizes the database on every exit if there are no dangers to the procedure?



    It’s literally repack, rebuild and “defragment” database and fully delete data marked as deleted. It reduce the size of database and speed-up opening and browsing database.

    Here is more information. https://www.sqlite.org/lang_vacuum.html

    I have several CherryTree databases over 2Gb. And after hard editing of it I noticed the reducing speed of this editing. Branches opens slowly (espesially with large amount of pictures in it), adding new branches lasts for 10 seconds.

    Also some time ago I have problems with broken parts of databases (after cloud syncing) and vacuum helps me remove broken data from my databases.

    Now I have ~70 Mb database with a lot of text, wich I edit often. And I noticed than removing and adding the parts of text in branch with over 500 lines can make some annoying lags even on simple text typing. Only VACUUM doesn’t helps with it, but VACUUM REINDEX solve my problems until next hard editing.

    Using VACUUM every time is not expediently because of:
    – longest “saving” time;
    – more disk operations;
    – more disk space for operations;
    – and for some time, it make impossible to manual recover accidentally deleted data from database (because of vacuuming it on every save).

    But VACUUM REINDEX helps in some important cases I wrote above. Giuseppe adds the “Save and Vacuum” menu after my feature request, but before that I VACUUM and REINDEX my databases with a linux/windows commandline, or by a script (weekly vacuums all my databases at once).

    The way of adding this menus to CherryTree – is the way of more convenient vacuuming for all users, who not friendly with commandline.



    Is VACUUM REINDEX much slower than simple VACUUM or is there any reason against me just always performing “VACUUM REINDEX” in place of the current “VACUUM”?



    I think it’s mostly depends of database size and of it’s index state. But I didn’t noticed much time differences between VACUUM and VACUUM REINDEX.

    It’s wisely to add REINDEX in “Save and Vacuum menu”, but not in save menu by default (like AntiNSA proposed).



    I updated the save & vacuum command to perform also the reindex.

    GenuZ I would appreciate if you could verify the change to work as expected, if you cannot test the git HEAD version I can pack a version for you, just tell me what OS you run cherrytree on.



    Please make binaries/packets for Windows and Linux. I test them both.

    I have arch-based distro (Manjaro), but I’ll try to make PKGBUILD for deb package. As I usually make it, when AUR package is too old.

    Yes, I am dualbooter. An I not a programmer at all. 🙂




    Sorry for long testing…

    It works fine on Windows, but I have troubles on linux.
    On linux cherrytree starts, opens database, edit it, but failed to “save and vacuum” or sometimes failed to save at all.

    Here is console output:
    Traceback (most recent call last):
    File “/usr/share/cherrytree/modules/core.py”, line 1735, in file_open
    File “/usr/share/cherrytree/modules/core.py”, line 1754, in filepath_open
    if not self.reset(force_reset): return
    File “/usr/share/cherrytree/modules/core.py”, line 2023, in reset
    if not force_reset and not self.tree_is_empty() and not self.check_unsaved(): return False
    File “/usr/share/cherrytree/modules/core.py”, line 3639, in check_unsaved
    if response == 2: self.file_save() # button YES pressed or autosave ON
    File “/usr/share/cherrytree/modules/core.py”, line 1578, in file_save
    and self.file_write(os.path.join(self.file_dir, self.file_name), first_write=False):
    File “/usr/share/cherrytree/modules/core.py”, line 1712, in file_write
    self.file_write_low_level(filepath, xml_string, first_write)
    File “/usr/share/cherrytree/modules/core.py”, line 1613, in file_write_low_level
    else: self.ctdb_handler.pending_data_write(self.db)
    File “/usr/share/cherrytree/modules/ctdb.py”, line 73, in pending_data_write
    db.execute(‘VACUUM REINDEX’)
    sqlite3.OperationalError: unknown database REINDEX
    win destroy: runn_win found with id 0

    I think it could be not installed correctly, because I’m not able to install deb package. It’s not compartible with package manager in my distro (pacman/yaourt).
    But installing from git-master makes some errors for me. And I think it because my hands…

    Could you give me a link to a tar.xz source package, because I can write this link directly in PKGBUILD and try to install cherrytree by my package manager (as I usually doing).



    The error seems a real error actually, probably related to the sqlite3 version your system uses.
    I applied a change.
    Please try both



    Is this changes made to git-master?

    Can I use this to make same intsallation? (I have no dpkg at all)
    git clone https://github.com/giuspen/cherrytree.git
    cd cherrytree
    sudo python2 setup.py build
    sudo python2 setup.py install

    • This reply was modified 1 year, 2 months ago by  GenuZ.


    Yes, it’s work on both linux and windows!
    I used cloned from git on linux and attached windows portable package.

    P.S.: Saving state of “All matches” is also saving correctly! 🙂




    New quick propose for “All Matches” window!

    Please make ability to use hotkey to delete finded and selected line inside the “All Matches” window.

    Because if I decide to delete several founded lines containing some text, I will open and close “All Matches” window for each time I delete line:
    1. Select line in “All Matches” window;
    2. Ctrl+Shift+A (hides window);
    3. Ctrl+K (delete line);
    4. Ctrl+Shift+A (opens window again).

    But if Ctrl+K delete a line selected inside “All Matches” window (physically delete in branch!), this operation will be produced in one simple hotkey!

    It will be so conveniently! 🙂

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.