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

Add a command for checkbox content selection #1089

Open
medopaw opened this issue Mar 11, 2022 · 7 comments
Open

Add a command for checkbox content selection #1089

medopaw opened this issue Mar 11, 2022 · 7 comments
Labels
Area: Task list GitHub Flavored Markdown task list. Issue: Feature Something brand new. Needs Discussion We haven't decided what to do. Needs More Info

Comments

@medopaw
Copy link

medopaw commented Mar 11, 2022

Proposal

Add a command to select the content of a checkbox line

e.g. "Just do it." is the content of the following checkbox line:

- [ ] Just do it.

It's useful because often I want to mark the whole checkbox content as highlighted or bold or struck-through, like this:

- [ ] ==Just do it.==
- [ ] **Just do it.**
- [ ] ~~Just do it.~~

A command to select the content of a checkbox line can significantly reduce the operation required for this purpose. Please consider.

References

@Lemmingh
Copy link
Collaborator

A list item is a container block. If the task list is a loose list, how many lines should we select? Does such selection have any practical use?

@Lemmingh Lemmingh added Needs More Info Needs Discussion We haven't decided what to do. Area: Task list GitHub Flavored Markdown task list. labels Mar 11, 2022
@Lemmingh
Copy link
Collaborator

Well, if you're not aware of complex loose list, please take look at the "Tasks" section in #1054

@medopaw
Copy link
Author

medopaw commented Mar 11, 2022

Does such selection have any practical use?

Strikethrough is a common way to mark a checkbox line as done. And I personally use the other two to mark a check line as the current task or of high priority.

The thing is, if we apply styles to the whole line the checkbox will be rendered as normal text:

- [ ] Just do it.
-[ ] Just do it.

instead of:

  • Just do it.
  • Just do it.

A list item is a container block. If the task list is a loose list, how many lines should we select?

Well, if you're not aware of complex loose list, please take look at the "Tasks" section in #1054

I'm aware of the complex loose list now that you mentioned it. Though we can simply select only one line or all the lines, I suggest an alternative approach: how about adding a setting option to allow users to decide which special patterns are treated like strikethrough (~~).

// One special case: toggle strikethrough in task list
const currentTextLine = editor.document.lineAt(cursorPos.line);
if (startPattern === '~~' && /^\s*[\*\+\-] (\[[ x]\] )? */g.test(currentTextLine.text)) {
wordRange = currentTextLine.range.with(new Position(cursorPos.line, currentTextLine.text.match(/^\s*[\*\+\-] (\[[ x]\] )? */g)[0].length));
}

In this way setting ** and == as special patterns would serve my needs, and it requires less key strokes for me. Please consider. Thx.

@yzhang-gh
Copy link
Owner

I see this can be (somehow) useful for certain users (that's why we have it for ~~ in the task list).

Although it is a valid feature request, I don't think it is worth doing so far. We need to wait for more feedback from other users.

@medopaw
Copy link
Author

medopaw commented Mar 11, 2022

I see this can be (somehow) useful for certain users (that's why we have it for ~~ in the task list).

Although it is a valid feature request, I don't think it is worth doing so far. We need to wait for more feedback from other users.

Is it okay that I do it and create a pr? I use a TODO.md as my major task management tool every day and really need it.

This feature simply provides more options. It's very useful for certain users and doesn't interfere with other users.

@Lemmingh Lemmingh added the Issue: Feature Something brand new. label Mar 11, 2022
@Lemmingh
Copy link
Collaborator

Is it okay that I do it and create a pr?

I recommend that you create a customized private fork.

PR implies a transfer of responsibility. If you open a PR here, we would have to go a lengthy review to ensure reliability, which doesn't make much sense for an uncertain experiment.

@medopaw
Copy link
Author

medopaw commented Mar 11, 2022

Is it okay that I do it and create a pr?

I recommend that you create a customized private fork.

PR implies a transfer of responsibility. If you open a PR here, we would have to go a lengthy review to ensure reliability, which doesn't make much sense for an uncertain experiment.

Yes I could do a private fork. It's my last resort though: To enjoy new features I'll have to merge with the latest code manually from time to time. Thx for your response anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Task list GitHub Flavored Markdown task list. Issue: Feature Something brand new. Needs Discussion We haven't decided what to do. Needs More Info
Projects
None yet
Development

No branches or pull requests

3 participants