* 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 // set update flags
if (changed) { if (changed) {
if (singlePar && !(cur.disp_.update() | Update::Force)) if (singlePar && !(cur.disp_.update() & Update::Force))
cur.updateFlags(cur.disp_.update() | Update::SinglePar); cur.updateFlags(cur.disp_.update() | Update::SinglePar);
else else
cur.updateFlags(cur.disp_.update() | Update::Force); 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, dispatch(FuncRequest(LFUN_SELF_INSERT, arg,
FuncRequest::KEYBOARD)); FuncRequest::KEYBOARD));
LYXERR(Debug::KEY, "SelfInsert arg[`" << to_utf8(arg) << "']"); LYXERR(Debug::KEY, "SelfInsert arg[`" << to_utf8(arg) << "']");
lyx_view_->updateCompletion(true, true);
} }
} else { } else {
dispatch(func); dispatch(func);
if (!lyx_view_) if (!lyx_view_)
return; 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_) if (lyx_view_)
@ -1713,6 +1705,18 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
view()->cursor().fixIfBroken(); 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(); updateFlags = view()->cursor().result().update();
} }

View File

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

View File

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