[GB.QT4.EXT]
* BUG: Editor cursor is ensured to be visible only if the editor has the focus. git-svn-id: svn://localhost/gambas/trunk@4452 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
fba595872f
commit
b9b2d298a4
3 changed files with 10 additions and 6 deletions
|
@ -53,6 +53,7 @@ GLine::GLine()
|
|||
proc = false;
|
||||
unicode = false;
|
||||
highlight = NULL;
|
||||
nobreak = false;
|
||||
}
|
||||
|
||||
GLine::~GLine()
|
||||
|
|
|
@ -69,7 +69,8 @@ public:
|
|||
unsigned proc : 1;
|
||||
unsigned unicode : 1;
|
||||
unsigned baptized : 1;
|
||||
unsigned _reserved : 3;
|
||||
unsigned nobreak : 1;
|
||||
unsigned _reserved : 2;
|
||||
signed tag : 16;
|
||||
|
||||
GLine();
|
||||
|
|
|
@ -2223,18 +2223,20 @@ void GEditor::ensureCursorVisible()
|
|||
{
|
||||
int xx, yy;
|
||||
|
||||
if (!isUpdatesEnabled())
|
||||
if (!isUpdatesEnabled() || !hasFocus())
|
||||
return;
|
||||
|
||||
xx = lineWidth(y, x); // + _charWidth['m'] / 2
|
||||
yy = realToView(y) * _cellh + _cellh / 2;
|
||||
|
||||
//qDebug("%p: xx = %d yy = %d vw = %d vh = %d", this, xx, yy, visibleWidth(), visibleHeight());
|
||||
//fprintf(stderr, "%p: xx = %d yy = %d vw = %d vh = %d center = %d contentX() = %d", this, xx, yy, visibleWidth(), visibleHeight(), center, contentsX());
|
||||
|
||||
if (xx >= visibleWidth() || contentsX() > 0)
|
||||
ensureVisible(xx, yy, visibleWidth() / 2, center ? (visibleHeight() / 2) : _cellh);
|
||||
else
|
||||
ensureVisible(xx, yy, margin + 2, center ? (visibleHeight() / 2) : _cellh);
|
||||
else
|
||||
ensureVisible(0, yy, margin + 2, center ? (visibleHeight() / 2) : _cellh);
|
||||
|
||||
//fprintf(stderr, " -> %d\n", contentsX());
|
||||
|
||||
center = false;
|
||||
_ensureCursorVisibleLater = false;
|
||||
|
@ -2266,7 +2268,7 @@ void GEditor::blinkTimerTimeout()
|
|||
void GEditor::focusInEvent(QFocusEvent *e)
|
||||
{
|
||||
startBlink();
|
||||
//ensureCursorVisible();
|
||||
ensureCursorVisible();
|
||||
Q3ScrollView::focusInEvent(e);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue