* bug fix to only do paragraph redraws, not fullscreen

* avoid an extra redraw due to completion when typing


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23349 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Stefan Schimanski 2008-02-29 09:18:46 +00:00
parent e936a451da
commit 8c4b08920e
5 changed files with 21 additions and 14 deletions

View File

@ -2221,7 +2221,7 @@ void BufferView::setInlineCompletion(Cursor & cur, DocIterator const & pos,
// set update flags
if (changed) {
if (singlePar && !(cur.disp_.update() | Update::Force))
if (singlePar && !(cur.disp_.update() & Update::Force))
cur.updateFlags(cur.disp_.update() | Update::SinglePar);
else
cur.updateFlags(cur.disp_.update() | Update::Force);

View File

@ -367,19 +367,11 @@ void LyXFunc::processKeySym(KeySymbol const & keysym, KeyModifier state)
dispatch(FuncRequest(LFUN_SELF_INSERT, arg,
FuncRequest::KEYBOARD));
LYXERR(Debug::KEY, "SelfInsert arg[`" << to_utf8(arg) << "']");
lyx_view_->updateCompletion(true, true);
}
} else {
dispatch(func);
if (!lyx_view_)
return;
if (func.action == LFUN_CHAR_DELETE_BACKWARD)
// backspace is not a self-insertion. But it
// still should not hide the completion popup.
// FIXME: more clever way to detect those movements
lyx_view_->updateCompletion(false, true);
else
lyx_view_->updateCompletion(false, false);
}
if (lyx_view_)
@ -1713,6 +1705,18 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
view()->cursor().fixIfBroken();
}
// update completion. We do it here and not in
// processKeySym to avoid another redraw just for a
// changed inline completion
if (cmd.origin == FuncRequest::KEYBOARD) {
if (cmd.action == LFUN_SELF_INSERT)
lyx_view_->updateCompletion(view()->cursor(), true, true);
else if (cmd.action == LFUN_CHAR_DELETE_BACKWARD)
lyx_view_->updateCompletion(view()->cursor(), false, true);
else
lyx_view_->updateCompletion(view()->cursor(), false, false);
}
updateFlags = view()->cursor().result().update();
}

View File

@ -21,6 +21,7 @@ namespace support { class FileName; }
class Buffer;
class BufferView;
class Cursor;
class FuncStatus;
class FuncRequest;
class Inset;
@ -92,8 +93,9 @@ public:
/// Update the completion popup and the inline completion state.
/// If \c start is true, then a new completion might be started.
/// If \c keep is true, an active completion will be kept active
/// even though the cursor moved.
virtual void updateCompletion(bool start, bool keep) = 0;
/// even though the cursor moved. The update flags of \c cur might
/// be changed.
virtual void updateCompletion(Cursor & cur, bool start, bool keep) = 0;
private:
/// noncopyable

View File

@ -1969,10 +1969,10 @@ void GuiView::restartCursor()
}
void GuiView::updateCompletion(bool start, bool keep)
void GuiView::updateCompletion(Cursor & cur, bool start, bool keep)
{
if (d.current_work_area_)
d.current_work_area_->completer().updateVisibility(start, keep);
d.current_work_area_->completer().updateVisibility(cur, start, keep);
}
namespace {

View File

@ -31,6 +31,7 @@ class QShowEvent;
namespace lyx {
class Cursor;
class ToolbarInfo;
namespace frontend {
@ -244,7 +245,7 @@ public:
void disconnectDialog(std::string const & name);
///
void updateCompletion(bool start, bool keep);
void updateCompletion(Cursor & cur, bool start, bool keep);
private:
///