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

[BUG] Toggle checkbox - checkbox where added in wrong place when autocreated from list #210

Closed
wiktor2200 opened this issue Nov 27, 2023 · 5 comments

Comments

@wiktor2200
Copy link
Contributor

Script name

Toggle checkbox

Script authors

@sanderboom @pbek

When providing list as in the example, with additional context added after - sigh it parses the list wrong.
Example:

test
test1
test - other
test2

Expected behavior

- [ ] test
- [ ] test1
- [ ] test - other
- [ ] test2

Actual behavior

- [ ] test
- [ ] test1
test - [ ] other
- [ ] test2

Steps to reproduce

Please use the script on provided example list.

Output from the debug section in the settings dialog

Not relevant.

Relevant log output in the Log panel

Not relevant.

@pbek
Copy link
Member

pbek commented Nov 28, 2023

Thank you for the fix!

@pbek pbek closed this as completed Nov 28, 2023
@sanderboom
Copy link
Contributor

👍

But now the following is broken..

Start with:

- test
	- test
	- test
		- test
	- some test
		- test
- test

Result with the change:

- [ ] test
- [ ] 	- test
- [ ] 	- test
- [ ] 		- test
- [ ] 	- some test
- [ ] 		- test
- [ ] test

Result before the change:

- [ ] test
	- [ ] test
	- [ ] test
		- [ ] test
	- [ ] some test
		- [ ] test
- [ ] test

🤔

Maybe it needs some more work 😃

@wiktor2200
Copy link
Contributor Author

Hello @sanderboom!
Thanks a lot for pointing it out, good catch :) I haven't thought about this option before.
I've just prepared a fix for that.
@sanderboom @pbek Please take a look. #212

@pbek
Copy link
Member

pbek commented Dec 4, 2023

Checkbox creation works for be, but it doesn't seem to select the correct amount of text anymore:

It is done with script.noteTextEditSetSelection(noteTextEditSelectionStart, noteTextEditSelectionEnd);

@wiktor2200
Copy link
Contributor Author

I think it's another issue. It has been there before.

Let's find if we understand ourselves correctly (I mark end of selection with # mark)
For this list:

- test
	- test
	- test
		- test
	- some test
		- test
- test

It returns (and returned):

- [ ] test
	- [ ] test
	- [ ] test
		- [ ] test
	- [ ] some # test
		- [ ] test
- [ ] test

Selection ends on first found white space. I've also checked on code before my changes ( git checkout 145fe71f1fb73d1821fb8640e3d1f0879dd66f87) and it behaves the same.

I think it may be connected with this comment https://github.com/qownnotes/scripts/blob/master/toggle-checkbox/toggle-checkbox.qml#L158 (5yrs ago), but maybe @sanderboom has some more insights?

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

No branches or pull requests

3 participants