Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctrl+Space destroys and Ctrl+Z can't recover #703

Closed
TheJackiMonster opened this issue Dec 4, 2019 · 4 comments
Closed

Ctrl+Space destroys and Ctrl+Z can't recover #703

TheJackiMonster opened this issue Dec 4, 2019 · 4 comments
Labels
Milestone

Comments

@TheJackiMonster
Copy link
Collaborator

I tried to use this software (Version 0.10.0 on Archlinux) to plot a story I write at the moment, but it is painful with bugs like that.

I try to put the characters which appear during a scene into the references/notes together with the plotline. Like this for example:

Plotline: {P:2:NameX}
Characters: {C:3:NameY}, {C:2:NameZ}

But if I use Ctrl+Space to autocomplete names of the characters in the second line, it flushes the whole text of the little field (for references/notes) empty and I can't restore it using Ctrl+Z. So basicly the software kills my content and I can only get it back writing it manually... again.

Don't get me wrong, I really like the idea of plotting and writing a story using markdown and storing it in seperate files via directory-structures but can you please fix the basic textfield functionality?

@TheJackiMonster
Copy link
Collaborator Author

I tried to replicate it but I don't understand why it happens. It does not happen caused by:

  • the amount of lines of the content > x. (x >= 1)
  • the amount of characters I try to autocomplete > x. (x >= 0)
  • the amount of references the completer gives me to select > x. (x >= 0)
  • the amount of characters of the content > x. (x >= 1)
  • the size of the reference I try to autocomplete > x. (x >= 0)

So there is no edge-case I can think of. It's just like: Sometimes if I press Ctrl+Space to open the completer, my content vanishes randomly. Maybe it's just a line of code which checks the text to autocomplete and load&saves it... but related to the time since the text has been written. But even it that case: It does not even save anything. I had the file opened with Retext to check that too. No savings to the file. So it's just a random (maybe time based) problem in memory if you try to use autocomplete.

If anyone knows the lines of code I could find this bug, I look for it. I want this to work.

Actually the completer should not even affect the textfield in any before before I don't press Return to confirm.

@TheJackiMonster
Copy link
Collaborator Author

Okay, it seems related to the size of the content in notes or other metadata fields. But it will only vanish if I use any hotkey-function with the Control-key. Ctrl+X, Ctrl+Y, Ctrl+C, Ctrl+Z, Ctrl+Space... but it really surprises me. If the length is limited in any way, why do the textfields get scrollbars? ^^'

@TheJackiMonster
Copy link
Collaborator Author

I guess I have found the bug. Your updateTimer calls submit() in your textEditView and at the same time the thread handling the input causes update(). So the bug is quite simple: The code updating the model in the background and synchronizing models with text-representation is not thread safe.

It can simply be fixed by replacing the attribute updating with a mutex. Since the project uses Qt, I guess QMutex should work fine. I will try to open a merge-request soon.. ^^'

@TheJackiMonster
Copy link
Collaborator Author

#704 solves this Issue completely... ^-^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants