| 331 | } |
| 332 | |
| 333 | void ScintillaBase::AutoCompleteCompleted() { |
| 334 | int item = ac.GetSelection(); |
| 335 | if (item == -1) { |
| 336 | AutoCompleteCancel(); |
| 337 | return; |
| 338 | } |
| 339 | const std::string selected = ac.GetValue(item); |
| 340 | |
| 341 | ac.Show(false); |
| 342 | |
| 343 | SCNotification scn = {0}; |
| 344 | scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION; |
| 345 | scn.message = 0; |
| 346 | scn.wParam = listType; |
| 347 | scn.listType = listType; |
| 348 | Position firstPos = ac.posStart - ac.startLen; |
| 349 | scn.position = firstPos; |
| 350 | scn.lParam = firstPos; |
| 351 | scn.text = selected.c_str(); |
| 352 | NotifyParent(scn); |
| 353 | |
| 354 | if (!ac.Active()) |
| 355 | return; |
| 356 | ac.Cancel(); |
| 357 | |
| 358 | if (listType > 0) |
| 359 | return; |
| 360 | |
| 361 | Position endPos = sel.MainCaret(); |
| 362 | if (ac.dropRestOfWord) |
| 363 | endPos = pdoc->ExtendWordSelect(endPos, 1, true); |
| 364 | if (endPos < firstPos) |
| 365 | return; |
| 366 | AutoCompleteInsert(firstPos, endPos - firstPos, selected.c_str(), static_cast<int>(selected.length())); |
| 367 | SetLastXChosen(); |
| 368 | } |
| 369 | |
| 370 | int ScintillaBase::AutoCompleteGetCurrent() { |
| 371 | if (!ac.Active()) |
no test coverage detected