Add some local changes to Scintilla to avoid autocomplete flicker

* The code by default will recreate/move/resize the autocomplete box when re-
  initialising and there's no way to just update the list without doing so.
This commit is contained in:
baldurk
2026-08-13 17:46:43 +01:00
parent 8a86b754f6
commit f5033de8ff
3 changed files with 24 additions and 16 deletions
+23 -12
View File
@@ -814,29 +814,38 @@ void ListBoxImpl::Create(Window &parent,
unicodeMode = unicodeMode_;
QWidget *qparent = static_cast<QWidget *>(parent.GetID());
ListWidget *list = new ListWidget(qparent);
ListWidget *list;
if(wid)
{
list = (ListWidget *)window(wid);
}
else
{
list = new ListWidget(qparent);
#if defined(Q_OS_WIN)
// On Windows, Qt::ToolTip causes a crash when the list is clicked on
// so Qt::Tool is used.
list->setParent(0, Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint
// On Windows, Qt::ToolTip causes a crash when the list is clicked on
// so Qt::Tool is used.
list->setParent(0, Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
| Qt::WindowDoesNotAcceptFocus
| Qt::WindowDoesNotAcceptFocus
#endif
);
);
#else
// On OS X, Qt::Tool takes focus so main window loses focus so
// keyboard stops working. Qt::ToolTip works but its only really
// documented for tooltips.
// On Linux / X this setting allows clicking on list items.
list->setParent(0, Qt::ToolTip | Qt::FramelessWindowHint);
// On OS X, Qt::Tool takes focus so main window loses focus so
// keyboard stops working. Qt::ToolTip works but its only really
// documented for tooltips.
// On Linux / X this setting allows clicking on list items.
list->setParent(0, Qt::ToolTip | Qt::FramelessWindowHint);
#endif
}
list->setAttribute(Qt::WA_ShowWithoutActivating);
list->setFocusPolicy(Qt::NoFocus);
list->setUniformItemSizes(true);
list->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
list->move(location.x, location.y);
//list->move(location.x, location.y);
int maxIconWidth = 0;
int maxIconHeight = 0;
@@ -1023,6 +1032,7 @@ void ListBoxImpl::SetDoubleClickAction(CallBackAction action, void *data)
void ListBoxImpl::SetList(const char *list, char separator, char typesep)
{
window(wid)->setUpdatesEnabled(false);
// This method is *not* platform dependent.
// It is borrowed from the GTK implementation.
Clear();
@@ -1048,6 +1058,7 @@ void ListBoxImpl::SetList(const char *list, char separator, char typesep)
*numword = '\0';
Append(startword, numword?atoi(numword + 1):-1);
}
window(wid)->setUpdatesEnabled(true);
}
ListBox::ListBox() {}
-3
View File
@@ -60,9 +60,6 @@ bool AutoComplete::Active() const {
void AutoComplete::Start(Window &parent, int ctrlID,
int position, Point location, int startLen_,
int lineHeight, bool unicodeMode, int technology) {
if (active) {
Cancel();
}
lb->Create(parent, ctrlID, location, lineHeight, unicodeMode, technology);
lb->Clear();
active = true;
+1 -1
View File
@@ -288,7 +288,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
}
rcac.right = rcac.left + widthLB;
rcac.bottom = static_cast<XYPOSITION>(Platform::Minimum(static_cast<int>(rcac.top) + heightLB, static_cast<int>(rcPopupBounds.bottom)));
ac.lb->SetPositionRelative(rcac, wMain);
//ac.lb->SetPositionRelative(rcac, wMain);
ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font);
unsigned int aveCharWidth = static_cast<unsigned int>(vs.styles[STYLE_DEFAULT].aveCharWidth);
ac.lb->SetAverageCharWidth(aveCharWidth);