View Issue Details

IDProjectCategoryView StatusLast Update
0001560SkyChart1-Softwarepublic16-11-24 17:48
ReporterSasa Assigned ToPatrick Chevalley  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinux 64-bitOSKubuntuOS Version14.04
Target Version4.0 
Summary0001560: Search objects history
DescriptionCurrently, only first 3 searched objects are stored when close and reopen CDC.

Perhaps to keep at least last 5 searched object?
Steps To Reproduce1. Open CDC and search for Mars, Jupiter, Venus, Sun etc.
2. Exit from CDC and reopen

Only Mars, Jupiter and Venus would be listed in drop-down list.
TagsNo tags attached.

Activities

Patrick Chevalley

16-11-24 13:30

administrator   ~0003405

The list must save the last 15 objects without duplicate. It is saved when you close the program even if you not save the config.

You can check in file ~/.skychart/skychart.ini :
[quicksearch]
count=15
item1=m12
...
item15=ic1848

If the ini file is right, trace the load when the program start at pu_main line 6135.
Also check in main form that quicksearch combobox dropdowncount property is 15.

And maybe your Gtk theme add a hidden scrollbar to the list if the length is more than 3, try to move the mouse on the right of the list.



Sasa

16-11-24 14:20

reporter   ~0003408

Thank you.

It seem this is the problematic line (6990):

j:=min(MaxQuickSearch,quicksearch.Items.count);

it should be replaced with something as:

j := quicksearch.Items.count;

if (j > MaxQuickSearch) then
  j := MaxQuickSearch;

Sasa

16-11-24 14:42

reporter   ~0003410

And as well this (line 6139):

//j:=min(MaxQuickSearch,ReadInteger(section,'count',0));

j:=ReadInteger(section,'count',0);

if (j > MaxQuickSearch) then
  j := MaxQuickSearch;

Patrick Chevalley

16-11-24 14:46

administrator   ~0003411

Strange ...

I can make this change but there is something I not understand as min() is implemented in FPC simply as:
  if a < b then
    Result := a
  else
    Result := b;

Maybe parameter alignment with your processor? as 3 = 15 shr 2
But you may have problem at other place where I use constant integer parameters.

I tested on my 32bit Atom processor and I have the full 15 object list.

Sasa

16-11-24 14:48

reporter   ~0003412

Last edited: 16-11-24 14:50

Hmm...

Well, it seems it is not enough.

Try to:
1. Keep only 3 items in ini,
2. Open cdc add 4-th
3. Exit without saving config.
4. Reopen

Only first three will stay.

Sasa

16-11-24 15:06

reporter   ~0003413

I do not know, min() have inline specifier, maybe thus is broken something.

But still, with the above replacements only 3 items exists saving config or not.

Patrick Chevalley

16-11-24 15:24

administrator   ~0003415

So replacing min() do not solve the problem?

I tested your sequence of note 3412 on 32bit and 64bit computer, adding the fourth element with the search bar or the advanced search, and in all case I have the fourth after restarting the program.

Can you confirm you can have more than 3 in the list before you restart the program?

Sasa

16-11-24 15:30

reporter   ~0003416

Something is really broken here...

I can see the 4-th search in ini and loaded from it only if unconditionally save the search inside TMain.Close

Patrick Chevalley

16-11-24 15:31

administrator   ~0003417

can you look if you not have two [quicksearch] section in the .ini?

Sasa

16-11-24 15:35

reporter   ~0003418

I see only one section with that key.

Sasa

16-11-24 15:51

reporter   ~0003419

BTW, what version of FPC and Lazarus you using?

Patrick Chevalley

16-11-24 15:58

administrator   ~0003420

At the time you submit the issue it was FPC 3.0 and Lazarus 1.6.0.
I recently change for Lazarus 1.6.2.

You have the details for a specific binary in Help/About.

Sasa

16-11-24 16:06

reporter   ~0003421

Thank you. I will upgrade to newer Lazarus.

I have briefly examine Tmain.FormClose...

What could be following:
if (not NeedRestart)and(not cfgm.KioskMode) then SaveQuickSearch(configfile);

Patrick Chevalley

16-11-24 16:28

administrator   ~0003422

NeedRestart is set in two case:
- when you ask to reset the configuration, so not save in this case
- if you change the database from sqlite to mysql in the config, something you not do every day.

KioskMode is a startup option to help to run skychart on a public kiosk in an event. No config can be changed in this mode.

Sasa

16-11-24 16:39

reporter   ~0003423

Last edited: 16-11-24 16:43

Thank you.

I have deleted ini and start the CDC. Non of search is saved (config not saved)

I have fix it by:

      if SaveConfigOnExit.checked and Application.ShowMainForm then
      begin

        if ConfirmSaveConfig then
        begin
          ...
        end
        else
          SaveDefault;

      end;
// else - REMOVE THIS!
      if (not NeedRestart)and(not cfgm.KioskMode) then
         SaveQuickSearch(configfile);

Patrick Chevalley

16-11-24 17:27

administrator   ~0003426

Ah OK!
You have "Save config on exit" checked and you alway reply No.

Personally I do so many weird testing that I alway uncheck "Save config on exit" in the menu, so I go after the "else".

But if you simply remove the else you save the quicksearch two time if you save the config because SaveDefault include SaveQuickSearch.
Have to save quicksearch if form modalresult is mrNo.

I make this fix in rev 3323:
https://sourceforge.net/p/skychart/code/3323/
please confirm this work.

Sasa

16-11-24 17:39

reporter   ~0003428

Yes it works correctly now. Thank you.

Patrick Chevalley

16-11-24 17:48

administrator   ~0003429

And tank you to find this 15 year old bug!

Issue History

Date Modified Username Field Change
16-10-30 08:25 Sasa New Issue
16-11-24 13:30 Patrick Chevalley Note Added: 0003405
16-11-24 13:30 Patrick Chevalley Assigned To => Patrick Chevalley
16-11-24 13:30 Patrick Chevalley Status new => feedback
16-11-24 14:20 Sasa Note Added: 0003408
16-11-24 14:20 Sasa Status feedback => assigned
16-11-24 14:42 Sasa Note Added: 0003410
16-11-24 14:46 Patrick Chevalley Note Added: 0003411
16-11-24 14:48 Sasa Note Added: 0003412
16-11-24 14:50 Sasa Note Edited: 0003412
16-11-24 15:06 Sasa Note Added: 0003413
16-11-24 15:24 Patrick Chevalley Note Added: 0003415
16-11-24 15:30 Sasa Note Added: 0003416
16-11-24 15:31 Patrick Chevalley Note Added: 0003417
16-11-24 15:35 Sasa Note Added: 0003418
16-11-24 15:51 Sasa Note Added: 0003419
16-11-24 15:58 Patrick Chevalley Note Added: 0003420
16-11-24 16:06 Sasa Note Added: 0003421
16-11-24 16:28 Patrick Chevalley Note Added: 0003422
16-11-24 16:39 Sasa Note Added: 0003423
16-11-24 16:39 Sasa Note Edited: 0003423
16-11-24 16:43 Sasa Note Edited: 0003423
16-11-24 17:27 Patrick Chevalley Note Added: 0003426
16-11-24 17:27 Patrick Chevalley Target Version => 4.0
16-11-24 17:39 Sasa Note Added: 0003428
16-11-24 17:48 Patrick Chevalley Note Added: 0003429
16-11-24 17:48 Patrick Chevalley Status assigned => resolved
16-11-24 17:48 Patrick Chevalley Resolution open => fixed