Bug 143733 - Make selection border wider
Summary: Make selection border wider
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) release
Hardware: All Windows (All)
: medium enhancement
Assignee: Heiko Tietze
Whiteboard: target:7.4.0
Depends on:
Blocks: Selection
  Show dependency treegraph
Reported: 2021-08-04 22:03 UTC by fml2
Modified: 2022-05-02 11:44 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:
Regression By:

Selection in Calc (3.81 KB, image/png)
2021-08-04 22:04 UTC, fml2
Selection in Excel (4.54 KB, image/png)
2021-08-04 22:05 UTC, fml2
Screenshot (21.91 KB, image/png)
2022-01-24 07:49 UTC, Heiko Tietze

Note You need to log in before you can comment on or make changes to this bug.
Description fml2 2021-08-04 22:03:47 UTC
This has been first noted in Bug 142959, but I think it deserves a separate ticket.

IMO the selection border in Calc (i.e. the border that marks the current cell) is drawn in a suboptimal way. It's drawn *within* the cell space thus eating space from the information in focus (the current cell).

IMO Excel does it in a smarter way. Excel draws the border around the cell, but the border is *beyond* the cell so that the "interesting" information is not "cropped".

See the attached images that should explain what I mean.

Steps to Reproduce:
Create an empty sheet and put the "cursor" to the cell B2.

Actual Results:
The selection border is within the cell.

Expected Results:
The selection border is beyond the cell.

Reproducible: Always

User Profile Reset: No

Additional Info:
This would make Calc visually more attractive.
Comment 1 fml2 2021-08-04 22:04:41 UTC
Created attachment 174089 [details]
Selection in Calc
Comment 2 fml2 2021-08-04 22:05:39 UTC
Created attachment 174090 [details]
Selection in Excel
Comment 3 Heiko Tietze 2021-09-02 07:26:15 UTC
Made the rectangle slightly larger and adjust it according the selection. When you zoom in the line width grows up to 4px.
Comment 4 S.Zosgornik 2021-09-03 02:19:37 UTC
I very agree. The active cell border should be drawn around the current cell.
This was the best behavior MS Excel ever did.

There may still compatibility-issues inside LO Calc  with double cell orders but
drawing a 2 pixel wide highlighting border (or maybe even 3) should solve this.

This would address the problem that Calc covers the current cell border color.
Comment 5 Commit Notification 2022-01-17 07:47:06 UTC
Heiko Tietze committed a patch related to this issue.
It has been pushed to "master":


Resolves tdf#143733 - Make selection border wider

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:

Affected users are encouraged to test the fix and report feedback.
Comment 6 fml2 2022-01-23 10:35:31 UTC
Thanks for implementing! Are there screenshots of the new feature? If possible, with different zoom levels. Could you attach them to the issue? Thank you!
Comment 7 Heiko Tietze 2022-01-24 07:49:50 UTC
Created attachment 177730 [details]

Zoom at 50, 100 and 200% using KDE but with gtk3 VCL.
Comment 8 fml2 2022-01-24 08:26:11 UTC
Thank you for creating the attachment!

May I add some comments?

1. Zoom 50%: The border is very uneven. Top and right lines are much thicker than the bottom and left ones. Besides, the bottom line is *within* the cell (and the subject of this ticket was to place it outside the cell). But I personally never work at 50% zoom hence this case is not important for me.

2. Zoom 100%. I see that the left and top lines are half within and half outside the cell. Could we make the lines completely outside the cell so that no inner space is eaten by the border at all?

The right and the bottom lines are mainly *within* the cell, i.e. the border is not drawn in a symmentical way. Could you please also fix that?

3. Zoom 200%. Same comments as for 100% apply.

Also, because there are still issues with this, could we reactivate the ticket? I think it would be an overkill to open a new one for those.

Thank you!
Comment 9 Heiko Tietze 2022-01-24 08:58:03 UTC
(In reply to al.le from comment #8)
> 1. Zoom 50%: The border is very uneven.
Some aliasing or rounding issue, haven't seen it on Windows. Ultimately I cannot do much without spoiling the 100% too much. Goal was to keep the size at 100% as close as possible to what we had before and to make it smaller at 50% and reasonably larger when zoomed in. Plus, lines should always be centered on the border.

> 2. ...Could we make the lines completely outside the cell

Yes, but why? To keep the content free of formatting? Please also consider left- and top-most cells.

Please test the patch with a nightly build. Looking at pictures can be misleading. And yes, you can reopen the ticket if needed.
Comment 10 fml2 2022-01-24 11:34:40 UTC
If I'm not mistaken, the border would look better if you add "+1" to the right and bottom coordinates (which was deleted with the commit). At least with 100% and 200%.


basegfx::B2DRange aRB(rRA.Left() - MinSize - fZoom, rRA.Top() - MinSize - fZoom,
                      rRA.Right() + MinSize + fZoom + 1, rRA.Bottom() + MinSize + fZoom + 1);
Comment 11 fml2 2022-01-24 11:45:04 UTC
Since the result is still not 100% satisfying, I reactivate the ticket.
Comment 12 fml2 2022-01-25 10:34:18 UTC
> Please also consider left- and top-most cells.

I checked how it's done in Excel. They have marks in the row and column headings that mark the current cell. The marks have the same color as the border. If e.g. a left most cell is selected, the mark becomes the left side of the border.

Since LO does not have such marks, this solution would not fit here.

Also, I've checked that Excel draws the border very accurately regardles of the zoom. There are no rounding effects at all. Everything is always exact to the pixel.
Comment 13 stragu 2022-04-13 00:45:13 UTC
fml2: can you confirm that have you tested a recent daily build? If so, do you find the current state satisfactory?

Comment 14 fml2 2022-04-13 14:34:53 UTC
I've tried it with the build 2022-04-13 03:23:47. The border looks better now, i.e. it is drawn symmetrically around the cell.

But the main point of this issue is still missed since the border is still drawn *within* the cell and not "outside" of it.
Comment 15 QA Administrators 2022-04-14 03:41:33 UTC Comment hidden (obsolete)