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.)
Allow the auto-complete listing to work when given a list that is not alphabetically sorted (ex. sorted by priority).
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.)
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"
?)
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.
Still seeing "Error 500" for patch 9 so could you please upload it again. Probably prudent to use a different name.
Strange... let's see if this works.
I misread the platform code: a trailing \n shows an empty entry so that should be preserved in the Sorter intialisation.
Sorry for the delay. This preserves a trailing entry.
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; }
Log in to post a comment.