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

Trailing space character in title should be removed #3483

Closed
twMat opened this issue Oct 15, 2018 · 22 comments
Closed

Trailing space character in title should be removed #3483

twMat opened this issue Oct 15, 2018 · 22 comments

Comments

@twMat
Copy link
Contributor

twMat commented Oct 15, 2018

Serious issue: A suffixing space character in the title is apparently not removed when saving the tiddler. So "Foo " and "Foo" appear the same, both as titles in view mode and edit mode and also as tag pills.

Proposal: Automatic removal of trailing space characters in title when saving a tiddler and in tags when creating one.


Update based on discussion below: The proposal here concerns whether tags should be trimmed or not. The concern about tiddler titles turned out to be an edge case for #751 (albeit probably the most common one)

My position regarding tags is that they should follow the same rules as titles... and IMO they should both have trailing space characters trimmed or at least marked out, e.g in pink, in edit mode.

@Jermolene
Copy link
Member

Hi @twMat I remember this coming up before -- @pmario do you recall the discussion?

@twMat
Copy link
Contributor Author

twMat commented Oct 15, 2018

@Jermolene - You're not thinknig of #3368 are you? I don't think this is the same issue, but maybe it is? This case with a simple space character seems much more critical.

@Jermolene
Copy link
Member

I think that that is the same problem: the dangers of invisible characters in tiddler titles.

I also found #1791 "TW overwrites existing tiddler without a warning -> data loss"

There are a lot of variants of this: there are Unicode characters that look the same but have different codes; in some situations one can't distinguish between two spaces or a single space.

Anyhow, I can't quite duplicate the problem you're seeing here. When I create a tiddler with a trailing space in the title it is automatically trimmed. Are you perhaps creating the tiddler programmatically?

@twMat
Copy link
Contributor Author

twMat commented Oct 15, 2018

Anyhow, I can't quite duplicate the problem you're seeing here

One way is to tag a tiddler with "Foo " which will then not link to "Foo"

...

I found #751 which is closed. If you say #751 covers this then please close this thread - even if I must say that I'm surprised by some of the conclusions there.

The particular case with trailing space characters must surely be much more common that many of the other edge cases. Someone suggested coloring such extra spaces pink in edit mode, or perhaps a squiggly underline, which I think is a nice general idea; they're still there but you're alerted about it.

@Jermolene
Copy link
Member

I think #751 does cover the same problem. It sounds like the new thing here is the discussion about tag entry, and whether they should be trimmed too.

@twMat
Copy link
Contributor Author

twMat commented Oct 16, 2018

(OP updated)

@pmario
Copy link
Member

pmario commented Oct 16, 2018

My opinion didn't change. see #751, #2726, #1791,

I think the next version of TW should consistently remove whitespace,
We missed the opportunity for tw5.

@AnthonyMuscio
Copy link
Contributor

Regardless of core functions handling leading and trailing spaces could we not provide a mechanism to simply remove them from a given string?. I have had mysterious spaces appearing in macros and at the time would have being happy to just have a method to remove them.

@hoelzro
Copy link
Contributor

hoelzro commented Oct 25, 2018

As long as we're gathering issues related to trailing whitespace, I reported and fixed #2850 last year.

@diego898
Copy link
Contributor

As tags are tiddlers too, Im reporting here that someone on the groups reported a problem where they accidently tagged their tiddler with a space before the correct string.

I think trailing and leading white spaces should be removed!

@pmario
Copy link
Member

pmario commented Dec 13, 2019

@diego898 This problem was fixed in a different way. see: remove &nbsp from tag pill in edit mode #4366

@diego898
Copy link
Contributor

hey @pmario, if I go to tw.com and remove TableOfContents tag from HelloThere, and add a new tag that is: TableOfContents the tag dropdown behaves correctly, but I finish adding my new tag, I can successfully add a tag with space and HelloThere is removed from the ToC.

@pmario
Copy link
Member

pmario commented Dec 13, 2019

I know, but that is a wontfix because of backwards compatibility. See my post above #3483 (comment)

@kookma
Copy link
Contributor

kookma commented Mar 13, 2021

Hi @Jermolene
Working with Tiddlywiki on Node.JS I experienced creating tiddlers with leading and trailing space which cause several issues on Windows system for example you cannot delete them!

Example

  1. create a TW on Node.js
  2. Open the wiki and create a sample tiddler as below
<$tiddler tiddler="  xx/temp/ExampleCodingMode  ">
  <$radio value="Completed">&nbsp;Completed</$radio>&ensp;
  <$radio value="New">&nbsp;New</$radio>
  <$radio value="All">&nbsp;Show all</$radio>
</$tiddler>
  1. Save and click on one radio button! A new file with leading space will be created!

It is required to trim leading and trailing space before creating the tiddler

Note: The example provided by @pmario over the Google Forum!

@pmario
Copy link
Member

pmario commented Mar 13, 2021

I'm sorry but the new forum doesn't allow to edit posts. I did immediately post a corrected version in a new post, https://groups.google.com/g/tiddlywiki/c/O1oylX4H97k/m/8T87g6_gAgAJ

@kookma
Copy link
Contributor

kookma commented Mar 13, 2021

Thank you @pmario
Yes I got the correct code! But please not TW shall trim trailing and leading spaces!
It is very common to pass such tiddler name by mistake! So TW core shall tale care of such spaces!

@kookma
Copy link
Contributor

kookma commented Mar 13, 2021

Serious issue: A suffixing space character in the title is apparently not removed when saving the tiddler. So "Foo " and "Foo" appear the same, both as titles in view mode and edit mode and also as tag pills.

No only trailing and leading spaces in title and tags but also in field name shall be trimmed!
This true for all widgets create such elements! e.g $action-setfield, ...

@pmario
Copy link
Member

pmario commented Mar 13, 2021

see this and linked comments #3483 (comment)

Working with Tiddlywiki on Node.JS I experienced creating tiddlers with leading and trailing space which cause several issues on Windows system for example you cannot delete them!

What does it mean: "You can not delete them?" ... Delete with TW or deleting them with the file explorer?

@Jermolene
Copy link
Member

Thanks @kookma @pmario I think that this might be a regression from #5113 and subsequent fixes. @joshuafontany it seems reasonable for the system to trim spaces from generated filenames, what do you think?

@joshuafontany
Copy link
Contributor

joshuafontany commented Mar 14, 2021

@Jermolene @pmario @twMat @kookma
Good catch! I agree, this is a bug that seriously affects filenames/disk-access on Win* systems. Let me catch up on the whole thread and I should be able to get a PR together this week.

@joshuafontany
Copy link
Contributor

@Jermolene I included these fixes alongside the fix for the OriginalFilesystemPath bugs.

#5504

Best,
Joshua F

@Jermolene
Copy link
Member

Thanks @joshuafontany

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

No branches or pull requests

8 participants