mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
remove dead spellcheck code
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8032 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3a36ee90ff
commit
4ad989550c
@ -362,42 +362,6 @@ void BufferView::redo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// these functions are for the spellchecker
|
|
||||||
WordLangTuple const BufferView::nextWord(float & value)
|
|
||||||
{
|
|
||||||
if (!available()) {
|
|
||||||
value = 1;
|
|
||||||
return WordLangTuple();
|
|
||||||
}
|
|
||||||
|
|
||||||
return text->selectNextWordToSpellcheck(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BufferView::selectLastWord()
|
|
||||||
{
|
|
||||||
if (!available())
|
|
||||||
return;
|
|
||||||
|
|
||||||
LyXCursor cur = text->selection.cursor;
|
|
||||||
beforeChange(text);
|
|
||||||
text->selection.cursor = cur;
|
|
||||||
text->selectSelectedWord();
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BufferView::endOfSpellCheck()
|
|
||||||
{
|
|
||||||
if (!available()) return;
|
|
||||||
|
|
||||||
beforeChange(text);
|
|
||||||
text->selectSelectedWord();
|
|
||||||
text->clearSelection();
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BufferView::replaceWord(string const & replacestring)
|
void BufferView::replaceWord(string const & replacestring)
|
||||||
{
|
{
|
||||||
if (!available())
|
if (!available())
|
||||||
|
@ -33,7 +33,6 @@ class LyXView;
|
|||||||
class Painter;
|
class Painter;
|
||||||
class TeXErrors;
|
class TeXErrors;
|
||||||
class UpdatableInset;
|
class UpdatableInset;
|
||||||
class WordLangTuple;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A buffer view encapsulates a view onto a particular
|
* A buffer view encapsulates a view onto a particular
|
||||||
@ -135,14 +134,8 @@ public:
|
|||||||
/// return the parent language of the given inset
|
/// return the parent language of the given inset
|
||||||
Language const * getParentLanguage(InsetOld * inset) const;
|
Language const * getParentLanguage(InsetOld * inset) const;
|
||||||
|
|
||||||
/// Select the "current" word
|
|
||||||
void selectLastWord();
|
|
||||||
/// replace the currently selected word
|
/// replace the currently selected word
|
||||||
void replaceWord(std::string const & replacestring);
|
void replaceWord(std::string const & replacestring);
|
||||||
/// Update after spellcheck finishes
|
|
||||||
void endOfSpellCheck();
|
|
||||||
/// return the next word
|
|
||||||
WordLangTuple const nextWord(float & value);
|
|
||||||
|
|
||||||
/// move cursor to the named label
|
/// move cursor to the named label
|
||||||
void gotoLabel(std::string const & label);
|
void gotoLabel(std::string const & label);
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
|
||||||
|
2003-11-04 Alfredo Braunstein <abraunst@libero.it>
|
||||||
|
|
||||||
|
* BufferView.[Ch]:
|
||||||
|
* lyxtext.h:
|
||||||
|
* text.C: remove dead spellcheck code
|
||||||
|
|
||||||
2003-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
|
2003-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||||
|
|
||||||
* dispatchresult.h: add a val setter
|
* dispatchresult.h: add a val setter
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
|
||||||
|
2003-11-04 Alfredo Braunstein <abraunst@libero.it>
|
||||||
|
|
||||||
|
* inset.h:
|
||||||
|
* insetcollapsable.[Ch]:
|
||||||
|
* insetert.[Ch]:
|
||||||
|
* insettabular.[Ch]:
|
||||||
|
* insettext.[Ch]:
|
||||||
|
* updatableinset.[Ch]: remove dead spellcheck code
|
||||||
|
|
||||||
2003-11-04 Alfredo Braunstein <abraunst@libero.it>
|
2003-11-04 Alfredo Braunstein <abraunst@libero.it>
|
||||||
|
|
||||||
* insettabular.C (lockInsetInInset): small fix
|
* insettabular.C (lockInsetInInset): small fix
|
||||||
|
@ -31,7 +31,6 @@ class LyXText;
|
|||||||
class Painter;
|
class Painter;
|
||||||
class Paragraph;
|
class Paragraph;
|
||||||
class UpdatableInset;
|
class UpdatableInset;
|
||||||
class WordLangTuple;
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace graphics {
|
namespace graphics {
|
||||||
@ -257,10 +256,6 @@ public:
|
|||||||
/// we need this here because collapsed insets are only EDITABLE
|
/// we need this here because collapsed insets are only EDITABLE
|
||||||
virtual void setFont(BufferView *, LyXFont const &,
|
virtual void setFont(BufferView *, LyXFont const &,
|
||||||
bool toggleall = false, bool selectall = false);
|
bool toggleall = false, bool selectall = false);
|
||||||
///
|
|
||||||
// needed for spellchecking text
|
|
||||||
///
|
|
||||||
virtual bool allowSpellcheck() const { return false; }
|
|
||||||
|
|
||||||
// should this inset be handled like a normal charater
|
// should this inset be handled like a normal charater
|
||||||
virtual bool isChar() const { return false; }
|
virtual bool isChar() const { return false; }
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "funcrequest.h"
|
#include "funcrequest.h"
|
||||||
#include "metricsinfo.h"
|
#include "metricsinfo.h"
|
||||||
#include "paragraph.h"
|
#include "paragraph.h"
|
||||||
#include "WordLangTuple.h"
|
|
||||||
|
|
||||||
#include "frontends/font_metrics.h"
|
#include "frontends/font_metrics.h"
|
||||||
#include "frontends/Painter.h"
|
#include "frontends/Painter.h"
|
||||||
@ -564,17 +563,6 @@ bool InsetCollapsable::searchBackward(BufferView * bv, string const & str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WordLangTuple const
|
|
||||||
InsetCollapsable::selectNextWordToSpellcheck(BufferView * bv, float & value) const
|
|
||||||
{
|
|
||||||
WordLangTuple word = inset.selectNextWordToSpellcheck(bv, value);
|
|
||||||
if (first_after_edit && word.word().empty())
|
|
||||||
close(bv);
|
|
||||||
first_after_edit = false;
|
|
||||||
return word;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InsetCollapsable::addPreview(PreviewLoader & loader) const
|
void InsetCollapsable::addPreview(PreviewLoader & loader) const
|
||||||
{
|
{
|
||||||
inset.addPreview(loader);
|
inset.addPreview(loader);
|
||||||
|
@ -130,13 +130,6 @@ public:
|
|||||||
void open(BufferView *);
|
void open(BufferView *);
|
||||||
///
|
///
|
||||||
void close(BufferView *) const;
|
void close(BufferView *) const;
|
||||||
///
|
|
||||||
bool allowSpellcheck() const;
|
|
||||||
///
|
|
||||||
WordLangTuple const
|
|
||||||
selectNextWordToSpellcheck(BufferView *, float &) const;
|
|
||||||
///
|
|
||||||
void selectSelectedWord(BufferView *);
|
|
||||||
|
|
||||||
void markErased();
|
void markErased();
|
||||||
|
|
||||||
@ -259,20 +252,6 @@ bool InsetCollapsable::isOpen() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
bool InsetCollapsable::allowSpellcheck() const
|
|
||||||
{
|
|
||||||
return inset.allowSpellcheck();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
|
||||||
void InsetCollapsable::selectSelectedWord(BufferView * bv)
|
|
||||||
{
|
|
||||||
inset.selectSelectedWord(bv);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
Box const & InsetCollapsable::buttonDim() const
|
Box const & InsetCollapsable::buttonDim() const
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "lyxlex.h"
|
#include "lyxlex.h"
|
||||||
#include "metricsinfo.h"
|
#include "metricsinfo.h"
|
||||||
#include "paragraph.h"
|
#include "paragraph.h"
|
||||||
#include "WordLangTuple.h"
|
|
||||||
|
|
||||||
#include "frontends/Alert.h"
|
#include "frontends/Alert.h"
|
||||||
#include "frontends/LyXView.h"
|
#include "frontends/LyXView.h"
|
||||||
@ -644,14 +643,6 @@ void InsetERT::close(BufferView * bv) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WordLangTuple const
|
|
||||||
InsetERT::selectNextWordToSpellcheck(BufferView * bv, float &) const
|
|
||||||
{
|
|
||||||
bv->unlockInset(const_cast<InsetERT *>(this));
|
|
||||||
return WordLangTuple();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InsetERT::getDrawFont(LyXFont & font) const
|
void InsetERT::getDrawFont(LyXFont & font) const
|
||||||
{
|
{
|
||||||
LyXFont f(LyXFont::ALL_INHERIT, latex_language);
|
LyXFont f(LyXFont::ALL_INHERIT, latex_language);
|
||||||
|
@ -92,11 +92,6 @@ public:
|
|||||||
///
|
///
|
||||||
void close(BufferView *) const;
|
void close(BufferView *) const;
|
||||||
///
|
///
|
||||||
bool allowSpellcheck() const { return false; }
|
|
||||||
|
|
||||||
WordLangTuple const
|
|
||||||
selectNextWordToSpellcheck(BufferView *, float &) const;
|
|
||||||
///
|
|
||||||
void metrics(MetricsInfo &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
///
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include "paragraph_funcs.h"
|
#include "paragraph_funcs.h"
|
||||||
#include "ParagraphParameters.h"
|
#include "ParagraphParameters.h"
|
||||||
#include "undo.h"
|
#include "undo.h"
|
||||||
#include "WordLangTuple.h"
|
|
||||||
|
|
||||||
#include "frontends/Alert.h"
|
#include "frontends/Alert.h"
|
||||||
#include "frontends/font_metrics.h"
|
#include "frontends/font_metrics.h"
|
||||||
@ -2419,60 +2418,6 @@ LyXCursor const & InsetTabular::cursor(BufferView * bv) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WordLangTuple const
|
|
||||||
InsetTabular::selectNextWordToSpellcheck(BufferView * bv, float & value) const
|
|
||||||
{
|
|
||||||
if (the_locking_inset) {
|
|
||||||
WordLangTuple word =
|
|
||||||
the_locking_inset->selectNextWordToSpellcheck(bv, value);
|
|
||||||
if (!word.word().empty())
|
|
||||||
return word;
|
|
||||||
if (tabular.isLastCell(actcell)) {
|
|
||||||
bv->unlockInset(const_cast<InsetTabular *>(this));
|
|
||||||
return WordLangTuple();
|
|
||||||
}
|
|
||||||
++actcell;
|
|
||||||
}
|
|
||||||
// otherwise we have to lock the next inset and ask for it's selecttion
|
|
||||||
tabular.getCellInset(actcell)
|
|
||||||
.dispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
|
||||||
WordLangTuple word = selectNextWordInt(bv, value);
|
|
||||||
if (!word.word().empty())
|
|
||||||
resetPos(bv);
|
|
||||||
return word;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WordLangTuple InsetTabular::selectNextWordInt(BufferView * bv, float & value) const
|
|
||||||
{
|
|
||||||
// when entering this function the inset should be ALWAYS locked!
|
|
||||||
BOOST_ASSERT(the_locking_inset);
|
|
||||||
|
|
||||||
WordLangTuple word =
|
|
||||||
the_locking_inset->selectNextWordToSpellcheck(bv, value);
|
|
||||||
if (!word.word().empty())
|
|
||||||
return word;
|
|
||||||
|
|
||||||
if (tabular.isLastCell(actcell)) {
|
|
||||||
bv->unlockInset(const_cast<InsetTabular *>(this));
|
|
||||||
return WordLangTuple();
|
|
||||||
}
|
|
||||||
|
|
||||||
// otherwise we have to lock the next inset and ask for it's selecttion
|
|
||||||
++actcell;
|
|
||||||
tabular.getCellInset(actcell)
|
|
||||||
.dispatch(FuncRequest(bv, LFUN_INSET_EDIT));
|
|
||||||
return selectNextWordInt(bv, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::selectSelectedWord(BufferView * bv)
|
|
||||||
{
|
|
||||||
if (the_locking_inset)
|
|
||||||
the_locking_inset->selectSelectedWord(bv);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InsetTabular::markErased()
|
void InsetTabular::markErased()
|
||||||
{
|
{
|
||||||
for (int cell = 0; cell < tabular.getNumberOfCells(); ++cell)
|
for (int cell = 0; cell < tabular.getNumberOfCells(); ++cell)
|
||||||
|
@ -165,14 +165,8 @@ public:
|
|||||||
LyXText * getText(int) const;
|
LyXText * getText(int) const;
|
||||||
///
|
///
|
||||||
LyXCursor const & cursor(BufferView *) const;
|
LyXCursor const & cursor(BufferView *) const;
|
||||||
///
|
|
||||||
bool allowSpellcheck() const { return true; }
|
|
||||||
///
|
|
||||||
WordLangTuple const
|
|
||||||
selectNextWordToSpellcheck(BufferView *, float & value) const;
|
|
||||||
///
|
|
||||||
void selectSelectedWord(BufferView *);
|
|
||||||
|
|
||||||
|
///
|
||||||
void markErased();
|
void markErased();
|
||||||
|
|
||||||
/// find next change
|
/// find next change
|
||||||
@ -285,8 +279,6 @@ private:
|
|||||||
void getSelection(int & scol, int & ecol,
|
void getSelection(int & scol, int & ecol,
|
||||||
int & srow, int & erow) const;
|
int & srow, int & erow) const;
|
||||||
///
|
///
|
||||||
WordLangTuple selectNextWordInt(BufferView *, float & value) const;
|
|
||||||
///
|
|
||||||
bool insertAsciiString(BufferView *, std::string const & buf, bool usePaste);
|
bool insertAsciiString(BufferView *, std::string const & buf, bool usePaste);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#include "sgml.h"
|
#include "sgml.h"
|
||||||
#include "texrow.h"
|
#include "texrow.h"
|
||||||
#include "undo.h"
|
#include "undo.h"
|
||||||
#include "WordLangTuple.h"
|
|
||||||
|
|
||||||
#include "frontends/Alert.h"
|
#include "frontends/Alert.h"
|
||||||
#include "frontends/font_metrics.h"
|
#include "frontends/font_metrics.h"
|
||||||
@ -1456,39 +1455,6 @@ LyXCursor const & InsetText::cursor(BufferView * bv) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WordLangTuple const
|
|
||||||
InsetText::selectNextWordToSpellcheck(BufferView * bv, float & value) const
|
|
||||||
{
|
|
||||||
WordLangTuple word;
|
|
||||||
if (the_locking_inset) {
|
|
||||||
word = the_locking_inset->selectNextWordToSpellcheck(bv, value);
|
|
||||||
if (!word.word().empty()) {
|
|
||||||
value += cy();
|
|
||||||
return word;
|
|
||||||
}
|
|
||||||
// we have to go on checking so move cursor to the next char
|
|
||||||
text_.cursor.pos(text_.cursor.pos() + 1);
|
|
||||||
}
|
|
||||||
word = text_.selectNextWordToSpellcheck(value);
|
|
||||||
if (word.word().empty())
|
|
||||||
bv->unlockInset(const_cast<InsetText *>(this));
|
|
||||||
else
|
|
||||||
value = cy();
|
|
||||||
return word;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InsetText::selectSelectedWord(BufferView * bv)
|
|
||||||
{
|
|
||||||
if (the_locking_inset) {
|
|
||||||
the_locking_inset->selectSelectedWord(bv);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
getLyXText(bv)->selectSelectedWord();
|
|
||||||
updateLocal(bv, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool InsetText::nextChange(BufferView * bv, lyx::pos_type & length)
|
bool InsetText::nextChange(BufferView * bv, lyx::pos_type & length)
|
||||||
{
|
{
|
||||||
if (the_locking_inset) {
|
if (the_locking_inset) {
|
||||||
|
@ -157,13 +157,6 @@ public:
|
|||||||
LyXText * getText(int) const;
|
LyXText * getText(int) const;
|
||||||
///
|
///
|
||||||
LyXCursor const & cursor(BufferView *) const;
|
LyXCursor const & cursor(BufferView *) const;
|
||||||
///
|
|
||||||
bool allowSpellcheck() const { return true; }
|
|
||||||
///
|
|
||||||
WordLangTuple const
|
|
||||||
selectNextWordToSpellcheck(BufferView *, float & value) const;
|
|
||||||
///
|
|
||||||
void selectSelectedWord(BufferView *);
|
|
||||||
|
|
||||||
/// mark as erased for change tracking
|
/// mark as erased for change tracking
|
||||||
void markErased() { clear(true); };
|
void markErased() { clear(true); };
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "dispatchresult.h"
|
#include "dispatchresult.h"
|
||||||
#include "funcrequest.h"
|
#include "funcrequest.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "WordLangTuple.h"
|
|
||||||
|
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
@ -139,16 +138,6 @@ LyXCursor const & InsetOld::cursor(BufferView * bv) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WordLangTuple const
|
|
||||||
UpdatableInset::selectNextWordToSpellcheck(BufferView *bv, float & value) const
|
|
||||||
{
|
|
||||||
// we have to unlock ourself in this function by default!
|
|
||||||
bv->unlockInset(const_cast<UpdatableInset *>(this));
|
|
||||||
value = 0;
|
|
||||||
return WordLangTuple();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool UpdatableInset::nextChange(BufferView * bv, lyx::pos_type &)
|
bool UpdatableInset::nextChange(BufferView * bv, lyx::pos_type &)
|
||||||
{
|
{
|
||||||
// we have to unlock ourself in this function by default!
|
// we have to unlock ourself in this function by default!
|
||||||
|
@ -87,15 +87,6 @@ public:
|
|||||||
///
|
///
|
||||||
virtual bool showInsetDialog(BufferView *) const { return false; }
|
virtual bool showInsetDialog(BufferView *) const { return false; }
|
||||||
///
|
///
|
||||||
// needed for spellchecking text
|
|
||||||
///
|
|
||||||
virtual bool allowSpellcheck() const { return false; }
|
|
||||||
///
|
|
||||||
virtual WordLangTuple const
|
|
||||||
selectNextWordToSpellcheck(BufferView *, float & value) const;
|
|
||||||
///
|
|
||||||
virtual void selectSelectedWord(BufferView *) {}
|
|
||||||
///
|
|
||||||
virtual void toggleSelection(BufferView *, bool /*kill_selection*/) {}
|
virtual void toggleSelection(BufferView *, bool /*kill_selection*/) {}
|
||||||
|
|
||||||
/// find the next change in the inset
|
/// find the next change in the inset
|
||||||
|
@ -37,7 +37,6 @@ class Row;
|
|||||||
class Spacing;
|
class Spacing;
|
||||||
class UpdatableInset;
|
class UpdatableInset;
|
||||||
class VSpace;
|
class VSpace;
|
||||||
class WordLangTuple;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -204,14 +203,6 @@ public:
|
|||||||
/// reject selected change
|
/// reject selected change
|
||||||
void rejectChange();
|
void rejectChange();
|
||||||
|
|
||||||
/** 'selects" the next word, where the cursor is not in
|
|
||||||
and returns this word as string. THe cursor will be moved
|
|
||||||
to the beginning of this word.
|
|
||||||
With SelectSelectedWord can this be highlighted really
|
|
||||||
*/
|
|
||||||
WordLangTuple const selectNextWordToSpellcheck(float & value);
|
|
||||||
///
|
|
||||||
void selectSelectedWord();
|
|
||||||
/// re-computes the cached coordinates in the cursor
|
/// re-computes the cached coordinates in the cursor
|
||||||
void redoCursor();
|
void redoCursor();
|
||||||
///
|
///
|
||||||
|
122
src/text.C
122
src/text.C
@ -1242,128 +1242,6 @@ void LyXText::rejectChange()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This function is only used by the spellchecker for NextWord().
|
|
||||||
// It doesn't handle LYX_ACCENTs and probably never will.
|
|
||||||
WordLangTuple const LyXText::selectNextWordToSpellcheck(float & value)
|
|
||||||
{
|
|
||||||
if (the_locking_inset) {
|
|
||||||
WordLangTuple word =
|
|
||||||
the_locking_inset->selectNextWordToSpellcheck(bv(), value);
|
|
||||||
if (!word.word().empty()) {
|
|
||||||
value += float(cursor.y());
|
|
||||||
value /= float(height);
|
|
||||||
return word;
|
|
||||||
}
|
|
||||||
// we have to go on checking so move cursor to the next char
|
|
||||||
if (cursor.pos() == cursorPar()->size()) {
|
|
||||||
if (cursor.par() + 1 == int(ownerParagraphs().size()))
|
|
||||||
return word;
|
|
||||||
cursor.par(cursor.par() + 1);
|
|
||||||
cursor.pos(0);
|
|
||||||
} else {
|
|
||||||
cursor.pos(cursor.pos() + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int const tmppar = cursor.par();
|
|
||||||
|
|
||||||
// If this is not the very first word, skip rest of
|
|
||||||
// current word because we are probably in the middle
|
|
||||||
// of a word if there is text here.
|
|
||||||
if (cursor.pos() || cursor.par() != 0) {
|
|
||||||
while (cursor.pos() < cursorPar()->size()
|
|
||||||
&& cursorPar()->isLetter(cursor.pos()))
|
|
||||||
cursor.pos(cursor.pos() + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now, skip until we have real text (will jump paragraphs)
|
|
||||||
while (true) {
|
|
||||||
ParagraphList::iterator cpit = cursorPar();
|
|
||||||
pos_type const cpos = cursor.pos();
|
|
||||||
|
|
||||||
if (cpos == cpit->size()) {
|
|
||||||
if (cursor.par() + 1 != int(ownerParagraphs().size())) {
|
|
||||||
cursor.par(cursor.par() + 1);
|
|
||||||
cursor.pos(0);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool const is_good_inset = cpit->isInset(cpos)
|
|
||||||
&& cpit->getInset(cpos)->allowSpellcheck();
|
|
||||||
|
|
||||||
if (!isDeletedText(*cpit, cpos)
|
|
||||||
&& (is_good_inset || cpit->isLetter(cpos)))
|
|
||||||
break;
|
|
||||||
|
|
||||||
cursor.pos(cpos + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// now check if we hit an inset so it has to be a inset containing text!
|
|
||||||
if (cursor.pos() < cursorPar()->size() &&
|
|
||||||
cursorPar()->isInset(cursor.pos())) {
|
|
||||||
// lock the inset!
|
|
||||||
FuncRequest cmd(bv(), LFUN_INSET_EDIT, "left");
|
|
||||||
cursorPar()->getInset(cursor.pos())->dispatch(cmd);
|
|
||||||
// now call us again to do the above trick
|
|
||||||
// but obviously we have to start from down below ;)
|
|
||||||
return bv()->text->selectNextWordToSpellcheck(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the value if we changed paragraphs
|
|
||||||
if (cursor.par() != tmppar) {
|
|
||||||
setCursor(cursor.par(), cursor.pos());
|
|
||||||
value = float(cursor.y())/float(height);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start the selection from here
|
|
||||||
selection.cursor = cursor;
|
|
||||||
|
|
||||||
string lang_code = getFont(cursorPar(), cursor.pos()).language()->code();
|
|
||||||
// and find the end of the word (insets like optional hyphens
|
|
||||||
// and ligature break are part of a word)
|
|
||||||
while (cursor.pos() < cursorPar()->size()
|
|
||||||
&& cursorPar()->isLetter(cursor.pos())
|
|
||||||
&& !isDeletedText(*cursorPar(), cursor.pos()))
|
|
||||||
cursor.pos(cursor.pos() + 1);
|
|
||||||
|
|
||||||
// Finally, we copy the word to a string and return it
|
|
||||||
string str;
|
|
||||||
if (selection.cursor.pos() < cursor.pos()) {
|
|
||||||
for (pos_type i = selection.cursor.pos(); i < cursor.pos(); ++i) {
|
|
||||||
if (!cursorPar()->isInset(i))
|
|
||||||
str += cursorPar()->getChar(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return WordLangTuple(str, lang_code);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// This one is also only for the spellchecker
|
|
||||||
void LyXText::selectSelectedWord()
|
|
||||||
{
|
|
||||||
if (the_locking_inset) {
|
|
||||||
the_locking_inset->selectSelectedWord(bv());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// move cursor to the beginning
|
|
||||||
setCursor(selection.cursor.par(), selection.cursor.pos());
|
|
||||||
|
|
||||||
// set the sel cursor
|
|
||||||
selection.cursor = cursor;
|
|
||||||
|
|
||||||
// now find the end of the word
|
|
||||||
while (cursor.pos() < cursorPar()->size()
|
|
||||||
&& cursorPar()->isLetter(cursor.pos()))
|
|
||||||
cursor.pos(cursor.pos() + 1);
|
|
||||||
|
|
||||||
setCursor(cursorPar(), cursor.pos());
|
|
||||||
|
|
||||||
// finally set the selection
|
|
||||||
setSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Delete from cursor up to the end of the current or next word.
|
// Delete from cursor up to the end of the current or next word.
|
||||||
void LyXText::deleteWordForward()
|
void LyXText::deleteWordForward()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user