Bug 104271 - New comment box should automatically re-position and re-size appropriately based on the shape of text pasted into it
Summary: New comment box should automatically re-position and re-size appropriately ba...
Status: CLOSED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Calc-Comments
  Show dependency treegraph
 
Reported: 2016-11-30 07:09 UTC by lopeonline
Modified: 2024-02-10 09:49 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lopeonline 2016-11-30 07:09:24 UTC
Description:
Creating comments in Libre Office Calc is very tedious and inconvenient.

After implementing this very simple algorithm it will be a pleasure to add new comments to a calc worksheet :)

Steps to Reproduce:
1. Right click a cell in Calc and click "Add comment" 

2. Add a comment to a cell that is on the right of the workspace.

3. Create a new comment and paste in some text.

4. Try paste some text into a new comment and then position it or resize it.

5. Try drag a new comment to a new position.


Actual Results:  
1. It opens a new comment box, positioned 3 cells above and 1 cell to the right of the cell.
This is a very bad default position for a new comment, because:

2. It scrolls the whole calc workspace to the right unnecessarily, so you can't see the left column anymore, so you have to manually scroll left after adding the comment.

3. The comment box's position and width are not set appropriately.

4. It also does not allow you to immediately resize the comment box. You have to first click outside the comment box, then the new comment is hidden, then you have to right click the cell and show the comment. Then you have to click the comment once, ONLY then can you resize it.

5. The first time you drag a newly created comment box away from it's original position, it moves a little bit, then disappears and resumes it's original position. The 2nd time you drag it, it is dragged properly.

Expected Results:
The default position of the comment box should be that the left edge of the comment box is aligned with the left of the cell being commented on, and the top edge of the comment box should be aligned with the bottom of the cell being commented on.

The above is just to correct the very inconvenient default position.
But here comes the really useful/innovative part that will make calc a pleasure to add comments :)

In a Nutshell: When text is pasted into the new comment box, the box should expand as necessary to accommodate the pasted text, up to a maximum width equal to the workspace in calc window; after setting the width, the height should be set to accommodate the entire comment text.

#1. The top of the comment box should be aligned with the bottom of the cell being commented on.

CALCULATING IDEAL COMMENT BOX WIDTH
#2. The ideal width and height of the comment box should be calculated according to the following simple rules.
First the algorithm must determine the longest line in the pasted text.
That is the ideal width of the comment box, HOWEVER if it is wider than the viewable area then the comment box's ideal width must be reduced so that it fits into the calc window's workspace's width. Lines longer than the ideal width will be wrapped.

2.1 An option should be added for the user to specify the maximum calculated width for a comment box. Personally I won't limit the width. I paste a lot of code snippets, and I'm quite happy with comment boxes that take up the width of my workspace when necessary. But other people who are not programmers may likely paste mostly long paragraphs that don't have much line breaks, that can be arbitrarily wrapped at any length. They may prefer to limit their automatic comment box width.

#3. If the calculated ideal width of the comment box can fit horizontally from the left edge of the cell being commented on, to the right edge of the workspace (at the current scroll position), then the left edge of the comment box should be aligned with the left of the cell being commented on, and the comment box should have the calculated ideal width as described above.

#4. If the calculated ideal width exceeds what can fit in #3 then the comment box should be set to it's ideal width (#1) and the right edge of the comment box should be aligned with the right edge of the calc window's workspace.

CALCULATING IDEAL COMMENT BOX HEIGHT
The ideal comment box height must fit the number of lines in the pasted text, taking into consideration word-wrapping (if it occurs), given the comment box's (ideal calculated) width. The workspace's vertical scrolling position must be scrolled down if necessary if the bottom edge of the comment box is below the currently viewable area of the workspace...
Calc does not provide the ability to scroll down inside a comment box, so the height of the comment box cannot be limited to the workspace height minus the height of the cell being commented on. Instead the comment box's height must be set such that the entire comment can be viewed by manually scrolling down. However the vertical scroll position of the calc window after pasting a massively long comment should have the cell being commented fully viewable at the top of the workspace, with the beginning part of the comment directly below it.


Reproducible: Always

User Profile Reset: N/A

Additional Info:


User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/53.0.2785.143 Chrome/53.0.2785.143 Safari/537.36
Comment 1 Yousuf Philips (jay) (retired) 2017-05-02 22:31:49 UTC
(In reply to lopeonline from comment #0)
> Actual Results:  
> 1. It opens a new comment box, positioned 3 cells above and 1 cell to the
> right of the cell.
> This is a very bad default position for a new comment, because:
> 
> 2. It scrolls the whole calc workspace to the right unnecessarily, so you
> can't see the left column anymore, so you have to manually scroll left after
> adding the comment.

So possibly it should be aware of the available space in all directions and open the comment box in the most optimal position, just like it does so on hovering over the cell, but saves the original position still as the position to open the comment when right click > show comment. Excel has a similar behaviour as Calc. Calligra and WPS have editing comments in a dialog box.

> 3. The comment box's position and width are not set appropriately.

Calc's comment width (106px) is ~80% of the size of Excel's (129px) and ~50% of the size of Google Sheets (216px). I can fit 13 numbers (liberation sans 10pt) in Calc's comment width, 20 numbers (tahoma 8pt) in Excel and 27 numbers (arial 10pt) in Google Sheets. With Calc's default cell width, you can fit 23 numbers in two cells, while Writer's comments you can fit 25 numbers. Aiming to fit 20+ numbers per line would be what i'd recommend doing and we can get to 22 numbers per line by increasing the width to fit 2 cells (~165px). We could fit 24 numbers if we also reduce the font size to 9pt.

> 4. It also does not allow you to immediately resize the comment box. You
> have to first click outside the comment box, then the new comment is hidden,
> then you have to right click the cell and show the comment. Then you have to
> click the comment once, ONLY then can you resize it.

Yes unfortunately as comments are treated exactly like shapes and textboxes, I doubt it would be possible to resize it while in text edit mode. @Regina: Any insights?

> 5. The first time you drag a newly created comment box away from it's
> original position, it moves a little bit, then disappears and resumes it's
> original position. The 2nd time you drag it, it is dragged properly.

Not able to reproduce this behaviour.

> In a Nutshell: When text is pasted into the new comment box, the box should
> expand as necessary to accommodate the pasted text, up to a maximum width
> equal to the workspace in calc window; after setting the width, the height
> should be set to accommodate the entire comment text.

Not sure that resizing the width of the comment box based on the pasted text is the way to go, as most comments are typed and are short.
Comment 2 Heiko Tietze 2017-05-03 07:25:24 UTC
(In reply to Yousuf Philips (jay) from comment #1)
> So possibly it should be aware of the available space in all directions and
> open the comment box in the most optimal position, just like it does so on
> hovering over the cell, but saves the original position still as the
> position to open the comment when right click > show comment.

Actually place the comment like how context menus open. Meaning downwards at right for top-left clicks, upward/right at the bottom left etc. And unless the user manually places the box I would do the auto placement in this way, i.e. after scrolling the comment might be on a different place. EASYHACK?

If there is enough space the box should remain at right and above the cell.
Comment 3 Cor Nouws 2018-11-28 18:28:21 UTC
I support the idea.
Comment 4 Heiko Tietze 2018-11-28 19:25:18 UTC
Going over this again I think the position works for me. Have never seen users complain about top right and guess we run into regression calls with bottom right.

About the size I support the idea but to a lesser extend. The proposal assumes line breaks but that is rarely the case. So the suggestion is to make it a little bit larger by default and resize the height accordingly. That should also be done when text is deleted or the box is horizontally resized, meaning the height is shrunk down to fit the text.
Comment 5 martin garix 2018-12-07 06:57:15 UTC Comment hidden (spam)
Comment 6 Niha 2020-05-31 06:12:43 UTC Comment hidden (spam)
Comment 7 Nadya Kaur 2021-01-28 12:27:28 UTC Comment hidden (spam)
Comment 8 JohnSmith 2022-01-29 15:39:54 UTC Comment hidden (spam)
Comment 9 WilliamIshmael 2022-02-01 09:40:59 UTC Comment hidden (obsolete, spam)
Comment 11 Emmy Wuckert 2022-03-10 05:39:24 UTC Comment hidden (spam)
Comment 12 Anjali 2022-06-17 11:45:56 UTC Comment hidden (spam)
Comment 13 Model Girls 2022-10-20 07:02:45 UTC Comment hidden (spam)
Comment 14 poojasharmaji 2022-11-10 05:57:02 UTC Comment hidden (spam)
Comment 17 Myra Kapoor 2022-11-10 11:51:55 UTC Comment hidden (spam)
Comment 18 Aliyaarora 2022-11-15 11:44:23 UTC Comment hidden (spam)
Comment 19 Model Girls 2022-11-21 07:11:55 UTC Comment hidden (spam)
Comment 20 Model Girls 2022-11-21 07:12:48 UTC Comment hidden (spam)
Comment 21 Model Girls 2022-11-21 07:13:24 UTC Comment hidden (spam)
Comment 22 giaverma 2023-01-14 05:01:34 UTC Comment hidden (spam)
Comment 25 pooja sharma 2023-01-17 12:30:52 UTC Comment hidden (spam)
Comment 26 pooja sharma 2023-01-17 12:32:22 UTC Comment hidden (spam)
Comment 28 ananyasharma 2023-02-01 11:53:57 UTC Comment hidden (spam)
Comment 29 ananyasharma 2023-02-01 11:55:13 UTC Comment hidden (spam)
Comment 30 ananyasharma 2023-02-11 13:17:15 UTC Comment hidden (spam)
Comment 31 Ritu Sharma 2023-03-24 17:19:21 UTC Comment hidden (spam)
Comment 32 Celia 2023-03-31 07:47:02 UTC Comment hidden (spam)
Comment 33 GoaEscorts Deepika 2023-04-09 14:22:30 UTC Comment hidden (spam)
Comment 34 Anjali Rana 2023-04-10 20:49:03 UTC Comment hidden (spam)
Comment 35 priyanka bhatt 2023-05-25 11:05:32 UTC Comment hidden (spam)
Comment 38 priyanka bhatt 2023-05-25 11:06:23 UTC Comment hidden (spam)
Comment 39 monakhan 2023-05-25 13:47:46 UTC Comment hidden (spam)
Comment 40 Heiko Tietze 2023-05-25 13:49:38 UTC
(In reply to Heiko Tietze from comment #4)
> Going over this again I think the position works for me.

Resolving WF (also to close the honey pot).
Comment 41 poojasingh399 2024-02-10 09:49:42 UTC Comment hidden (spam)