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>
* src/lyx_main.C (easyParse): simplify the code by factoring the

View File

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

View File

@ -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 */

View File

@ -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();

View File

@ -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;
}