Open FichteFoll opened 1 year ago
Thank you for the issue and the test files! I haven't seen the notes field in my diffs with these control characters and didn't really think about multiline fields much when implementing this tool. Would it make sense to add an option like --ignore-line-endings
then to ignore these control characters?
I think showing these characters is something that is not really in scope of this tool - it could be done on the Terminal level or as we have seen when pasting this into an editor.
I am thinking that the tool you're using to save your database shouldn't change the line endings though. It feels very odd to me that it changes all the different entries when nothing really changed in the file. Does it change them when you haven't changed anything at all? Like just pressing "Save" after opening it, would the file itself change?
Does it change them when you haven't changed anything at all? Like just pressing "Save" after opening it, would the file itself change?
It does when selecting "Save Database as…" and doesn't allow me to save without having made any changes (keepassxc).
Would it make sense to add an option like
--ignore-line-endings
then to ignore these control characters?
Definitely, though I'd argue it makes more sense to enable this by default and provide an option to disable it. Since keepass databases are a binary format and encrypted, it's not like you're likely to care which line endings are using inside of the note exactly as long as the tools you're opening them with handle them appropriately (which they mostly do). I presume this is also why keepassxc isn't all that interested in changing this behavior because outside of keepass-diff
, I can't really think of any relevant use case where the type of line ending would matter.
I'm in the same boat (using different keepass software on different devices with line breaks going a bit crazy), and I definitely would love that option (and even better if it's on by default) !
Editing the file on a different platform (using a different tool) changes all line endings to the platform-specific ones. This can be observed with the following 3 files:
whitespacetest.zip
Diffing on CLI:
Piping the diffs to a text editor that can render control chars (like CR), e.g. Sublime Text:
Initially raised at https://github.com/keepassxreboot/keepassxc/issues/9326 but it seems more relevant for the diff tool.