From aa25dde22d88546313f37f4fcee6fff5f6944f49 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 30 May 2000 15:41:16 +0000 Subject: [PATCH] Fix the line-delete-forward bug? git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@779 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 12 ++++++++++++ src/lyxtext.h | 1 + src/support/filetools.h | 4 ++-- src/text.C | 39 ++++++++++++++------------------------- src/text2.C | 5 ++--- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 787dab6c89..094b267977 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2000-05-30 Jean-Marc Lasgouttes + + * 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 * src/lyx_main.C (easyParse): simplify the code by factoring the diff --git a/src/lyxtext.h b/src/lyxtext.h index 4b5627e771..1f56ba635b 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -529,6 +529,7 @@ private: float & fill_hfill, float & fill_label_hfill, bool bidi = true) const; + /// void DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const; diff --git a/src/support/filetools.h b/src/support/filetools.h index ade432f04c..2686897258 100644 --- a/src/support/filetools.h +++ b/src/support/filetools.h @@ -183,8 +183,8 @@ string CleanupPath(string const & path) ; */ string ReplaceEnvironmentPath(string const & path); -/* Set Link to the path File Points to as a symbolic link. - Return True if succesfull, False other wise */ +/* Set Link to the path file points to as a symbolic link. + Returns true if successful */ bool LyXReadLink(string const & file, string & Link); /* Uses kpsewhich to find tex files */ diff --git a/src/text.C b/src/text.C index f74e773fb5..7d85629a10 100644 --- a/src/text.C +++ b/src/text.C @@ -3155,20 +3155,11 @@ void LyXText::SelectSelectedWord() /* -------> Delete from cursor up to the end of the current or next word. */ void LyXText::DeleteWordForward() { - LyXCursor tmpcursor = cursor; - if (!cursor.par->Last()) CursorRight(); - // CHECK See comment on top of text.C else { - /* -------> Skip initial non-word stuff. */ - while ( cursor.pos < cursor.par->Last() - && (cursor.par->IsSeparator(cursor.pos) - || cursor.par->IsKomma(cursor.pos)) ) - cursor.pos++; - - SetCursorIntern(cursor.par, cursor.pos); - selection = True; // to avoid deletion + LyXCursor tmpcursor = cursor; + selection = true; // to avoid deletion CursorRightOneWord(); sel_cursor = cursor; cursor = tmpcursor; @@ -3183,17 +3174,16 @@ void LyXText::DeleteWordForward() /* -------> Delete from cursor to start of current or prior word. */ void LyXText::DeleteWordBackward() { - LyXCursor tmpcursor = cursor; if (!cursor.par->Last()) - CursorLeft(); - // CHECK See comment on top of text.C - else{ - selection = true; // to avoid deletion - CursorLeftOneWord(); - sel_cursor = cursor; - cursor = tmpcursor; - SetSelection(); - CutSelection(); + CursorLeft(); + else { + LyXCursor tmpcursor = cursor; + selection = true; // to avoid deletion + CursorLeftOneWord(); + sel_cursor = cursor; + cursor = tmpcursor; + SetSelection(); + CutSelection(); } } @@ -3201,19 +3191,18 @@ void LyXText::DeleteWordBackward() /* -------> Kill to end of line. */ void LyXText::DeleteLineForward() { - - if (!cursor.par->Last()) // Paragraph is empty, so we just go to the right CursorRight(); else { - // CHECK See comment on top of text.C LyXCursor tmpcursor = cursor; + selection = true; // to avoid deletion CursorEnd(); sel_cursor = cursor; cursor = tmpcursor; SetSelection(); - if (selection == false) { + // What is this test for ??? (JMarc) + if (!selection) { DeleteWordForward(); } else { CutSelection(); diff --git a/src/text2.C b/src/text2.C index 4537bd86cd..445fb211e1 100644 --- a/src/text2.C +++ b/src/text2.C @@ -3542,7 +3542,6 @@ void LyXText::CursorDownParagraph() const } - void LyXText::DeleteEmptyParagraphMechanism(LyXCursor const & old_cursor) const { // Would be wrong to delete anything if we have a selection. @@ -3886,14 +3885,14 @@ bool LyXText::TextHandleUndo(Undo * undo) void LyXText::FinishUndo() { // makes sure the next operation will be stored - undo_finished = True; + undo_finished = true; } void LyXText::FreezeUndo() { // this is dangerous and for internal use only - undo_frozen = True; + undo_frozen = true; } -- 2.39.2