FreeCAD icon indicating copy to clipboard operation
FreeCAD copied to clipboard

Spreadsheet prepends single quote to cell string value

Open MattN92705 opened this issue 2 years ago • 15 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Version

0.21 (Development)

Full version info

[code]
OS: macOS 10.15
Word size of FreeCAD: 64-bit
Version: 0.21.0.33682 (Git)
Build type: Release
Branch: master
Hash: 9dce2525f8efe0873787f4388f10e11e168fe16b
Python 3.10.12, Qt 5.15.8, Coin 4.0.0, Vtk 9.2.5, OCC 7.6.3
Locale: C/Default (C)
Installed mods: 
  * A2plus 0.4.60n
  * fasteners 0.4.56
  * ExtremeProLight 1.6.0
  * Help 1.0.3
  * Assembly4 0.50.2
  * Assembly3 0.12.0
[/code]

Subproject(s) affected?

Spreadsheet

Problem description

FreeCAD weekly build 33682 has a bug in Spreadsheet when entering text into a cell.

  • Type some text into a cell, e.g., “This is text”
  • Hit return to enter the value
  • The value appears to be correct when looking at the text in the spreadsheet, but…
  • Select the cell with the text and look at the “Content” line at the top
  • The cell’s content is actually “ ‘This is text “ (note the extra single quote prepended to the string).

Entering numbers seems to work correctly.

I like to build lists of “parameter name” : “value” pairs in adjacent cells by copying the parameter name and pasting it into the Alias property of the cell with the value. The single quote makes the parameter name an invalid alias, requiring manually deleting the single quote from the alias field.

Small bug, but if you are putting together a large spreadsheet with parameters, it gets tiring.

Anything else?

Screen Shot 2023-08-03 at 8 02 31 AM

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

MattN92705 avatar Aug 03 '23 15:08 MattN92705

Interesting. I saw this change, and since it impacted my use of the EasyAlias macro, I created a note in the forum for the macro author, since I wasn't sure if this changed behavior was actually intended with 0.21 or not.

https://forum.freecad.org/viewtopic.php?t=80122

JohnOCFII avatar Aug 03 '23 15:08 JohnOCFII

It is intended behavior, to take care of some string-handling issues. Isn't there a macro that makes these aliases for you? I feel like I have seen that in the addon manager.

chennes avatar Aug 03 '23 18:08 chennes

this is a recent change? it certainly didn't used to behave that way.

While i understand that this may be there to make string handling easier, it seems like a very strange behavior from a user perspective. I would even go further and say this is incorrect behavior. Type a string into a cell, then copy the cell, then past someplace else - the result is different than what you originally entered into the cell, and also different than what the cell displays. the software shouldn't change the content that is entered.

I honestly haven't looked at alias macros - but if the spreadsheet is going to stay this way, i will.

MattN92705 avatar Aug 03 '23 18:08 MattN92705

The fix is probably to adjust the paste code -- that's how Excel handles it, basically. When you paste from within Excel the explicit string indicator is retained when pasting into a cell, but dropped when pasting anywhere else.

chennes avatar Aug 03 '23 19:08 chennes

The EasyAlias macro seems quite popular. I'm hoping the author (TheMarkster, in the forums) sees my note and can make the update.

JohnOCFII avatar Aug 03 '23 21:08 JohnOCFII

FYI - TheMarkster has posted the updated code for his macro (tested, works well) in the Forum thread, and will soon had the updated EasyAlias Macro posted so the Addon Manager will find it.

https://forum.freecad.org/viewtopic.php?t=80122

JohnOCFII avatar Aug 04 '23 01:08 JohnOCFII

Close ticket ?

luzpaz avatar Aug 05 '23 14:08 luzpaz

IMHO a macro with a workaround for a specific use case is not a fix. As long as the contents of a cell are being modified by the software and cannot be cut/pasted as expected, i would still consider it a problem that needs correction.

MattN92705 avatar Aug 05 '23 14:08 MattN92705

This problem actually extends beyond the Spreadsheet workbench. My primary use of Freecad is for cabinet making and extensively use the A2P Parts Infor and Partslist features to create cut lists for my different cabinet assemblies. Once I have the parts Lists, I copy those to an Excel APP I developed for cut lists to send to my supplier(s) for quotes.

Needless to say, having '' appended to the front of text strings (see image below) is a major issue for users like myself!

Single Quote Spreadsheet issue

hermannjt avatar Aug 10 '23 06:08 hermannjt

Hello, I agree with @hermannjt it is a strange behaviour, we could not copy/paste content of spreadsheet cell anymore, in the alias field nor in another place (terminal, browser).

Capture d’écran de 2023-08-12 14-36-52

OS: Ubuntu Core 20 (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.21.0.33668 +7 (Git) Snap 727
Build type: Release
Branch: tag: 0.21.0
Hash: 41b058e2087de60dc8fef3d3e68c7d0129e13abf
Python 3.8.10, Qt 5.15.7, Coin 4.0.0, Vtk 7.1.1, OCC 7.6.3
Locale: French/France (fr_FR)

Jodaille avatar Aug 12 '23 12:08 Jodaille

I'm just going to leave another "this is surprising behaviour that feels like a bug" comment - specifically, copy a field; paste it into the alias box; hit enter: that workflow is now broken.

regularfry avatar Aug 14 '23 20:08 regularfry

There hasn't been any "design" comments since @chennes said it was an intentional design decision. Every time i use the spreadsheet I am dismayed to see this bizarre behavior - how can altering user-entered data be a good design? As others have said, it is no longer possible to easily cut/paste between the spreadsheet and any other application. I'd like to see some sort of acknowledgement from the development team that this needs to be fixed...

MattN92705 avatar Sep 14 '23 15:09 MattN92705

This behavior wasn't there before upgrading to v0.21. It is quite annoying. In the past, when I would type an equation into the cell and it was an error, it would turn red and make sure you fixed it.

Now it just puts a quote in front of it and accepts it. Then when you figured out you have an error, now you have to go in and delete the quote before you can accept the change.

The ONLY advantage I see so far is that cell errors are quoted out so your spreadsheet no longer has errors when an equation changes. This allows the calculations in the 3D side to continue. However, if any of those drawing parts are using the spreadsheet with the errors masked now, it still causes grief, so I don't think the benefits outweigh the negatives here.

Another behavior that I noticed has changed is that if you change the Alias name in the spreadsheet now and you were using that Alias as a constraint or other variable, when you go and look at the link in that constraint, the <<Actual Name of Spreadsheet>> part of the link is not just <<Spreadsheetxxxx>> (whatever internal name FreeCAD uses). I have to go in and reset the names to get the links to work again.

Not sure if this is related or a completely different issue.

PAS-DRAFTER avatar Oct 02 '23 23:10 PAS-DRAFTER

There hasn't been any "design" comments since @chennes said it was an intentional design decision. Every time i use the spreadsheet I am dismayed to see this bizarre behavior - how can altering user-entered data be a good design? As others have said, it is no longer possible to easily cut/paste between the spreadsheet and any other application. I'd like to see some sort of acknowledgement from the development team that this needs to be fixed...

Had the same problem today by using the Alias Manager Macro which does not work anymore because of that, costs me at least an hour to figure out what is happening! Not a very satisfying user experience...

ModuloFS avatar Nov 30 '23 16:11 ModuloFS

It seems that this just isn't implemented fully. It's correct to be able to escape values with the leading '. It's like a formula starting with =. But the pasted value always including it is wrong. Copying it has two distinct use-cases:

  1. Pasting the value
  2. Pasting the formula

Basically, the copy operation needs to store both, in different clipboard formats. This is supported on all major platforms as far as I'm aware.

Then, when pasting, the target application decides which format to use. Most will probably default to the plain text clipboard, which should contain the plain value only, excluding the leading '. The formula clipboard format would only be accepted in contexts that actually understand it, like spreadsheet cells.

Since FreeCAD formula rules aren't compatible with other software, even if they look similar, it probably should be a private clipboard format.

See QClipboard.

jwueller avatar May 13 '24 15:05 jwueller