#include "buffer_funcs.h"
#include "BufferParams.h"
#include "BufferView.h"
-#include "bufferview_funcs.h"
#include "Cursor.h"
#include "ParIterator.h"
-#include "CoordCache.h"
#include "CutAndPaste.h"
#include "debug.h"
#include "DispatchResult.h"
#include "Length.h"
#include "Lexer.h"
#include "LyXRC.h"
-#include "Row.h"
-#include "MetricsInfo.h"
#include "Paragraph.h"
#include "paragraph_funcs.h"
#include "ParagraphParameters.h"
}
-Color_color Text::backgroundColor() const
-{
- return Color_color(Color::color(background_color_));
-}
-
-
void Text::breakParagraph(Cursor & cur, bool keep_layout)
{
BOOST_ASSERT(this == cur.text());
static docstring const number_unary_operators = from_ascii("+-");
static docstring const number_seperators = from_ascii(".,:");
- if (current_font.number() == Font::ON) {
+ if (cur.current_font.number() == Font::ON) {
if (!isDigit(c) && !contains(number_operators, c) &&
!(contains(number_seperators, c) &&
cur.pos() != 0 &&
)
number(cur); // Set current_font.number to OFF
} else if (isDigit(c) &&
- real_current_font.isVisibleRightToLeft()) {
+ cur.real_current_font.isVisibleRightToLeft()) {
number(cur); // Set current_font.number to ON
if (cur.pos() != 0) {
|| par.isSeparator(cur.pos() - 2)
|| par.isNewline(cur.pos() - 2))
) {
- setCharFont(buffer, pit, cur.pos() - 1, current_font);
+ setCharFont(buffer, pit, cur.pos() - 1, cur.current_font);
} else if (contains(number_seperators, c)
&& cur.pos() >= 2
&& getFont(buffer, par, cur.pos() - 2).number() == Font::ON) {
- setCharFont(buffer, pit, cur.pos() - 1, current_font);
+ setCharFont(buffer, pit, cur.pos() - 1, cur.current_font);
}
}
}
// get font in front and behind the space in question. But do NOT
// use getFont(cur.pos()) because the character c is not inserted yet
Font const & pre_space_font = getFont(buffer, par, cur.pos() - 2);
- Font const & post_space_font = real_current_font;
+ Font const & post_space_font = cur.real_current_font;
bool pre_space_rtl = pre_space_font.isVisibleRightToLeft();
bool post_space_rtl = post_space_font.isVisibleRightToLeft();
}
}
- par.insertChar(cur.pos(), c, current_font, cur.buffer().params().trackChanges);
+ par.insertChar(cur.pos(), c, cur.current_font, cur.buffer().params().trackChanges);
checkBufferStructure(cur.buffer(), cur);
// cur.updateFlags(Update::Force);
}
-// Delete from cursor up to the end of the current or next word.
void Text::deleteWordForward(Cursor & cur)
{
BOOST_ASSERT(this == cur.text());
}
-// Delete from cursor to start of current or prior word.
void Text::deleteWordBackward(Cursor & cur)
{
BOOST_ASSERT(this == cur.text());
// Kill to end of line.
-void Text::deleteLineForward(Cursor & cur)
-{
- BOOST_ASSERT(this == cur.text());
- if (cur.lastpos() == 0) {
- // Paragraph is empty, so we just go to the right
- cursorRight(cur);
- } else {
- cur.resetAnchor();
- cur.selection() = true; // to avoid deletion
- cursorEnd(cur);
- cur.setSelection();
- // What is this test for ??? (JMarc)
- if (!cur.selection())
- deleteWordForward(cur);
- else
- cutSelection(cur, true, false);
- checkBufferStructure(cur.buffer(), cur);
- }
-}
-
-
void Text::changeCase(Cursor & cur, Text::TextCase action)
{
BOOST_ASSERT(this == cur.text());
}
if (cur.pos() == cur.lastpos())
- setCurrentFont(cur);
+ cur.setCurrentFont();
needsUpdate |= handleBibitems(cur);
}
-bool Text::isLastRow(pit_type pit, Row const & row) const
-{
- return row.endpos() >= pars_[pit].size()
- && pit + 1 == pit_type(paragraphs().size());
-}
-
-
-bool Text::isFirstRow(pit_type pit, Row const & row) const
-{
- return row.pos() == 0 && pit == 0;
-}
-
-
void Text::getWord(CursorSlice & from, CursorSlice & to,
word_location const loc)
{
// I think we should only show changes from the default
// font. (Asger)
// No, from the document font (MV)
- Font font = real_current_font;
+ Font font = cur.real_current_font;
font.reduce(buf.params().getFont());
os << bformat(_("Font: %1$s"), font.stateText(&buf.params()));