mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 13:48:59 +00:00
Revert wrong previous commit.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37959 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e52af5f897
commit
eec88b7e5e
@ -1,22 +1,22 @@
|
||||
# Inspired by #7363.
|
||||
#
|
||||
Lang it_IT.utf8
|
||||
TestBegin test.lyx -dbg find > lyx-log.txt 2>&1
|
||||
KK: \Cm
|
||||
KK: x_v \C\[Home]
|
||||
KK: \Cs
|
||||
KK: \CF
|
||||
KK: \Cm
|
||||
KK: v\[Return]
|
||||
TestEnd
|
||||
Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 0\n.*idx: 1 par: 0 pos: 0\n with len: 1' lyx-log.txt
|
||||
|
||||
TestBegin test.lyx -dbg find > lyx-log.txt 2>&1
|
||||
KK: \C\[Home]
|
||||
KK: \CF
|
||||
# Uncheck ignore format
|
||||
KK: \Az\Ag\Ae
|
||||
KK: \Cm
|
||||
KK: v\[Return]
|
||||
TestEnd
|
||||
Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 0\n.*idx: 1 par: 0 pos: 0\n with len: 1' lyx-log.txt
|
||||
# Inspired by #7363.
|
||||
#
|
||||
Lang it_IT.utf8
|
||||
TestBegin test.lyx -dbg find > lyx-log.txt 2>&1
|
||||
KK: \Cm
|
||||
KK: x_v \C\[Home]
|
||||
KK: \Cs
|
||||
KK: \CF
|
||||
KK: \Cm
|
||||
KK: v\[Return]
|
||||
TestEnd
|
||||
Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 0\n.*idx: 1 par: 0 pos: 0\n with len: 1' lyx-log.txt
|
||||
|
||||
TestBegin test.lyx -dbg find > lyx-log.txt 2>&1
|
||||
KK: \C\[Home]
|
||||
KK: \CF
|
||||
# Uncheck ignore format
|
||||
KK: \Az\Ag\Ae
|
||||
KK: \Cm
|
||||
KK: v\[Return]
|
||||
TestEnd
|
||||
Assert pcregrep -M 'Putting selection at .*idx: 0 par: 0 pos: 0\n.*idx: 0 par: 0 pos: 0\n.*idx: 1 par: 0 pos: 0\n with len: 1' lyx-log.txt
|
||||
|
@ -2364,6 +2364,42 @@ void BufferView::putSelectionAt(DocIterator const & cur,
|
||||
}
|
||||
|
||||
|
||||
bool BufferView::selectIfEmpty(DocIterator & cur)
|
||||
{
|
||||
if (!cur.paragraph().empty())
|
||||
return false;
|
||||
|
||||
pit_type const beg_pit = cur.pit();
|
||||
if (beg_pit > 0) {
|
||||
// The paragraph associated to this item isn't
|
||||
// the first one, so it can be selected
|
||||
cur.backwardPos();
|
||||
} else {
|
||||
// We have to resort to select the space between the
|
||||
// end of this item and the begin of the next one
|
||||
cur.forwardPos();
|
||||
}
|
||||
if (cur.empty()) {
|
||||
// If it is the only item in the document,
|
||||
// nothing can be selected
|
||||
return false;
|
||||
}
|
||||
pit_type const end_pit = cur.pit();
|
||||
pos_type const end_pos = cur.pos();
|
||||
d->cursor_.clearSelection();
|
||||
d->cursor_.reset();
|
||||
d->cursor_.setCursor(cur);
|
||||
d->cursor_.pit() = beg_pit;
|
||||
d->cursor_.pos() = 0;
|
||||
d->cursor_.setSelection(false);
|
||||
d->cursor_.resetAnchor();
|
||||
d->cursor_.pit() = end_pit;
|
||||
d->cursor_.pos() = end_pos;
|
||||
d->cursor_.setSelection();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Cursor & BufferView::cursor()
|
||||
{
|
||||
return d->cursor_;
|
||||
|
@ -247,6 +247,9 @@ public:
|
||||
void putSelectionAt(DocIterator const & cur,
|
||||
int length, bool backwards);
|
||||
|
||||
/// selects the item at cursor if its paragraph is empty.
|
||||
bool selectIfEmpty(DocIterator & cur);
|
||||
|
||||
/// update the internal \c ViewMetricsInfo.
|
||||
void updateMetrics();
|
||||
|
||||
|
@ -1577,7 +1577,7 @@ void GuiDocument::changeNoteFontColor()
|
||||
void GuiDocument::deleteNoteFontColor()
|
||||
{
|
||||
// set the button color back to pref
|
||||
theApp()->getRgbColor(Color_notebg, set_notefontcolor);
|
||||
theApp()->getRgbColor(Color_greyedouttext, set_notefontcolor);
|
||||
colorModule->noteFontColorPB->setStyleSheet(
|
||||
colorButtonStyleSheet(rgb2qcolor(set_notefontcolor)));
|
||||
changed();
|
||||
|
@ -172,11 +172,17 @@ bool GuiErrorList::goTo(int item)
|
||||
return false;
|
||||
}
|
||||
|
||||
// If this paragraph is empty, highlight the previous one
|
||||
while (dit.paragraph().empty())
|
||||
dit.backwardPos();
|
||||
|
||||
// Now make the selection.
|
||||
BufferView * bv = const_cast<BufferView *>(bufferview());
|
||||
if (bv->selectIfEmpty(dit)) {
|
||||
// The paragraph is empty but can be selected
|
||||
bv->processUpdateFlags(Update::Force | Update::FitCursor);
|
||||
return true;
|
||||
}
|
||||
if (dit.empty()) {
|
||||
// The paragraph is empty and cannot be selected
|
||||
return false;
|
||||
}
|
||||
// if pos_end is 0, this means it is end-of-paragraph
|
||||
pos_type const s = dit.paragraph().size();
|
||||
pos_type const end = err.pos_end ? min(err.pos_end, s) : s;
|
||||
@ -184,7 +190,6 @@ bool GuiErrorList::goTo(int item)
|
||||
pos_type const range = end == start ? s - start : end - start;
|
||||
// end-of-paragraph cannot be highlighted, so highlight the last thing
|
||||
dit.pos() = range ? start : end - 1;
|
||||
BufferView * bv = const_cast<BufferView *>(bufferview());
|
||||
// FIXME LFUN
|
||||
// If we used an LFUN, we would not need these lines:
|
||||
bv->putSelectionAt(dit, max(range, pos_type(1)), false);
|
||||
|
@ -49,15 +49,10 @@ GuiSelectionManager::GuiSelectionManager(
|
||||
QPushButton * down,
|
||||
QAbstractListModel * amod,
|
||||
QAbstractListModel * smod)
|
||||
: availableLV(avail), selectedLV(sel), addPB(add), deletePB(del),
|
||||
upPB(up), downPB(down), availableModel(amod), selectedModel(smod),
|
||||
selectedHasFocus_(false)
|
||||
{
|
||||
availableLV = avail;
|
||||
selectedLV = sel;
|
||||
addPB = add;
|
||||
deletePB = del;
|
||||
upPB = up;
|
||||
downPB = down;
|
||||
availableModel = amod;
|
||||
selectedModel = smod;
|
||||
|
||||
selectedLV->setModel(smod);
|
||||
availableLV->setModel(amod);
|
||||
@ -87,7 +82,6 @@ GuiSelectionManager::GuiSelectionManager(
|
||||
|
||||
availableLV->installEventFilter(this);
|
||||
selectedLV->installEventFilter(this);
|
||||
selectedHasFocus_ = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -140,25 +140,34 @@ docstring InsetRef::getEscapedLabel(OutputParams const & rp) const
|
||||
void InsetRef::latex(otexstream & os, OutputParams const & rp) const
|
||||
{
|
||||
string const cmd = getCmdName();
|
||||
docstring const data = getEscapedLabel(rp);
|
||||
|
||||
if (cmd == "eqref" && buffer().params().use_refstyle) {
|
||||
os << '(' << from_ascii("\\ref{") << data << from_ascii("})");
|
||||
}
|
||||
else if (cmd == "formatted") {
|
||||
docstring label;
|
||||
docstring prefix;
|
||||
docstring const fcmd = getFormattedCmd(data, label, prefix);
|
||||
os << fcmd << '{' << label << '}';
|
||||
}
|
||||
else {
|
||||
// refstyle defines its own version of \eqref
|
||||
if (cmd != "formatted" &&
|
||||
!(cmd == "eqref" && buffer().params().use_refstyle)
|
||||
) {
|
||||
// We don't want to output p_["name"], since that is only used
|
||||
// in docbook. So we construct new params, without it, and use that.
|
||||
InsetCommandParams p(REF_CODE, cmd);
|
||||
docstring const ref = getParam("reference");
|
||||
p["reference"] = ref;
|
||||
os << p.getCommand(rp);
|
||||
return;
|
||||
}
|
||||
|
||||
// so we're doing a formatted reference of some kind.
|
||||
docstring const data = getEscapedLabel(rp);
|
||||
|
||||
// what we say in the UI is that an "eqref" is supposed to surround the
|
||||
// reference with parentheses, so let's do that.
|
||||
if (cmd == "eqref" /* && buffer().params().use_refstyle */) {
|
||||
os << '(' << from_ascii("\\ref{") << data << from_ascii("})");
|
||||
return;
|
||||
}
|
||||
|
||||
docstring label;
|
||||
docstring prefix;
|
||||
docstring const fcmd = getFormattedCmd(data, label, prefix);
|
||||
os << fcmd << '{' << label << '}';
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user