rem: WMSetListPosition(list, i);  if (panel->flags.autoCompletion) {  if (textLen < itemTextLen && textEvent!=WMDeleteTextEvent) { WMRange range;  WMInsertTextFieldText(panel->fileField, &item->text[textLen], textLen); WMSetTextFieldCursorPosition(panel->fileField, itemTextLen); range.position = textLen; range.count = itemTextLen - textLen; WMSelectTextFieldRange(panel->fileField, range); }  text1 = WMGetTextFieldText(panel->fileField); j = closestListItem(list, text1, True); if (i != j) { WMSelectListItem(list, j); if (j>=0) { WMSetListPosition(list, j); } } free(text1); }
add: int visibleItems = WMWidgetHeight(list)/WMGetListItemHeight(list);  if (textEvent!=WMSetTextEvent || textLen<itemTextLen) WMSetListPosition(list, i - visibleItems/2);  if (textEvent!=WMDeleteTextEvent && textLen<itemTextLen) { WMRange range;  WMInsertTextFieldText(panel->fileField, &item->text[textLen], textLen); WMSetTextFieldCursorPosition(panel->fileField, itemTextLen); range.position = textLen; range.count = itemTextLen - textLen; WMSelectTextFieldRange(panel->fileField, range); }
context: textChangedObserver(void *observerData, WMNotification *notification){    W_FilePanel *panel = (W_FilePanel*)observerData;    char *text, *text1;    WMList *list;    int col = WMGetBrowserNumberOfColumns(panel->browser) - 1;    int i, j, textEvent = (int)WMGetNotificationClientData(notification);    list = WMGetBrowserListInColumn(panel->browser, col);    if (!list)	return;    text = WMGetTextFieldText(panel->fileField);    if (panel->flags.autoCompletion && textEvent!=WMDeleteTextEvent)        i = closestListItem(list, text, False);    else        i = closestListItem(list, text, True);    WMSelectListItem(list, i);    if (i>=0) {        WMListItem *item = WMGetListItem(list, i);        int textLen = strlen(text), itemTextLen = strlen(item->text);        WMSetListPosition(list, i);        if (panel->flags.autoCompletion) {            /* Be careful with the '<' condition below. Changing it can drop             * you into an endless loop. We call here, inside a function             * called from a notification observer, to a function that             * generates notification events. So make sure we do not call it             * recursively for ever.             * '<' means we only update text field if it is really not yet             * complete. -Dan             */            if (textLen < itemTextLen && textEvent!=WMDeleteTextEvent) {                WMRange range;                WMInsertTextFieldText(panel->fileField, &item->text[textLen],                                      textLen);                WMSetTextFieldCursorPosition(panel->fileField, itemTextLen);                range.position = textLen;                range.count = itemTextLen - textLen;                WMSelectTextFieldRange(panel->fileField, range);            }            text1 = WMGetTextFieldText(panel->fileField);            j = closestListItem(list, text1, True);            if (i != j) {                WMSelectListItem(list, j);                if (j>=0) {                    WMSetListPosition(list, j);                }            }            free(text1);        }    }    free(text);}