cgeo icon indicating copy to clipboard operation
cgeo copied to clipboard

[Nightly] CR/LFs in PNs not properly recognized

Open MagpieFourtyTwo opened this issue 1 year ago • 4 comments

Describe your problem!

When adding text to an existing PN it happens pretty often that text, which I want to append to the end of a line, will instead appear at the start of the next line. Seems as if the click at the end of the line goes inbetween of CR and LF. Don't know if this is device specific or a c:geo issue, but perhaps someone else has this issue, too ...?

How to reproduce?

  1. create a PN with a bunch of line
  2. save the PN and reopen it for edit
  3. select the end of a line somewhere in the middle of the text
  4. start to type ...

Actual result after these steps?

In some cases (not always, but about 30 % of the time) the text will not appear at the end of the selected line, but at the beginnung of the next line.

Expected result after these steps?

Text should go to the end of the line (in fact, where the cursor was before I started to type)

Reproducible

Yes

c:geo Version

2024.09.19-NB-e7561f1

System information

## System information

c:geo version: 2024.09.19-NB-e7561f1

Device:
-------
- Device type: BVL-N49 (BVL-N49EEA, HONOR)
- Available processors: 8
- Android version: 14
- Android build: BVL-N49 8.0.0.188(C431E4R2P2)
- Screen resolution: 1280x2523px (430x848dp)
- Pixel density: 2.9750001
- System font scale: 1.0 / used scale: 1.0
- Sailfish OS detected: false
- Google Play services: enabled - 24.35.30 (190400-668017056)
- Memory:  Available:3,1 GB, Total:11,0 GB, Threshold: 216,0 MB, low:false

Sensor and location:
-------
- Low power mode: active
- Compass capabilities: yes
- Rotation vector sensor: present
- Orientation sensor: present
- Magnetometer & Accelerometer sensor: present
- Direction sensor used: rotation vector

Program settings:
-------
- Settings: v9, Count:405
- Set language: en_DE (system default)
- System date format: dd/MM/y
- Time zone: GMT+02:00
- Debug mode active: no
- Log Settings: debug=false, minLevel=WARN, minAddCallerInfo=NONE, addCallerInfoMaxDepth=8, throwOnError=false, transactionSizes=false
- Last manual backup: 18 Sept, 23:09
- Last auto backup: never
- Routing mode: Car (shortest.brf / trekking.brf / _Dirk_car-eco_notoll.brf / _Dirk_car-rugged_notoll.brf / river.brf)
- Live map mode: true
- Use unified map: true
- OSM multi-threading: true / threads: 4
- Map: _  DE BaWü Vosges.osm (Offline)
  - Id: cgeo.geocaching.maps.mapsforge.MapsforgeMapProvider$OfflineMapSource:primary:Locus/mapsVector/_  DE BaWü Vosges.osm.map
  - Atts: #VectorMaps:(c)Christian Kernbeis, GeneralMaps:(c)Michael Bechtold, Themes:(c)Tobias Kuehn, www.openandromaps.org 2012-2024 #Hoehendaten: sonny.4lima.de, viewfinderpanoamas.org, NASA #Kartendaten: openstreetmap.org
  - Theme: Elevate_Locus.zip:Elevate.xml

Filters:
-------
- Hide waypoints: original 
- LIVE: (-  Live (Hide Found, Own & Archived))* ({"name":"-  Live (Hide Found, Own & Archived)","advanced":true,"inconclusive":false,"tree":{"type":"AND","children":[{"type":"type","config":{"values":["MYSTERY"]}},{"type":"status","config":{"values":["owned_no","found_yes","has_offline_found_log_no","exclude_archived"]}}]}})
- OFFLINE: None ({"advanced":true,"inconclusive":false})
- Additional stored filters: 14

Services:
-------
- Geocaching sites enabled:
   - geocaching.com: Logged in (Login OK) / PREMIUM
   - extremcaching.com: Logged in (Login OK)
- Geocaching.com date format: dd MMM yy
- Geocaching.com website language: en-US
- Last login error on geocaching.com: Failed to log in Geocaching.com as Magpie42 for some unknown reason // failed to find request verification token (2024-09-04 22-46)
- Last successful login on geocaching.com: 2024-09-19 08-25
- Routing: internal / BRouter installed: true

Permissions
-------
- ACCESS_COARSE_LOCATION: granted
- ACCESS_FINE_LOCATION: granted
- READ_CONTACTS: granted
- WRITE_EXTERNAL_STORAGE: DENIED
- POST_NOTIFICATIONS: granted

Paths
-------
- System internal c:geo dir: /data/user/0/cgeo.geocaching (217,4 GB free) v3 internal isDir(10 entries)
- Legacy User storage c:geo dir: /data/user/0/cgeo.geocaching (217,4 GB free) v3 internal isDir(10 entries)
- Geocache data: /storage/emulated/0/Android/data/cgeo.geocaching/files/GeocacheData (217,4 GB free) v3 external non-removable isDir(2701 entries)
- Internal theme sync (is turned ON): /data/user/0/cgeo.geocaching/MapThemeData (217,4 GB free) v3 internal isDir(6 entries)
- Map render theme path: Elevate_Locus.zip:Elevate.xml
- Public Folders: #13
  - BASE: content://com.android.externalstorage.documents/tree/primary:cgeo/document/primary:cgeo (av:true, files:>=4, size:>=4,8 MB, free:>=217,4 GB)
  - OFFLINE_MAPS: content://com.android.externalstorage.documents/tree/primary:Locus/mapsVector/document/primary:Locus/mapsVector (av:true, files:>=67, size:>=35,6 GB, free:>=217,4 GB)
  - OFFLINE_MAP_THEMES: content://com.android.externalstorage.documents/tree/primary:Locus/mapsVector/_themes/Elevate5_Locus/document/primary:Locus/mapsVector/_themes/Elevate5_Locus (av:true, files:>=5, size:>=6,8 MB, free:>=217,4 GB)
- OFFLINE_MAP_SHADING: content://com.android.externalstorage.documents/tree/primary:BLEvo/DEM/DTM Europe, 3sec, by Sonny/document/primary:BLEvo/DEM/DTM Europe, 3sec, by Sonny (av:true, files:>=749, size:>=2,0 GB, free:>=217,4 GB)
  - LOGFILES: content://com.android.externalstorage.documents/tree/primary:cgeo/document/primary:cgeo/logfiles (av:true, files:>=4, size:>=20,9 MB, free:>=217,4 GB)
  - GPX: content://com.android.externalstorage.documents/tree/primary:Download/GPX/document/primary:Download/GPX (av:true, files:>=46, size:>=44,7 MB, free:>=217,4 GB)
  - BACKUP: content://com.android.externalstorage.documents/tree/primary:cgeo/document/primary:cgeo/backup (av:true, files:>=10, size:>=2,2 GB, free:>=217,4 GB)
  - FIELD_NOTES: content://com.android.externalstorage.documents/tree/primary:cgeo/document/primary:cgeo/field-notes (av:true, files:>=166, size:>=2,0 MB, free:>=217,4 GB)
  - SPOILER_IMAGES: content://com.android.externalstorage.documents/tree/primary:cgeo/document/primary:cgeo/GeocachePhotos (av:true, files:>=5, size:>=6,5 MB, free:>=217,4 GB)
  - ROUTING_BASE: content://com.android.externalstorage.documents/tree/primary:cgeo/document/primary:cgeo/routing (av:true, files:>=29, size:>=343,2 KB, free:>=217,4 GB)
  - ROUTING_TILES: content://com.android.externalstorage.documents/tree/primary:Android/media/btools.routingapp/brouter/segments4/document/primary:Android/media/btools.routingapp/brouter/segments4 (av:true, files:>=21, size:>=1,6 GB, free:>=217,4 GB)
  - WHERIGO: content://com.android.externalstorage.documents/tree/primary:cgeo/document/primary:cgeo/wherigo (av:true, files:>=1, size:>=300,2 KB, free:>=217,4 GB)
  - TEST_FOLDER: file:///data/user/0/cgeo.geocaching/files/unittest (av:true, files:>=0, size:>=0 B, free:>=217,4 GB)
- PersistedDocumentUris: #2
  - PROXIMITY_NOTIFICATION_FAR: null
  - PROXIMITY_NOTIFICATION_CLOSE: null
- Persisted Uri Permissions: #6
  - content://com.android.externalstorage.documents/tree/primary:Download/GPX (14 May, 01:26):RW
  - content://com.android.externalstorage.documents/tree/primary:Android/media/btools.routingapp/brouter/segments4 (16 May, 20:00):RW
  - content://com.android.externalstorage.documents/tree/primary:Locus/mapsVector (14 May, 01:22):RW
  - content://com.android.externalstorage.documents/tree/primary:BLEvo/DEM/DTM Europe, 3sec, by Sonny (11 Jun, 20:24):RW
  - content://com.android.externalstorage.documents/tree/primary:cgeo (14 May, 01:20):RW
  - content://com.android.externalstorage.documents/tree/primary:Locus/mapsVector/_themes/Elevate5_Locus (14 May, 01:30):RW

Database
-------
- File: /data/user/0/cgeo.geocaching/databases/data (v103, Size:811,9 MB) on system internal storage
- Data: {cg_attributes=218720, cg_caches=29086, cg_caches_lists=34529, cg_categories=145, cg_extension=99, cg_filters=14, cg_lists=103, cg_logCount=113772, cg_logImages=101021, cg_logs=791394, cg_logs_offline=21, cg_logs_offline_images=0, cg_logs_offline_trackables=22, cg_route=0, cg_search_destination_history=0, cg_spoilers=34584, cg_trackables=5278, cg_trail_history=8200, cg_variables=148, cg_waypoints=50997}
- Extension Data: {DBEXTENSION_DOWNGRADEABLE_DBVERSION=1, DBEXTENSION_EMOJILRU=10, DBEXTENSION_FOUNDNUM=5, DBEXTENSION_LAST_TRACKABLE_ACTION=5, DBEXTENSION_ONE_TIME_DIALOGS=8, DBEXTENSION_POCKETQUERY_HISTORY=70}

--- End of system information ---

Additional Information

When the cursor has been set to the end of the line, moving the cursor to the left needs two clicks on Cursor left to see a movement. Obviously there is an invisible char (CR or LF?), which has to be skipped, first. If I select the second last char and move the cursor one step to the right, the text will be inserted correctly. Already tried to catch it with an hex editor, but clipboard seems to "cure" the problem ... :/ Same with export to GPX, where (in hex) the CR/LF is converted to a single char. Just an idea: Maybe this happens in PNs which are initially created by copying text from the listing ... will check.

MagpieFourtyTwo avatar Sep 19 '24 06:09 MagpieFourtyTwo

Seems to happen more often if the PN text has been copied from the listing text (we usually do so with longer Multis and Mysteries, to get a framework for our notes).

Moreover I even have this issue with some of my Signature Templates, which have been inserted into Logs via the + sign. But not with all of them. And not at the end of all lines ...

Any chance to get a hand on this very last invisible char? Tried to paste it into a hex editor, but as soon as the text is in clipboard, the invisible char is gone. Even if I just cut and paste the entire text from/into PN, the invisible chars are gone and everything works as expected (i. e. WYSIWYG again).

MagpieFourtyTwo avatar Sep 30 '24 11:09 MagpieFourtyTwo

You could pull the sqlite file (from backup) and inspect that one

ztNFny avatar Sep 30 '24 19:09 ztNFny

Good idea - will do so this evening ...

MagpieFourtyTwo avatar Oct 01 '24 01:10 MagpieFourtyTwo

No way ... although EOLs behave different in the PN, in the cgeo.sqlite file they look absolutely similar: No matter if in PN the char appended to the end of a line goes to the "correct" (same) line or if it jumps right to the beginning of the next one, in the file there is always just a 0a, i. e. LF. I have absolutely no clue what the reason for this weird and extremely annoying behavior may be ...

BTW: Sometimes I even have to type an ENTER, then select the end of the last line, and the char that should be appended already goes to the next line ... I'm clueless. :((

MagpieFourtyTwo avatar Oct 08 '24 23:10 MagpieFourtyTwo