#include <config.h>
+#include "Cursor.h"
+
#include "Buffer.h"
#include "BufferView.h"
#include "CoordCache.h"
-#include "Cursor.h"
#include "CutAndPaste.h"
-#include "DispatchResult.h"
#include "FuncCode.h"
#include "FuncRequest.h"
#include "Language.h"
#include "LyXAction.h"
#include "LyXRC.h"
#include "Paragraph.h"
-#include "ParIterator.h"
#include "Row.h"
#include "texstream.h"
#include "Text.h"
#include "support/debug.h"
#include "support/docstream.h"
-#include "support/ExceptionMessage.h"
#include "support/gettext.h"
#include "support/lassert.h"
+#include "insets/InsetLayout.h"
#include "insets/InsetTabular.h"
-#include "insets/InsetText.h"
#include "mathed/InsetMath.h"
#include "mathed/InsetMathBrace.h"
}
-docstring CursorData::selectionAsString(bool with_label) const
+docstring CursorData::selectionAsString(bool const with_label, bool const skipdelete) const
{
if (!selection())
return docstring();
if (inMathed())
return cap::grabSelection(*this);
- int const label = with_label
+ int label = with_label
? AS_STR_LABEL | AS_STR_INSETS : AS_STR_INSETS;
+ if (skipdelete)
+ label = with_label
+ ? AS_STR_LABEL | AS_STR_INSETS | AS_STR_SKIPDELETE
+ : AS_STR_INSETS | AS_STR_SKIPDELETE;
idx_type const startidx = selBegin().idx();
idx_type const endidx = selEnd().idx();
}
-int CursorData::countInsetsInSelection(InsetCode const & inset_code)
+int CursorData::countInsetsInSelection(InsetCode const & inset_code) const
{
if (!selection_)
return 0;
}
-bool CursorData::insetInSelection(InsetCode const & inset_code)
+bool CursorData::insetInSelection(InsetCode const & inset_code) const
{
if (!selection_)
return false;
}
-void CursorData::recordUndoInset(Inset const * in) const
+void CursorData::recordUndoInset(Inset const * inset) const
{
- buffer()->undo().recordUndoInset(*this, in);
+ buffer()->undo().recordUndoInset(*this, inset);
}
}
-int CursorData::currentMode()
+int CursorData::currentMode() const
{
LASSERT(!empty(), return Inset::UNDECIDED_MODE);
for (int i = depth() - 1; i >= 0; --i) {
}
-void Cursor::push(Inset & p)
+void Cursor::push(Inset & inset)
{
- push_back(CursorSlice(p));
- p.setBuffer(*buffer());
+ push_back(CursorSlice(inset));
+ inset.setBuffer(*buffer());
}
-void Cursor::pushBackward(Inset & p)
+void Cursor::pushBackward(Inset & inset)
{
LASSERT(!empty(), return);
//lyxerr << "Entering inset " << t << " front" << endl;
- push(p);
- p.idxFirst(*this);
+ push(inset);
+ inset.idxFirst(*this);
}
}
-bool Cursor::selHandle(bool sel)
+bool Cursor::selHandle(bool selecting)
{
//lyxerr << "Cursor::selHandle" << endl;
if (mark())
- sel = true;
- if (sel == selection())
+ selecting = true;
+ if (selecting == selection())
return false;
- if (!sel)
+ if (!selecting)
cap::saveSelection(*this);
resetAnchor();
- selection(sel);
+ selection(selecting);
return true;
}
///////////////////////////////////////////////////////////////////
#include "mathed/InsetMathChar.h"
-#include "mathed/InsetMathGrid.h"
-#include "mathed/InsetMathScript.h"
#include "mathed/InsetMathUnknown.h"
-#include "mathed/MathFactory.h"
#include "mathed/MathStream.h"
#include "mathed/MathSupport.h"
InsetMathUnknown * Cursor::activeMacro()
{
- return inMacroMode() ? prevAtom().nucleus()->asUnknownInset() : 0;
+ return inMacroMode() ? prevAtom().nucleus()->asUnknownInset() : nullptr;
}
InsetMathUnknown const * Cursor::activeMacro() const
{
- return inMacroMode() ? prevAtom().nucleus()->asUnknownInset() : 0;
+ return inMacroMode() ? prevAtom().nucleus()->asUnknownInset() : nullptr;
}
<< " in atom: '";
odocstringstream os;
otexrowstream ots(os);
- WriteStream wi(ots, false, true, WriteStream::wsDefault);
+ TeXMathStream wi(ots, false, true, TeXMathStream::wsDefault);
inset().asInsetMath()->write(wi);
lyxerr << to_utf8(os.str()) << endl;
pos() = lastpos();
void Cursor::setLanguageFromInput()
{
- if (!lyxrc.respect_os_kbd_language)
+ if (!lyxrc.respect_os_kbd_language
+ || !inTexted()
+ || paragraph().isPassThru())
return;
string const & code = theApp()->inputLanguageCode();
Language const * lang = languages.getFromCode(code, buffer()->getLanguages());
real_current_font.setLanguage(lang);
real_current_font.fontInfo().setNumber(FONT_OFF);
}
+
+ // No language in pass thru situations
+ if (cs.paragraph().isPassThru()) {
+ current_font.setLanguage(latex_language);
+ real_current_font.setLanguage(latex_language);
+ }
}
// In case the master has no gui associated with it,
// the TocItem is not updated (part of bug 5699).
buffer()->tocBackend().updateItem(*this);
-
- // If the last tracked change of the paragraph has just been
- // deleted, then we need to recompute the buffer flag
- // tracked_changes_present_.
- if (inTexted() && paragraph().isChangeUpdateRequired())
- disp_.forceChangesUpdate();
}