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

Inserting list items #107

Closed
samarulmeu opened this issue May 18, 2020 · 9 comments
Closed

Inserting list items #107

samarulmeu opened this issue May 18, 2020 · 9 comments
Assignees
Labels
feature:request Requesting new and additions to existing features.

Comments

@samarulmeu
Copy link

There is a bug in creating a new items for both types of list (bullet and ordered). If you are at the end of the line and you press enter a new item is created, but if you are inside a line and press enter the remaining characters/words do not make a new item list.

Example:

- Something new or old.
            ^

I get

- Something
new or old

instead of

- Something
- new or old
@SidOfc
Copy link
Owner

SidOfc commented May 18, 2020

Hmmn, actually is this a bug?

When checking the example on the documentation page, it makes no mention of this being an actual feature, also :h mkdx-function-enter-handler makes no mention of this behavior being supported.

If you did see a mention of this somewhere, can you point me to the place where you found it?

I do recall adding some code to the enter-handler to prevent it from adding list markers when pressing enter and not being at the end of the line though. I do not know anymore why exactly it was done.

I guess you would like to propose some new behavior here, the enter handler is a really complex function already though, and making changes there is like trying to step through a minefield 😅

Alternatively, isn't it easier to d$, followed by an o and pasting from there?

@samarulmeu
Copy link
Author

Actually I did not search the documentation. I just thought it will be normal to have the same behavior in creating a new list item by splitting a line.

To solve it I do just insert and - , but I thought that it is nice to have it automaticaly added. Not to mention the mess in the ordered list that does not get properly updated.

@SidOfc
Copy link
Owner

SidOfc commented May 18, 2020

Makes sense indeed, this is something that word will happily do for you as well, but please do mind that unsupported behavior isn't a bug but rather a feature request :)

When I think of the word bug I immediately jump to "some existing functionality is broken" 😅

As for this request, I'll mark it as a feature request and see what I can do, it could be easier than thought, but could also be a nightmare to implement. Like I mentioned in the other reopened issue, it may take some time here as well.

Any case it's good feedback, cheers as usual 👍

@SidOfc SidOfc self-assigned this May 18, 2020
@SidOfc SidOfc added the feature:request Requesting new and additions to existing features. label May 18, 2020
@samarulmeu
Copy link
Author

Please take your time. There is no hurry. I know that you make this in your free time and it amazing that you are offering such a nice plugin.

My logic in considering this as a bug was that "splitting" a line in an ordered/bullet list is not different than just adding a new empty one and I thought it makes sense to have the same behavior (adding a bullet or a number to the line empty or not, in my case).

@SidOfc
Copy link
Owner

SidOfc commented May 18, 2020

I can understand the reasoning behind you thinking this being a bug because it doesn't seem like a separate use-case indeed. In this case though, checking the docs and seeing if it is supposed to work will make it clear if something is actively implemented and not working, or if it should be a new feature.

To me it seemed a bit quick to jump to the conclusion of marking it as a bug without checking the docs, I put a lot of effort into writing those to make sense as well and it only takes a few clicks to find the right documentation for any feature when you're in doubt :)

Point well taken though, but as a feature request rather than a bug 👌

@SidOfc
Copy link
Owner

SidOfc commented May 18, 2020

Hmmn @samarulmeu I did indeed write tests to check explicitly that it would not do what you showed, but, after disabling the check to make sure enter is pressed at the end of the line, I see proper results one would expect when pressing enter in the middle.

My initial reasoning for this is beyond me since it has been quite a while since I initially wrote this functionality, but I believe always allowing it will actually not break anything 🤔

All other tests pass as well so I think I can safely enable this functionality, I'll update the tests to support this new behavior, you might see this land sooner than expected.

@SidOfc
Copy link
Owner

SidOfc commented May 18, 2020

Can you update mkdx and check to see if this is indeed the desired behavior?

@samarulmeu
Copy link
Author

Thank you so much! That is just perfect! And I promise that I will not bother you this week as you've mentioned you have work to do.

And to clarify --- it was strange for me that this was not supported as I saw it as part of the list auto-formatting, that's why the bug thing.

Have a great evening!

I'm closing this now.

@SidOfc
Copy link
Owner

SidOfc commented May 18, 2020

Haha I understand, it beats me why it worked that way but I think it will just be more useful now.

Feel free to open issues is you find em, if I can't process them they will remain open for a bit longer is all :) This one happened to be way easier to fix than I imagined (I went through some nightmares in the past with the enter handler hehe) so that was a nice twist :)

You have a great evening too! 👍 👋

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:request Requesting new and additions to existing features.
Projects
None yet
Development

No branches or pull requests

2 participants