Fix the line-delete-forward bug?

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@779 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-05-30 15:41:16 +00:00
parent e9af311f5f
commit aa25dde22d
5 changed files with 31 additions and 30 deletions

View File

@ -1,3 +1,15 @@
2000-05-30 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/text.C (DeleteLineForward): set selection to true to avoid
that DeleteEmptyParagraphMechanism does some magic. This is how it
is done in all other functions, and seems reasonable.
(DeleteWordForward): do not jump over non-word stuff, since
CursorRightOneWord() already does it.
Remove the CHECK tag from DeleteLineForward, DeleteWordForward and
DeleteWordBackward, since they seem safe to me (since selection is
set to "true") DeleteEmptyParagraphMechanism does nothing.
2000-05-29 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 2000-05-29 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/lyx_main.C (easyParse): simplify the code by factoring the * src/lyx_main.C (easyParse): simplify the code by factoring the

View File

@ -529,6 +529,7 @@ private:
float & fill_hfill, float & fill_hfill,
float & fill_label_hfill, float & fill_label_hfill,
bool bidi = true) const; bool bidi = true) const;
/// ///
void DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const; void DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const;

View File

@ -183,8 +183,8 @@ string CleanupPath(string const & path) ;
*/ */
string ReplaceEnvironmentPath(string const & path); string ReplaceEnvironmentPath(string const & path);
/* Set Link to the path File Points to as a symbolic link. /* Set Link to the path file points to as a symbolic link.
Return True if succesfull, False other wise */ Returns true if successful */
bool LyXReadLink(string const & file, string & Link); bool LyXReadLink(string const & file, string & Link);
/* Uses kpsewhich to find tex files */ /* Uses kpsewhich to find tex files */

View File

@ -3155,20 +3155,11 @@ void LyXText::SelectSelectedWord()
/* -------> Delete from cursor up to the end of the current or next word. */ /* -------> Delete from cursor up to the end of the current or next word. */
void LyXText::DeleteWordForward() void LyXText::DeleteWordForward()
{ {
LyXCursor tmpcursor = cursor;
if (!cursor.par->Last()) if (!cursor.par->Last())
CursorRight(); CursorRight();
// CHECK See comment on top of text.C
else { else {
/* -------> Skip initial non-word stuff. */ LyXCursor tmpcursor = cursor;
while ( cursor.pos < cursor.par->Last() selection = true; // to avoid deletion
&& (cursor.par->IsSeparator(cursor.pos)
|| cursor.par->IsKomma(cursor.pos)) )
cursor.pos++;
SetCursorIntern(cursor.par, cursor.pos);
selection = True; // to avoid deletion
CursorRightOneWord(); CursorRightOneWord();
sel_cursor = cursor; sel_cursor = cursor;
cursor = tmpcursor; cursor = tmpcursor;
@ -3183,11 +3174,10 @@ void LyXText::DeleteWordForward()
/* -------> Delete from cursor to start of current or prior word. */ /* -------> Delete from cursor to start of current or prior word. */
void LyXText::DeleteWordBackward() void LyXText::DeleteWordBackward()
{ {
LyXCursor tmpcursor = cursor;
if (!cursor.par->Last()) if (!cursor.par->Last())
CursorLeft(); CursorLeft();
// CHECK See comment on top of text.C else {
else{ LyXCursor tmpcursor = cursor;
selection = true; // to avoid deletion selection = true; // to avoid deletion
CursorLeftOneWord(); CursorLeftOneWord();
sel_cursor = cursor; sel_cursor = cursor;
@ -3201,19 +3191,18 @@ void LyXText::DeleteWordBackward()
/* -------> Kill to end of line. */ /* -------> Kill to end of line. */
void LyXText::DeleteLineForward() void LyXText::DeleteLineForward()
{ {
if (!cursor.par->Last()) if (!cursor.par->Last())
// Paragraph is empty, so we just go to the right // Paragraph is empty, so we just go to the right
CursorRight(); CursorRight();
else { else {
// CHECK See comment on top of text.C
LyXCursor tmpcursor = cursor; LyXCursor tmpcursor = cursor;
selection = true; // to avoid deletion
CursorEnd(); CursorEnd();
sel_cursor = cursor; sel_cursor = cursor;
cursor = tmpcursor; cursor = tmpcursor;
SetSelection(); SetSelection();
if (selection == false) { // What is this test for ??? (JMarc)
if (!selection) {
DeleteWordForward(); DeleteWordForward();
} else { } else {
CutSelection(); CutSelection();

View File

@ -3542,7 +3542,6 @@ void LyXText::CursorDownParagraph() const
} }
void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const
{ {
// Would be wrong to delete anything if we have a selection. // Would be wrong to delete anything if we have a selection.
@ -3886,14 +3885,14 @@ bool LyXText::TextHandleUndo(Undo * undo)
void LyXText::FinishUndo() void LyXText::FinishUndo()
{ {
// makes sure the next operation will be stored // makes sure the next operation will be stored
undo_finished = True; undo_finished = true;
} }
void LyXText::FreezeUndo() void LyXText::FreezeUndo()
{ {
// this is dangerous and for internal use only // this is dangerous and for internal use only
undo_frozen = True; undo_frozen = true;
} }