+2000-05-26 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
+
+ * src/lyxparagraph.h: renamed ClearParagraph() to
+ StripLeadingSpaces() and moved it to paragraph.C. We pass the
+ textclass as parameter, and do nothing if free_spacing is
+ true. This fixes part of the line-delete-forward problems.
+
+ * src/CutAndPaste.C (cutSelection): use StripLeadingSpaces.
+ (pasteSelection): ditto.
+ (SwitchLayoutsBetweenClasses): more translatable strings.
+
+ * src/text2.C (CutSelection): use StripLeadingSpaces.
+ (PasteSelection): ditto.
+ (DeleteEmptyParagraphMechanism): ditto.
+
2000-05-26 Juergen Vigna <jug@sad.it>
* src/TabularLayout.C (TabularOptionsCB): removed delete-table as this
// paste the paragraphs again, if possible
if (doclear)
- startpar->Next()->ClearParagraph();
+ startpar->Next()->StripLeadingSpaces(textclass);
if (startpar->FirstPhysicalPar()->HasSameLayout(startpar->Next()) ||
!startpar->Next()->Last()) {
startpar->ParFromPos(start)->PasteParagraph();
lastbuffer->MakeSameLayout(lastbuffer->next);
lastbuffer->ParFromPos(lastbuffer->Last())->PasteParagraph();
} else
- lastbuffer->Next()->ClearParagraph();
+ lastbuffer->Next()->StripLeadingSpaces(tc);
}
// restore the simple cut buffer
buf = simple_cut_clone;
if (name != textclasslist.NameOfLayout(c2, par->layout)) {
++ret;
- string s = "Layout had to be changed from\n"
- + name + " to "
- + textclasslist.NameOfLayout(c2, par->layout)
- + "\nbecause of class conversion from\n"
- + textclasslist.NameOfClass(c1) + " to "
- + textclasslist.NameOfClass(c2);
+ string s = _("Layout had to be changed from\n")
+ + name + _(" to ")
+ + textclasslist.NameOfLayout(c2, par->layout)
+ + _("\nbecause of class conversion from\n")
+ + textclasslist.NameOfClass(c1) + _(" to ")
+ + textclasslist.NameOfClass(c2);
InsetError * new_inset = new InsetError(s);
par->InsertChar(0, LyXParagraph::META_INSET);
par->InsertInset(0, new_inset);
LyXParagraph * FirstSelfrowPar();
///
- int ClearParagraph() {
- int i = 0;
- if (!IsDummy() && !table){
- while (Last()
- && (IsNewline(0)
- || IsLineSeparator(0))){
- Erase(0);
- ++i;
- }
- }
- return i;
- }
+ int StripLeadingSpaces(LyXTextClassList::size_type tclass);
/** A paragraph following a footnote is a "dummy". A paragraph
with a footnote in it is stored as three paragraphs:
return tmppar;
}
+int LyXParagraph::StripLeadingSpaces(LyXTextClassList::size_type tclass)
+{
+ if (textclasslist.Style(tclass, GetLayout()).free_spacing)
+ return 0;
+
+ int i = 0;
+ if (!IsDummy() && !table){
+ while (Last()
+ && (IsNewline(0) || IsLineSeparator(0))){
+ Erase(0);
+ ++i;
+ }
+ }
+ return i;
+}
+
LyXParagraph * LyXParagraph::Clone() const
{
/* -------> Kill to end of line. */
void LyXText::DeleteLineForward()
{
- LyXCursor tmpcursor = cursor;
+
+
if (!cursor.par->Last())
+ // Paragraph is empty, so we just go to the right
CursorRight();
- // CHECK See comment on top of text.C
else {
+ // CHECK See comment on top of text.C
+ LyXCursor tmpcursor = cursor;
CursorEnd();
sel_cursor = cursor;
cursor = tmpcursor;
}
-// Change the case of a word at cursor position. The meaning of action
-// is:
-// 0 change to lowercase
-// 1 capitalize word
-// 2 change to uppercase
+// Change the case of a word at cursor position.
// This function directly manipulates LyXParagraph::text because there
// is no LyXParagraph::SetChar currently. I did what I could to ensure
// that it is correct. I guess part of it should be moved to
// paste the paragraphs again, if possible
if (doclear)
- sel_start_cursor.par->Next()->ClearParagraph();
+ sel_start_cursor.par->Next()->StripLeadingSpaces(simple_cut_buffer_textclass);
if (sel_start_cursor.par->FirstPhysicalPar()->HasSameLayout(sel_start_cursor.par->Next())
||
!sel_start_cursor.par->Next()->Last())
// sometimes necessary
if (doclear)
- sel_start_cursor.par->ClearParagraph();
+ sel_start_cursor.par->StripLeadingSpaces(simple_cut_buffer_textclass);
RedoParagraphs(sel_start_cursor, endpar);
// sometimes necessary
if (doclear)
- sel_start_cursor.par->ClearParagraph();
+ sel_start_cursor.par->StripLeadingSpaces(buffer->params.textclass);
RedoParagraphs(sel_start_cursor, endpar);
lastbuffer->ParFromPos(lastbuffer->Last())->PasteParagraph();
} else
- lastbuffer->Next()->ClearParagraph();
+ lastbuffer->Next()->StripLeadingSpaces(buffer->params.textclass);
}
// restore the simple cut buffer
// MISSING
// If the pos around the old_cursor were spaces, delete one of them.
- if (old_cursor.par != cursor.par || old_cursor.pos != cursor.pos) { // Only if the cursor has really moved
+ if (old_cursor.par != cursor.par || old_cursor.pos != cursor.pos) {
+ // Only if the cursor has really moved
if (old_cursor.pos > 0
&& old_cursor.pos < old_cursor.par->Last()
}
}
if (!deleted) {
- if (old_cursor.par->ClearParagraph()) {
+ if (old_cursor.par->StripLeadingSpaces(buffer->params.textclass)) {
RedoParagraphs(old_cursor, old_cursor.par->Next());
// correct cursor y
SetCursorIntern(cursor.par, cursor.pos);