martinrotter/textosaurus

Feature request: make default date format user customizable

midaspt opened this issue ยท 9 comments

Brief description of the issue.

In v0.9.12, Textosaurus date format defaults to "11/19/19" (Month/Day/Year), which is not only very confusing for non-US users but also a standard with a very limited applicability.

While the .LOG date format can be customized via "Settings | Editor | General" there is no such option for the default date format.

While the "Tools | DateTime | Insert DateTime (Custom Format)" menu option can easily be used to work around this limitation, it will prompt the user every time it is used for the format to be used -- and it currently defaults to "HH:mm:ss dddd, dd.MM.yyyy".

"Tools | DateTime | Insert DateTime" will insert a valid formatted ISO (8601, cf. https://en.wikipedia.org/wiki/ISO_8601) DateTime string, although the inclusion of alphabetic characters and arbitrary string separators makes it less suitable for processing CSV files meant for spreadsheet conversion.

How to reproduce the bug?

  1. Access menu "Tools | DateTime | Insert DateTime"
  2. '11/19/19' gets inserted into edited document at cursor point; selection isn't overwritten.

What is the expected result?

Insertion of '2019-11-19'. Selection overwritten. (string separators optional)

What actually happened?

See above.

Other information

Menu "Tools | DateTime | Insert Time" defaults to "11:30 AM", a standard valid only in Anglo-saxon cultures and in Japan.

So, i made some commits, please test latest dev version when it gets compiled (after 15 mins):

  • selection is now automatically replaced if there is any for datetime functions (and this functionality is now available to all tools, even custom defined in settings)
  • all datetime functions now respect active application locale
  • all "prompt" values intered to "insert custom datetime" tool are now persistently saved and reloaded when the tool is triggered again - this feature is now also active for all tools

Tested. Much better, at least for the "Insert DateTime (Custom Format)", which is indeed sticky now.

Remaining DateTime options behave as before, though, my system locale notwithstanding.

Moreover, I defined 'F5' as a custom keyboard shortcut for "Insert DateTime (Custom Format)", but it still requires an additional 'Enter' press to get the value inserted.

That shouldn't be required, it's cumbersome; if a user isn't satisfied with the format currently set, he can always use the menu option to change it, IMHO.

@midaspt

Remaining DateTime options behave as before, though, my system locale notwithstanding.

Currently, "DateTime" methods use application locale, not system locale. Do you think using system locale and ignoring application locale would make sense?

Moreover, I defined 'F5' as a custom keyboard shortcut for "Insert DateTime (Custom Format)", but it still requires an additional 'Enter' press to get the value inserted.

Yes, tools behave exactly the same, no matter if you launch it from shortcut or from the menu. I will think about this.

Currently, "DateTime" methods use application locale, not system locale. Do you think using system locale and ignoring application locale would make sense?

I don't clearly grasp the difference between the two but if you have to rely on obscure system settings it would make sense to at least rely on those more readily exposed to user customization.

In the end, it would be simpler to just set some defaults and allow the user to change those in the program if he's not content.

Moreover, I defined 'F5' as a custom keyboard shortcut for "Insert DateTime (Custom Format)", but it still requires an additional 'Enter' press to get the value inserted.

Yes, tools behave exactly the same, no matter if you launch it from shortcut or from the menu. I will think about this.

I am focusing exclusively on this DateTime feature ("do one thing but do it well") and that's the way it works in all other text editors out there. Trust me, I have tried a few. ;)

OK, fixed this. Now DateTime methods use SYSTEM locale, custom format for the DateTime tool is now NOT requested via popup dialog but can be changeable in app settings "Editor" tab.

Please test and let me know.

Tested all "Tools | DateTime" options from 'textosaurus-0.9.13-1878b12-win64.7z' with both blank and a custom set format. Works perfectly, at least for me. Thanks for considering my suggestions. :))

P.S.: For enhanced user-friendliness, you might wanna link, either from help or from the settings tab itself, to the appropriate syntax for changing these values. E.g., a resource like https://strftime.org/ or such would do nicely.