Many blank lines in .bsxm file
When I save my file, a bunch of extra blank lines get added to the file. In the example below, I edited one species/visit from 2 seen to 3 then back to 2, and saved. You can see that over 200 extra blank lines were added to the file!
$ wc -l photos.bsxm
4674 photos.bsxm
$ grep -c '^ *$' photos.bsxm # count blank lines
1276
$ ~/media/Scythebill/Scythebill.run
May 16, 2019 8:50:52 AM com.scythebill.birdlist.ui.app.FrameRegistry startLoadingReportSet
INFO: Initiating load of /home/me/photos.bsxm
May 16, 2019 8:50:52 AM com.scythebill.birdlist.ui.app.FrameRegistry lambda$startLoadingReportSet$1
INFO: Completed load of /home/me/photos.bsxm
May 16, 2019 8:51:13 AM com.scythebill.birdlist.ui.app.FrameRegistry$1 windowClosed
INFO: Closed /home/me/photos.bsxm
$ wc -l photos.bsxm
4879 photos.bsxm
$ grep -c '^ *$' photos.bsxm # count blank lines
1481
$ grep -c '<photo' photos.bsxm
1035
$ grep -c photo="true photos.bsxm
314
$
I saw it today in 14.5.1 (Java 10.0.2 included in the installer) but I've seen it in earlier versions (I think Scythebill was already at 14.x when I started using it). I'm running Debian Stable (9) KDE. If it matters, I have directly edited the .bsxm file in the past to add additional photographs (the drag-and-drop interface is a little finicky sometimes and when there is a whole folder's worth of pictures to add for a species it can be easier to just paste a list into a text file).
Comments (7)
-
-
reporter - attached lines.bsxm
I was able to replicate with a very-stripped-down version of my file (attached):
Open the file.
Browse by location, North America, select the sighting, change Number to 1, then backspace, Return to Main Menu. File | Save.
6 blank lines (actually 2-4 spaces on each line) have been added above the first <photo> line.
Repeat those steps (without closing or re-opening the file), and there is no change to the number of lines.
Close Scythebill, re-open it, repeat the above: 6 additional empty lines are created in the same place.
-
- changed status to resolved
Resolve issue
#428: Many blank lines in .bsxm fileIssue was worse than just some meaningless blank lines in the file; whitespace was getting appended to the sighting description on each save if there were any photos (one line per photo). Also, clean up the issue on the first load/save cycle.
→ <<cset 165c360a597e>>
-
reporter Sometimes, this fix removes newlines entered by the user. If I create a new file with one sighting, like this:
<sighting taxon="spCorvucor3" loc="_usst_washin" date="2019-05-28">saw them:
- flying
- not flying
- swimming</sighting>
Then I “Save a Copy As” to sample-copy.bsxm, I get this:
<sighting taxon="spCorvucor3" loc="_usst_washin" date="2019-05-28">saw them:
- flying- not flying
- swimming</sighting>
When I “Save a Copy As” from sample-copy.bsxm to sample-copy-copy.bsxm, I lose another line break:
<sighting taxon="spCorvucor3" loc="_usst_washin" date="2019-05-28">saw them:
- flying- not flying- swimming</sighting>
I don’t seem to lose more line breaks after that.
I’ll add an attachment with unit test changes that currently break (and also broke in a different way before <<cset 165c360a597e>> due to the original issue).
-
reporter - attached 428_test.patch
-
Fixed the new bug with commit 20b5162 - thanks very much for catching. And submitted your test patch too - that is indeed a very good idea.
-
reporter Neat!
- Log in to comment
I’d be happy to take a glance at your .bsxm file (support@scythebill.com, rather than attaching it here, probably). My hunch is that this has got something to do with system line-feeds (perhaps I’m always normalizing back to CR/LF?), but it could be some other oddity for photos.