mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-18 13:40:19 +00:00
fix indexing first word in a list layout
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2738 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0e0913d030
commit
43cb604df7
@ -3071,13 +3071,14 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
|
|||||||
string arg = argument;
|
string arg = argument;
|
||||||
|
|
||||||
if (arg.empty()) {
|
if (arg.empty()) {
|
||||||
arg = bv_->getLyXText()->selectionAsString(buffer_);
|
arg = bv_->getLyXText()->selectionAsString(buffer_,
|
||||||
|
false);
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
if (arg.size() > 100 || arg.empty()) {
|
if (arg.size() > 100 || arg.empty()) {
|
||||||
// Get word or selection
|
// Get word or selection
|
||||||
bv_->getLyXText()->selectWordWhenUnderCursor(bv_, LyXText::WHOLE_WORD);
|
bv_->getLyXText()->selectWordWhenUnderCursor(bv_, LyXText::WHOLE_WORD);
|
||||||
arg = bv_->getLyXText()->selectionAsString(buffer_);
|
arg = bv_->getLyXText()->selectionAsString(buffer_, false);
|
||||||
// FIXME: where is getLyXText()->unselect(bv_) ?
|
// FIXME: where is getLyXText()->unselect(bv_) ?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
2001-09-12 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
|
* text2.C (copySelection):
|
||||||
|
(cutSelection):
|
||||||
|
* lyxfind.C (LyXReplace):
|
||||||
|
* BufferView_pimpl.C (Dispatch): pass the correct flag to
|
||||||
|
LyXText::selectionAsString.
|
||||||
|
|
||||||
|
* paragraph.C (asString): add "label" argument to the second form
|
||||||
|
|
||||||
|
* text2.C (selectionAsString): add "label" argument and pass it to
|
||||||
|
Paragraph::asString.
|
||||||
|
|
||||||
2001-09-10 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
2001-09-10 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
* lyx_main.C (commandLineHelp): remove version information
|
* lyx_main.C (commandLineHelp): remove version information
|
||||||
|
@ -80,10 +80,10 @@ int LyXReplace(BufferView * bv,
|
|||||||
string str2;
|
string str2;
|
||||||
if (casesens) {
|
if (casesens) {
|
||||||
str1 = searchstr;
|
str1 = searchstr;
|
||||||
str2 = text->selectionAsString(bv->buffer());
|
str2 = text->selectionAsString(bv->buffer(), false);
|
||||||
} else {
|
} else {
|
||||||
str1 = lowercase(searchstr);
|
str1 = lowercase(searchstr);
|
||||||
str2 = lowercase(text->selectionAsString(bv->buffer()));
|
str2 = lowercase(text->selectionAsString(bv->buffer(), false));
|
||||||
}
|
}
|
||||||
if (str1 != str2) {
|
if (str1 != str2) {
|
||||||
if (!LyXFind(bv, searchstr, fw, false, casesens, matchwrd) ||
|
if (!LyXFind(bv, searchstr, fw, false, casesens, matchwrd) ||
|
||||||
|
@ -280,7 +280,7 @@ public:
|
|||||||
///
|
///
|
||||||
void clearSelection() const;
|
void clearSelection() const;
|
||||||
///
|
///
|
||||||
string const selectionAsString(Buffer const *) const;
|
string const selectionAsString(Buffer const *, bool label) const;
|
||||||
|
|
||||||
/// select the word we need depending on word_location
|
/// select the word we need depending on word_location
|
||||||
void getWord(LyXCursor & from, LyXCursor & to,
|
void getWord(LyXCursor & from, LyXCursor & to,
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2001-09-12 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
|
* formulabase.C (mathDispatchCreation): pass second argument
|
||||||
|
'false' (no label) to selectionAsString
|
||||||
|
|
||||||
2001-09-11 André Pönitz <poenitz@gmx.net>
|
2001-09-11 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
* math_atom.[Ch]: new basic item in the MathArray
|
* math_atom.[Ch]: new basic item in the MathArray
|
||||||
|
@ -732,7 +732,8 @@ void mathDispatchCreation(BufferView * bv, string const & arg, bool display)
|
|||||||
// sel = "";
|
// sel = "";
|
||||||
//else
|
//else
|
||||||
|
|
||||||
string sel = bv->getLyXText()->selectionAsString(bv->buffer());
|
string sel = bv->getLyXText()->selectionAsString(bv->buffer(),
|
||||||
|
false);
|
||||||
|
|
||||||
InsetFormulaBase * f;
|
InsetFormulaBase * f;
|
||||||
if (sel.empty()) {
|
if (sel.empty()) {
|
||||||
|
@ -1930,12 +1930,13 @@ string const Paragraph::asString(Buffer const * buffer, bool label)
|
|||||||
|
|
||||||
|
|
||||||
string const Paragraph::asString(Buffer const * buffer,
|
string const Paragraph::asString(Buffer const * buffer,
|
||||||
Paragraph::size_type beg,
|
Paragraph::size_type beg,
|
||||||
Paragraph::size_type end)
|
Paragraph::size_type end,
|
||||||
|
bool label)
|
||||||
{
|
{
|
||||||
ostringstream ost;
|
ostringstream ost;
|
||||||
|
|
||||||
if (beg == 0 && !params().labelString().empty())
|
if (beg == 0 && label && !params().labelString().empty())
|
||||||
ost << params().labelString() << ' ';
|
ost << params().labelString() << ' ';
|
||||||
|
|
||||||
for (Paragraph::size_type i = beg; i < end; ++i) {
|
for (Paragraph::size_type i = beg; i < end; ++i) {
|
||||||
|
@ -111,7 +111,8 @@ public:
|
|||||||
|
|
||||||
string const asString(Buffer const *, bool label);
|
string const asString(Buffer const *, bool label);
|
||||||
///
|
///
|
||||||
string const asString(Buffer const *, size_type beg, size_type end);
|
string const asString(Buffer const *, size_type beg, size_type end,
|
||||||
|
bool label);
|
||||||
|
|
||||||
///
|
///
|
||||||
void writeFile(Buffer const *, std::ostream &, BufferParams const &,
|
void writeFile(Buffer const *, std::ostream &, BufferParams const &,
|
||||||
|
20
src/text2.C
20
src/text2.C
@ -1013,7 +1013,8 @@ void LyXText::setSelection(BufferView * bview)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const LyXText::selectionAsString(Buffer const * buffer) const
|
string const LyXText::selectionAsString(Buffer const * buffer,
|
||||||
|
bool label) const
|
||||||
{
|
{
|
||||||
if (!selection.set()) return string();
|
if (!selection.set()) return string();
|
||||||
string result;
|
string result;
|
||||||
@ -1022,7 +1023,8 @@ string const LyXText::selectionAsString(Buffer const * buffer) const
|
|||||||
if (selection.start.par() == selection.end.par()) {
|
if (selection.start.par() == selection.end.par()) {
|
||||||
result += selection.start.par()->asString(buffer,
|
result += selection.start.par()->asString(buffer,
|
||||||
selection.start.pos(),
|
selection.start.pos(),
|
||||||
selection.end.pos());
|
selection.end.pos(),
|
||||||
|
label);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1031,7 +1033,8 @@ string const LyXText::selectionAsString(Buffer const * buffer) const
|
|||||||
// First paragraph in selection
|
// First paragraph in selection
|
||||||
result += selection.start.par()->asString(buffer,
|
result += selection.start.par()->asString(buffer,
|
||||||
selection.start.pos(),
|
selection.start.pos(),
|
||||||
selection.start.par()->size())
|
selection.start.par()->size(),
|
||||||
|
label)
|
||||||
+ "\n\n";
|
+ "\n\n";
|
||||||
|
|
||||||
// The paragraphs in between (if any)
|
// The paragraphs in between (if any)
|
||||||
@ -1039,13 +1042,14 @@ string const LyXText::selectionAsString(Buffer const * buffer) const
|
|||||||
tmpcur.par(tmpcur.par()->next());
|
tmpcur.par(tmpcur.par()->next());
|
||||||
while (tmpcur.par() != selection.end.par()) {
|
while (tmpcur.par() != selection.end.par()) {
|
||||||
result += tmpcur.par()->asString(buffer, 0,
|
result += tmpcur.par()->asString(buffer, 0,
|
||||||
tmpcur.par()->size()) +"\n\n";
|
tmpcur.par()->size(),
|
||||||
|
label) + "\n\n";
|
||||||
tmpcur.par(tmpcur.par()->next());
|
tmpcur.par(tmpcur.par()->next());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last paragraph in selection
|
// Last paragraph in selection
|
||||||
result += selection.end.par()->asString(buffer, 0,
|
result += selection.end.par()->asString(buffer, 0,
|
||||||
selection.end.pos());
|
selection.end.pos(), label);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1153,7 +1157,7 @@ LyXText::getStringToIndex(BufferView * bview)
|
|||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
|
|
||||||
idxstring = selectionAsString(bview->buffer());
|
idxstring = selectionAsString(bview->buffer(), false);
|
||||||
|
|
||||||
// Implicit selections are cleared afterwards
|
// Implicit selections are cleared afterwards
|
||||||
//and cursor is set to the original position.
|
//and cursor is set to the original position.
|
||||||
@ -1723,7 +1727,7 @@ void LyXText::cutSelection(BufferView * bview, bool doclear, bool realcut)
|
|||||||
// finished. The solution used currently just works, to make it
|
// finished. The solution used currently just works, to make it
|
||||||
// faster we need to be more clever and probably also have more
|
// faster we need to be more clever and probably also have more
|
||||||
// calls to stuffClipboard. (Lgb)
|
// calls to stuffClipboard. (Lgb)
|
||||||
bview->stuffClipboard(selectionAsString(bview->buffer()));
|
bview->stuffClipboard(selectionAsString(bview->buffer(), true));
|
||||||
|
|
||||||
// This doesn't make sense, if there is no selection
|
// This doesn't make sense, if there is no selection
|
||||||
if (!selection.set())
|
if (!selection.set())
|
||||||
@ -1802,7 +1806,7 @@ void LyXText::copySelection(BufferView * bview)
|
|||||||
// finished. The solution used currently just works, to make it
|
// finished. The solution used currently just works, to make it
|
||||||
// faster we need to be more clever and probably also have more
|
// faster we need to be more clever and probably also have more
|
||||||
// calls to stuffClipboard. (Lgb)
|
// calls to stuffClipboard. (Lgb)
|
||||||
bview->stuffClipboard(selectionAsString(bview->buffer()));
|
bview->stuffClipboard(selectionAsString(bview->buffer(), true));
|
||||||
|
|
||||||
// this doesnt make sense, if there is no selection
|
// this doesnt make sense, if there is no selection
|
||||||
if (!selection.set())
|
if (!selection.set())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user