Possible Bug: prefix-lines doesn't seem to work like documentation states

46 views
Skip to first unread message

RunningUtes

unread,
Jan 17, 2018, 12:26:34 AM1/17/18
to TiddlyWikiDev
I posted this to the general TW forum, but no one has responded...


A tm-edit-text-operation is supposed to preform an operation on selected text but it doesn't seem to do as the documentation lists.

https://tiddlywiki.com/#WidgetMessage%3A%20tm-edit-text-operation

If selected text is bolded, the '' is added as a prefix and as a suffix. If the same text is already bolded and the operation is run again, the '' is removed. See the rules in $:/core/ui/EditorToolbar/list-bullet.

This doesn't seem to happen for the prefix-lines operation.

For example, select several lines of text and press the unordered list button. A * will be added as a prefix according to the rules in $:/core/ui/EditorToolbar/list-bullet. If the same text is selected and the unordered list button is pressed again, the * is not removed. In fact, nothing happens. The documentation states that the prefix should be removed from the selected lines.

Is this a bug in the code of the current TW?

The problem seems to be in $:/core/modules/editor/operations/text/prefix-lines.js

Andreas Hahn

unread,
Jan 17, 2018, 1:56:03 AM1/17/18
to tiddly...@googlegroups.com

Hi RunningUtes,

as the person who originally documented this feature, I had another look at the code and I believe this is a bug, since in the code it seems to be supposed to work that way, but on line 37 of $:/core/modules/editor/operations/text/prefix-lines.js, it seems to end up comparing an integer to a string.

/Andreas

--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/f7f9961a-1f99-4dd5-8307-470a7f61ca93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RunningUtes

unread,
Feb 2, 2018, 7:45:11 PM2/2/18
to TiddlyWikiDev
Is there a fix that can be manually applied to fix the issue? Ultimately I would like to use TW for outlining notes. For example:

# Level 1
# Level 2
# Level 2.1
# Level 2.2
# Level 3

Clicking the ordered list button, this currently should REMOVE the outlining. I would like to select the lines Level 2.1 & Level 2.2 and advance the outlining so it now will look like this:

# Level 1
# Level 2
## Level 2.1
## Level 2.2
# Level 3

The reverse would also be useful, allowing selected outline text to be demoted down a level. Possibly icons like >> or << .

This option would likely require two new buttons and each would have to detect the outline type (ordered vs unordered list) above the selected text.

Currently the list buttons only add "* " or "# " to the existing outline, but the formatting is incorrect since it inserts a space between lists ("* * " or "# # ") rather then the correct formatting ("** ""## ").

Reply all
Reply to author
Forward
0 new messages