Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#981 AutoComp: allow non-alphabetical sort

Completed
closed
Neil Hodgson
scintilla (63)
4
2013-04-12
2013-03-02
Alpha
No

Allow the auto-complete listing to work when given a list that is not alphabetically sorted (ex. sorted by priority).

1 Attachments

Discussion

<< < 1 2 (Page 2 of 2)
  • Alpha
    Alpha
    2013-03-21

    Oops, sorry; overlooked that ++i (it was a previous optimization under the assumption of non-zero length entries). Removing it results in correct behaviour. (Adding wxTOKEN_RET_EMPTY to wxScintilla matches this behaviour.)

     
    Attachments
  • Alpha
    Alpha
    2013-03-21

    Except... what is the expected value of a terminating separator?
    "aardvark\n\nant"
    gives three tokens:
    'aardvark', '', 'ant'

    but what should
    "aardvark\n\nant\n"
    do? Three tokens as well:
    'aardvark', '', 'ant'
    or four tokens:
    'aardvark', '', 'ant', ''

    (And what about "aardvark\n\nant\n\n"?)

     
    • Neil Hodgson
      Neil Hodgson
      2013-03-22

      For compatibility with current behaviour, a single trailing \n should be ignored.

      BTW, there is currently an error downloading patch 9 so I'll try again later.

       
  • Neil Hodgson
    Neil Hodgson
    2013-03-22

    Still seeing "Error 500" for patch 9 so could you please upload it again. Probably prudent to use a different name.

     
    Last edit: Neil Hodgson 2013-03-22
  • Alpha
    Alpha
    2013-03-23

    Strange... let's see if this works.

     
  • Neil Hodgson
    Neil Hodgson
    2013-03-23

    I misread the platform code: a trailing \n shows an empty entry so that should be preserved in the Sorter intialisation.

     
  • Alpha
    Alpha
    2013-03-27

    Sorry for the delay. This preserves a trailing entry.

     
    Attachments
  • Neil Hodgson
    Neil Hodgson
    2013-03-29

    The rearrangement of elements for SC_ORDER_PERFORMSORT means that some extra care is needed to ensure separators occur when needed and only when needed. I think this works code for creating sortedList works:

    for (size_t i = 0; i < sortMatrix.size(); ++i) {
        int wordLen = IndexSort.indices[sortMatrix[i] * 2 + 2] - IndexSort.indices[sortMatrix[i] * 2];
        strncpy(item, list + IndexSort.indices[sortMatrix[i] * 2], wordLen);
        if ((i+1) == sortMatrix.size()) {
            // Last item so remove separator if present
            if ((wordLen > 0) && (item[wordLen-1] == separator))
                wordLen--;
        } else {
            // Item before last needs a separator
            if ((wordLen == 0) || (item[wordLen-1] != separator)) {
                item[wordLen] = separator;
                wordLen++;
            }
        }
        item[wordLen] = '\0';
        sortedList += item;
    }
    
     
  • Neil Hodgson
    Neil Hodgson
    2013-04-01

    Committed as [ea61ff].

     

    Related

    Commit: [ea61ff]

  • Neil Hodgson
    Neil Hodgson
    2013-04-12

    • status: open --> closed
     
<< < 1 2 (Page 2 of 2)