Bug 134331 - Alphabetical Sorting in dialog "Basic Macros", column "Existing Macros" is uncomfortable
Summary: Alphabetical Sorting in dialog "Basic Macros", column "Existing Macros" is un...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.4.4.2 release
Hardware: All All
: medium minor
Assignee: Andreas Heinisch
URL:
Whiteboard: target:7.1.0
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-27 07:53 UTC by Andreas
Modified: 2020-09-21 10:29 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
sample file (8.85 KB, application/vnd.oasis.opendocument.text)
2020-07-13 14:21 UTC, Xisco Faulí
Details
Before the patch: list is sorted alphabetically (14.07 KB, image/png)
2020-07-15 13:19 UTC, Andreas Heinisch
Details
After the patch: list is sorted according to their position (56.54 KB, image/png)
2020-07-15 13:19 UTC, Andreas Heinisch
Details
Tools - Macros - Run Macro ( LibreOffice 4.4 ) (23.92 KB, image/png)
2020-07-15 17:16 UTC, Xisco Faulí
Details
Tools - Macros - Organize Macros - Basic ( with fix for bug 70813 ) (31.70 KB, image/png)
2020-07-15 17:18 UTC, Xisco Faulí
Details
Tools - Macros - Organize Macros - Basic ( without fix for bug 70813 ) (31.72 KB, image/png)
2020-07-15 17:19 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas 2020-06-27 07:53:44 UTC
Description:
In dialog "Basic Macros" (menu "Tools - Macros - Organize Macros - Basic") the content of column "Existing Macros" is alphabetical sorted.
In earlier versions of LibO (e. g. 5.4.7.2) it wasn't.
Alphabetical sorting of that column is rather uncomfortable, as the procedures of a basic module aren't shown the way the user has grouped them in their module.
Please, remove the alphabetical sorting feature of that column.

(Alphabetical sorting in Column "Macro Form" is okay, but not in column "Existing Macros".)


Steps to Reproduce:
1. Menu "Tools - Macros - Organize Macros - Basic" opens dialog "Basic Macros".
2. Column "Existing Macros" on the right.

Actual Results:
Items in that column are alphabetical sorted.
In earlier versions of LibO (e.g. 5.4.7.2) they weren't, which is more comfortable.

Expected Results:
The items (= procedures within a macro module) should be sorted according to their position in their module.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.4.4.2
Build ID: 3d775be2011f3886db32dfd395a6a6d1ca2630ff
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: de-DE (de_DE.UTF-8); UI-Language: en-US
Calc: threaded
Comment 1 Xisco Faulí 2020-07-13 14:21:38 UTC
Created attachment 162981 [details]
sample file
Comment 2 Xisco Faulí 2020-07-13 14:31:10 UTC
The changes was done on purpose in https://git.libreoffice.org/core/+/1dd8cde5cd2e692a442b6885c59634fba3737284%5E! in order to fix bug 70813

Adding UX Team to decide what to do and proceed
Comment 3 Andreas Heinisch 2020-07-13 17:41:42 UTC
We could add the possibility to sort the macro list either way, for instance, using the right click event or an additional button.
Comment 4 Heiko Tietze 2020-07-14 12:37:45 UTC
(In reply to Xisco Faulí from comment #2)
> The changes was done on purpose in

This patch aims to fix typos. Adding Andrea and Julian.

I sympathize with the idea to keep the function order.
Comment 5 Xisco Faulí 2020-07-14 12:52:02 UTC
(In reply to Heiko Tietze from comment #4)
> (In reply to Xisco Faulí from comment #2)
> > The changes was done on purpose in
> 
> This patch aims to fix typos. Adding Andrea and Julian.
> 
> I sympathize with the idea to keep the function order.

ouch, wrong link: 
https://git.libreoffice.org/core/+/1dd8cde5cd2e692a442b6885c59634fba3737284%5E%21
Comment 6 Heiko Tietze 2020-07-14 13:00:44 UTC
Bug 70813 talks about inconsistencies. I don't see why we should keep the user oder. Andreas Heimisch, what do you think?

Sorry Andrea & Julien for the noise.
Comment 7 Andreas Heinisch 2020-07-14 13:05:39 UTC
I think we should give the user the possibility to chose and keep the chosen sorting.
Comment 8 Heiko Tietze 2020-07-14 13:12:23 UTC
(In reply to Andreas Heinisch from comment #7)
> I think we should give the user the possibility to chose and keep the chosen
> sorting.

Okay => NEW. 

Would be cool if you get time to implement this.
Comment 9 Andreas Heinisch 2020-07-14 13:24:38 UTC
Would you prefer it using a right click menu or rather a specific button?
Comment 10 Heiko Tietze 2020-07-14 13:38:28 UTC
No new interaction, it's just about the order of entries. Right now it is alphabetically but should become what the macro file provides like

function foo()
...
function aaa()

should be listed as 

- foo
- aaa
Comment 11 Andreas Heinisch 2020-07-14 16:50:56 UTC
I don't remember exactly where I changed this behaviour, but prior all these sorting changes, it was sorted like requested in this report.
Comment 12 Andreas Heinisch 2020-07-14 17:40:20 UTC
It was this change:
https://github.com/LibreOffice/core/commit/aee3aa2610971936d6f402365ebf34c14847ab44, but without the m_xMacroBox->make_sorted(); at line 497, but imho, we just have to drop https://opengrok.libreoffice.org/xref/core/basctl/source/basicide/macrodlg.cxx?r=cd0ab2cf#80.
Comment 13 Heiko Tietze 2020-07-15 09:20:41 UTC
Tested with and without the patch and both return C,B,A. Xisco, could you please review?
Comment 14 Andreas Heinisch 2020-07-15 13:19:15 UTC
Created attachment 163066 [details]
Before the patch: list is sorted alphabetically
Comment 15 Andreas Heinisch 2020-07-15 13:19:52 UTC
Created attachment 163067 [details]
After the patch: list is sorted according to their position
Comment 16 Xisco Faulí 2020-07-15 17:16:38 UTC
Created attachment 163071 [details]
Tools - Macros - Run Macro ( LibreOffice 4.4 )
Comment 17 Xisco Faulí 2020-07-15 17:18:52 UTC
Created attachment 163072 [details]
Tools - Macros - Organize Macros - Basic ( with fix for bug 70813 )
Comment 18 Xisco Faulí 2020-07-15 17:19:14 UTC
Created attachment 163073 [details]
Tools - Macros - Organize Macros - Basic ( without fix for bug 70813 )
Comment 19 Xisco Faulí 2020-07-15 17:21:47 UTC
So, the problem is, there are two dialogs.

- First Dialog ( Tools - Macros - Run Macro ) -> has been sorted alphabetically since at least ( see screenshot )

Version: 4.3.0.0.alpha1+
Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e

- Second Dialog ( Tools - Macros - Organize Macros - Basic ) -> Sorted alphabetically since https://git.libreoffice.org/core/+/1dd8cde5cd2e692a442b6885c59634fba3737284%5E%21

so the behaviour should be changed in both dialogs simultaneously
Comment 20 Andreas Heinisch 2020-07-15 17:45:35 UTC
Commit https://git.libreoffice.org/core/+/1dd8cde5cd2e692a442b6885c59634fba3737284%5E%21 lead to a problem with the TreeBox, so it was fixed in https://github.com/LibreOffice/core/commit/aee3aa2610971936d6f402365ebf34c14847ab44.

My current commit (https://gerrit.libreoffice.org/c/core/+/98783) should restore the sorting in the second dialog. I will add the specific sorting for the first dialog.
Comment 21 Andreas Heinisch 2020-07-27 08:34:22 UTC
A question: Should it be possible that the user makes a sort decision and this decision is kept for the entire document or should it the list always be sorted by document order and the user has the possibility to sort it in alphabetic order, which is lost after the document is closed?
Comment 22 Heiko Tietze 2020-07-27 08:40:42 UTC
(In reply to Andreas Heinisch from comment #21)
> A question: Should it be possible that the user makes a sort decision and
> this decision is kept for the entire document or should it the list always
> be sorted by document order and the user has the possibility to sort it in
> alphabetic order, which is lost after the document is closed?

In general, storing user decisions is desirable. In this particular case I guess not many macros have such a long list of functions that alphabetical sorting is needed. To cut it short, remember the last user choice if it's very easy to implement with no drawbacks or just always start with the given sequence and allow to sort alphabetically.
Comment 23 Andreas Heinisch 2020-07-27 09:36:46 UTC
Personally, I would keep it simple and not write any additional options in the config file. To sum it up, the default option is document order and the user has the possibility to sort it alphabetically and vice versa.
Comment 24 Heiko Tietze 2020-07-27 10:00:42 UTC
(In reply to Andreas Heinisch from comment #23)
> Personally, I would keep it simple and not write any additional options in
> the config file. To sum it up, the default option is document order and the
> user has the possibility to sort it alphabetically and vice versa.

Yes. Call it maybe "Sort >" with "( ) Alphabetical order" and "(o) Proper sequence" (radio buttons, default is "proper").
Comment 25 Commit Notification 2020-09-20 23:40:06 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/327091048c8cbcad0178dfd8e06813153e861e5e

tdf#134331 - Added possibility to sort macros via context menu

It will be available in 7.1.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:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 26 Heiko Tietze 2020-09-21 07:32:17 UTC
(In reply to Commit Notification from comment #25)
> Andreas Heinisch committed a patch related to this issue.

Please change the status to Resolved/Fixed when done. Thanks a lot for taking care.