inspector icon indicating copy to clipboard operation
inspector copied to clipboard

Update string truncation behavior

Open j-f1 opened this issue 5 years ago • 2 comments

This should look visually similar, but selecting and copying a truncated string will now copy the entire string (excluding the “…”), even the portion that is not visible.

I have also changed the ellipsis from the standard ellipsis character (), which can easily be missed, to a more obvious ••• rendered in black so it is clearly not part of the string.

Screenshot_2020-10-09 15 19 25

j-f1 avatar Oct 09 '20 19:10 j-f1

Would it be possible to get this merged? It annoys me that it’s really hard to copy out long strings from notebooks.

j-f1 avatar Nov 29 '22 01:11 j-f1

I believe the ellipsis is not only a visual aid for long strings, but also avoids rendering excessively large strings in the DOM. Under that premise you'd have to pick a different strategy. Some suggestions:

  • replace the ellipsis with its masked content on click
  • allow truncated strings to be expanded (like we do for arrays and objects), revealing the entire string line-wrapped
  • detect copy events, determine whether the ellipsis text node is in the selection range, and replace it with the actual content
  • add an explicit copy button (e.g. on hover)

mootari avatar Nov 29 '22 11:11 mootari