From a2ef5d11b305ea76ecd8eea2a95e2d3d47ca6670 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Fri, 21 Sep 2001 16:21:23 +0000 Subject: [PATCH] Renamed selectNextWord as selectNextWordToSpellcheck. Modified selectNextWordToSpellcheck to not select words inside an ERT inset. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2785 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView2.C | 2 +- src/ChangeLog | 8 ++++++++ src/insets/ChangeLog | 3 +++ src/insets/inset.C | 2 +- src/insets/inset.h | 2 +- src/insets/insetcollapsable.C | 4 ++-- src/insets/insetcollapsable.h | 2 +- src/insets/insettabular.C | 6 +++--- src/insets/insettabular.h | 2 +- src/insets/insettext.C | 6 +++--- src/insets/insettext.h | 2 +- src/lyxtext.h | 2 +- src/text.C | 14 ++++++++------ 13 files changed, 34 insertions(+), 21 deletions(-) diff --git a/src/BufferView2.C b/src/BufferView2.C index 6226a7edaf..6f84e5f5b0 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -339,7 +339,7 @@ string const BufferView::nextWord(float & value) return string(); } - return text->selectNextWord(this, value); + return text->selectNextWordToSpellcheck(this, value); } diff --git a/src/ChangeLog b/src/ChangeLog index f48b589e2f..b39cc43482 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2001-09-21 Angus Leeming + + * lyxtext.h, text.C (selectNextWord): renamed as + selectNextWordToSpellcheck. + + * text.C (selectNextWordToSpellcheck): Modified to not select + words inside an ERT inset. + 2001-09-21 Jean-Marc Lasgouttes * lyx_cb.C (MenuLayoutSave): change a bit the question diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 6c80888f14..f0538d9146 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,5 +1,8 @@ 2001-09-21 Angus Leeming + * various files (selectNextWord): renamed as + selectNextWordToSpellcheck. + * insetgraphics.C (draw): remove the previous change. Right place is in imageLoaderXPM.C. (draw): don't display the image if params.display == NONE. diff --git a/src/insets/inset.C b/src/insets/inset.C index 151107a2c4..94b4eef8c3 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -345,7 +345,7 @@ LyXCursor const & Inset::cursor(BufferView * bv) const } -string const UpdatableInset::selectNextWord(BufferView *bv, +string const UpdatableInset::selectNextWordToSpellcheck(BufferView *bv, float & value) const { // we have to unlock ourself in this function by default! diff --git a/src/insets/inset.h b/src/insets/inset.h index bc36d77a98..9c03cdf90f 100644 --- a/src/insets/inset.h +++ b/src/insets/inset.h @@ -471,7 +471,7 @@ public: /// // needed for spellchecking text /// - virtual string const selectNextWord(BufferView *, float & value) const; + virtual string const selectNextWordToSpellcheck(BufferView *, float & value) const; /// virtual void selectSelectedWord(BufferView *) { return; } /// diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 408447e7fb..fae885ce60 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -644,10 +644,10 @@ bool InsetCollapsable::searchBackward(BufferView * bv, string const & str, } -string const InsetCollapsable::selectNextWord(BufferView * bv, +string const InsetCollapsable::selectNextWordToSpellcheck(BufferView * bv, float & value) const { - string const str = inset.selectNextWord(bv, value); + string const str = inset.selectNextWordToSpellcheck(bv, value); if (first_after_edit && str.empty()) close(bv); first_after_edit = false; diff --git a/src/insets/insetcollapsable.h b/src/insets/insetcollapsable.h index a8547cab52..a4bad868e1 100644 --- a/src/insets/insetcollapsable.h +++ b/src/insets/insetcollapsable.h @@ -175,7 +175,7 @@ public: /// void close(BufferView *) const; /// - string const selectNextWord(BufferView * bv, float & value) const; + string const selectNextWordToSpellcheck(BufferView * bv, float & value) const; void selectSelectedWord(BufferView * bv) { inset.selectSelectedWord(bv); diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 75d27bd9a7..5fbe7fdeea 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -2490,10 +2490,10 @@ Inset * InsetTabular::getInsetFromID(int id_arg) const } -string const InsetTabular::selectNextWord(BufferView * bv, float & value) const +string const InsetTabular::selectNextWordToSpellcheck(BufferView * bv, float & value) const { if (the_locking_inset) { - string const str(the_locking_inset->selectNextWord(bv, value)); + string const str(the_locking_inset->selectNextWordToSpellcheck(bv, value)); if (!str.empty()) return str; if (tabular->IsLastCell(actcell)) { @@ -2520,7 +2520,7 @@ string InsetTabular::selectNextWordInt(BufferView * bv, float & value) const // when entering this function the inset should be ALWAYS locked! lyx::Assert(the_locking_inset); - string const str(the_locking_inset->selectNextWord(bv, value)); + string const str(the_locking_inset->selectNextWordToSpellcheck(bv, value)); if (!str.empty()) return str; diff --git a/src/insets/insettabular.h b/src/insets/insettabular.h index 2c2b6664f9..82123ab565 100644 --- a/src/insets/insettabular.h +++ b/src/insets/insettabular.h @@ -212,7 +212,7 @@ public: /// LyXCursor const & cursor(BufferView *) const; /// - string const selectNextWord(BufferView *, float & value) const; + string const selectNextWordToSpellcheck(BufferView *, float & value) const; void selectSelectedWord(BufferView *); void toggleSelection(BufferView *, bool kill_selection); /// diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 79ba5e635a..e556322a70 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -2186,7 +2186,7 @@ Inset * InsetText::getInsetFromID(int id_arg) const } -string const InsetText::selectNextWord(BufferView * bv, float & value) const +string const InsetText::selectNextWordToSpellcheck(BufferView * bv, float & value) const { bool clear = false; string str; @@ -2196,7 +2196,7 @@ string const InsetText::selectNextWord(BufferView * bv, float & value) const clear = true; } if (the_locking_inset) { - str = the_locking_inset->selectNextWord(bv, value); + str = the_locking_inset->selectNextWordToSpellcheck(bv, value); if (!str.empty()) { value += cy(bv); if (clear) @@ -2208,7 +2208,7 @@ string const InsetText::selectNextWord(BufferView * bv, float & value) const // we have to go on checking so move cusor to the right lt->cursor.pos(lt->cursor.pos() + 1); } - str = lt->selectNextWord(bv, value); + str = lt->selectNextWordToSpellcheck(bv, value); if (str.empty()) bv->unlockInset(const_cast(this)); else diff --git a/src/insets/insettext.h b/src/insets/insettext.h index 8b5eace5ee..a304a1d18d 100644 --- a/src/insets/insettext.h +++ b/src/insets/insettext.h @@ -229,7 +229,7 @@ public: /// void paragraph(Paragraph *); /// - string const selectNextWord(BufferView *, float & value) const; + string const selectNextWordToSpellcheck(BufferView *, float & value) const; void selectSelectedWord(BufferView *); void toggleSelection(BufferView *, bool kill_selection); /// diff --git a/src/lyxtext.h b/src/lyxtext.h index 8e35b20d51..e95f3079ff 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -295,7 +295,7 @@ public: to the beginning of this word. With SelectSelectedWord can this be highlighted really */ - string const selectNextWord(BufferView *, float & value) const; + string const selectNextWordToSpellcheck(BufferView *, float & value) const; /// void selectSelectedWord(BufferView *); /// diff --git a/src/text.C b/src/text.C index 58cb13af98..d636ec2c22 100644 --- a/src/text.C +++ b/src/text.C @@ -2271,11 +2271,11 @@ bool LyXText::selectWordWhenUnderCursor(BufferView * bview, // This function is only used by the spellchecker for NextWord(). // It doesn't handle LYX_ACCENTs and probably never will. -string const LyXText::selectNextWord(BufferView * bview, +string const LyXText::selectNextWordToSpellcheck(BufferView * bview, float & value) const { if (the_locking_inset) { - string str = the_locking_inset->selectNextWord(bview, value); + string str = the_locking_inset->selectNextWordToSpellcheck(bview, value); if (!str.empty()) { value += float(cursor.y())/float(height); return str; @@ -2306,10 +2306,12 @@ string const LyXText::selectNextWord(BufferView * bview, while ((cursor.par()->size() > cursor.pos() && (!cursor.par()->isLetter(cursor.pos())) && (!cursor.par()->isInset(cursor.pos()) || - !cursor.par()->getInset(cursor.pos())->isTextInset())) + !(cursor.par()->getInset(cursor.pos())->isTextInset() && + cursor.par()->getInset(cursor.pos())->lyxCode() != + Inset::ERT_CODE))) || (cursor.par()->size() == cursor.pos() && cursor.par()->next())) - { + { if (cursor.pos() == cursor.par()->size()) { cursor.par(cursor.par()->next()); cursor.pos(0); @@ -2319,13 +2321,13 @@ string const LyXText::selectNextWord(BufferView * bview, // now check if we hit an inset so it has to be a inset containing text! if (cursor.pos() < cursor.par()->size() && - cursor.par()->isInset(cursor.pos())) + cursor.par()->isInset(cursor.pos())) { // lock the inset! cursor.par()->getInset(cursor.pos())->edit(bview); // now call us again to do the above trick // but obviously we have to start from down below ;) - return bview->text->selectNextWord(bview, value); + return bview->text->selectNextWordToSpellcheck(bview, value); } // Update the value if we changed paragraphs -- 2.39.2