| 201 | } |
| 202 | |
| 203 | void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { |
| 204 | //Platform::DebugPrintf("AutoComplete %s\n", list); |
| 205 | ct.CallTipCancel(); |
| 206 | |
| 207 | if (ac.chooseSingle && (listType == 0)) { |
| 208 | if (list && !strchr(list, ac.GetSeparator())) { |
| 209 | const char *typeSep = strchr(list, ac.GetTypesep()); |
| 210 | int lenInsert = typeSep ? |
| 211 | static_cast<int>(typeSep-list) : static_cast<int>(strlen(list)); |
| 212 | if (ac.ignoreCase) { |
| 213 | // May need to convert the case before invocation, so remove lenEntered characters |
| 214 | AutoCompleteInsert(sel.MainCaret() - lenEntered, lenEntered, list, lenInsert); |
| 215 | } else { |
| 216 | AutoCompleteInsert(sel.MainCaret(), 0, list + lenEntered, lenInsert - lenEntered); |
| 217 | } |
| 218 | ac.Cancel(); |
| 219 | return; |
| 220 | } |
| 221 | } |
| 222 | ac.Start(wMain, idAutoComplete, sel.MainCaret(), PointMainCaret(), |
| 223 | lenEntered, vs.lineHeight, IsUnicodeMode(), technology); |
| 224 | |
| 225 | PRectangle rcClient = GetClientRectangle(); |
| 226 | Point pt = LocationFromPosition(sel.MainCaret() - lenEntered); |
| 227 | PRectangle rcPopupBounds = wMain.GetMonitorRect(pt); |
| 228 | if (rcPopupBounds.Height() == 0) |
| 229 | rcPopupBounds = rcClient; |
| 230 | |
| 231 | int heightLB = ac.heightLBDefault; |
| 232 | int widthLB = ac.widthLBDefault; |
| 233 | if (pt.x >= rcClient.right - widthLB) { |
| 234 | HorizontalScrollTo(xOffset + pt.x - rcClient.right + widthLB); |
| 235 | Redraw(); |
| 236 | pt = PointMainCaret(); |
| 237 | } |
| 238 | if (wMargin.GetID()) { |
| 239 | Point ptOrigin = GetVisibleOriginInMain(); |
| 240 | pt.x += ptOrigin.x; |
| 241 | pt.y += ptOrigin.y; |
| 242 | } |
| 243 | PRectangle rcac; |
| 244 | rcac.left = pt.x - ac.lb->CaretFromEdge(); |
| 245 | if (pt.y >= rcPopupBounds.bottom - heightLB && // Wont fit below. |
| 246 | pt.y >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2) { // and there is more room above. |
| 247 | rcac.top = pt.y - heightLB; |
| 248 | if (rcac.top < rcPopupBounds.top) { |
| 249 | heightLB -= (rcPopupBounds.top - rcac.top); |
| 250 | rcac.top = rcPopupBounds.top; |
| 251 | } |
| 252 | } else { |
| 253 | rcac.top = pt.y + vs.lineHeight; |
| 254 | } |
| 255 | rcac.right = rcac.left + widthLB; |
| 256 | rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcPopupBounds.bottom); |
| 257 | ac.lb->SetPositionRelative(rcac, wMain); |
| 258 | ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font); |
| 259 | unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth; |
| 260 | ac.lb->SetAverageCharWidth(aveCharWidth); |
nothing calls this directly
no test coverage detected