mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-09 10:47:57 +00:00
fix selection when cursor is in between two spaces
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_1_6@2888 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5aa6c20376
commit
2458541066
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
2001-10-15 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
|
* src/text2.C (fixCursorAfterDelete): new method. Fixes the parameters
|
||||||
|
of a cursor (row, etc.) after a character has been deleted
|
||||||
|
(DeleteEmptyParagraphMechanism): call the method above on _all_
|
||||||
|
cursors held by the LyXText when a double space has been
|
||||||
|
detected/deleted.
|
||||||
|
|
||||||
|
2001-10-01 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
|
* lib/languages: change default encoding for estonian to latin1
|
||||||
|
|
||||||
2001-10-01 Garst R. Reese <reese@isn.net>
|
2001-10-01 Garst R. Reese <reese@isn.net>
|
||||||
|
|
||||||
* lib/tex/hollywood.cls:
|
* lib/tex/hollywood.cls:
|
||||||
|
@ -17,7 +17,7 @@ dutch dutch "Dutch" false iso8859-1 nl ""
|
|||||||
english english "English" false iso8859-1 en ""
|
english english "English" false iso8859-1 en ""
|
||||||
esperanto esperanto "Esperanto" false iso8859-3 eo ""
|
esperanto esperanto "Esperanto" false iso8859-3 eo ""
|
||||||
#and what country code should esperanto have?? (Garst)
|
#and what country code should esperanto have?? (Garst)
|
||||||
estonian estonian "Estonian" false iso8859-4 et_EE ""
|
estonian estonian "Estonian" false iso8859-1 et_EE ""
|
||||||
finnish finnish "Finnish" false iso8859-1 fi ""
|
finnish finnish "Finnish" false iso8859-1 fi ""
|
||||||
frenchb frenchb "French" false iso8859-1 fr ""
|
frenchb frenchb "French" false iso8859-1 fr ""
|
||||||
french french "French (GUTenberg)" false iso8859-1 fr ""
|
french french "French (GUTenberg)" false iso8859-1 fr ""
|
||||||
|
@ -220,15 +220,15 @@ public:
|
|||||||
///
|
///
|
||||||
mutable LyXCursor sel_cursor;
|
mutable LyXCursor sel_cursor;
|
||||||
///
|
///
|
||||||
LyXCursor sel_start_cursor;
|
mutable LyXCursor sel_start_cursor;
|
||||||
///
|
///
|
||||||
mutable LyXCursor sel_end_cursor;
|
mutable LyXCursor sel_end_cursor;
|
||||||
/// needed for the toggling
|
/// needed for the toggling
|
||||||
LyXCursor last_sel_cursor;
|
mutable LyXCursor last_sel_cursor;
|
||||||
///
|
///
|
||||||
LyXCursor toggle_cursor;
|
mutable LyXCursor toggle_cursor;
|
||||||
///
|
///
|
||||||
LyXCursor toggle_end_cursor;
|
mutable LyXCursor toggle_end_cursor;
|
||||||
|
|
||||||
/// need the selection cursor:
|
/// need the selection cursor:
|
||||||
void SetSelection();
|
void SetSelection();
|
||||||
@ -566,6 +566,12 @@ private:
|
|||||||
float & fill_label_hfill,
|
float & fill_label_hfill,
|
||||||
bool bidi = true) const;
|
bool bidi = true) const;
|
||||||
|
|
||||||
|
// fix the cursor `cur' after a characters has been deleted at `where'
|
||||||
|
// position. Called by deleteEmptyParagraphMechanism
|
||||||
|
void fixCursorAfterDelete(BufferView * bview,
|
||||||
|
LyXCursor & cur,
|
||||||
|
LyXCursor const & where) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
void DeleteEmptyParagraphMechanism(BufferView *,
|
void DeleteEmptyParagraphMechanism(BufferView *,
|
||||||
LyXCursor const & old_cursor) const;
|
LyXCursor const & old_cursor) const;
|
||||||
|
47
src/text2.C
47
src/text2.C
@ -2332,6 +2332,26 @@ void LyXText::CopySelection(BufferView * bview)
|
|||||||
bview->buffer()->params.textclass);
|
bview->buffer()->params.textclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fix the cursor `cur' after a characters has been deleted at `where'
|
||||||
|
// position. Called by deleteEmptyParagraphMechanism
|
||||||
|
void LyXText::fixCursorAfterDelete(BufferView * bview,
|
||||||
|
LyXCursor & cur,
|
||||||
|
LyXCursor const & where) const
|
||||||
|
{
|
||||||
|
// if cursor is not in the paragraph where the delete occured,
|
||||||
|
// do nothing
|
||||||
|
if (cur.par() != where.par())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// if cursor position is after the place where the delete occured,
|
||||||
|
// update it
|
||||||
|
if (cur.pos() > where.pos())
|
||||||
|
cur.pos(cur.pos()-1);
|
||||||
|
|
||||||
|
// recompute row et al. for this cursor
|
||||||
|
SetCursor(bview, cur, cur.par(), cur.pos(), cur.boundary());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXText::PasteSelection(BufferView * bview)
|
void LyXText::PasteSelection(BufferView * bview)
|
||||||
{
|
{
|
||||||
@ -3079,14 +3099,25 @@ void LyXText::DeleteEmptyParagraphMechanism(BufferView * bview,
|
|||||||
&& old_cursor.par()->IsLineSeparator(old_cursor.pos() - 1)) {
|
&& old_cursor.par()->IsLineSeparator(old_cursor.pos() - 1)) {
|
||||||
old_cursor.par()->Erase(old_cursor.pos() - 1);
|
old_cursor.par()->Erase(old_cursor.pos() - 1);
|
||||||
RedoParagraphs(bview, old_cursor, old_cursor.par()->Next());
|
RedoParagraphs(bview, old_cursor, old_cursor.par()->Next());
|
||||||
// correct cursor
|
|
||||||
if (old_cursor.par() == cursor.par() &&
|
#ifdef WITH_WARNINGS
|
||||||
cursor.pos() > old_cursor.pos()) {
|
#warning This will not work anymore when we have multiple views of the same buffer
|
||||||
SetCursorIntern(bview, cursor.par(),
|
// In this case, we will have to correct also the cursors held by
|
||||||
cursor.pos() - 1);
|
// other bufferviews. It will probably be easier to do that in a more
|
||||||
} else
|
// automated way in LyXCursor code. (JMarc 26/09/2001)
|
||||||
SetCursorIntern(bview, cursor.par(),
|
#endif
|
||||||
cursor.pos());
|
// correct all cursors held by the LyXText
|
||||||
|
fixCursorAfterDelete(bview, cursor, old_cursor);
|
||||||
|
fixCursorAfterDelete(bview, sel_cursor, old_cursor);
|
||||||
|
fixCursorAfterDelete(bview, sel_start_cursor,
|
||||||
|
old_cursor);
|
||||||
|
fixCursorAfterDelete(bview, sel_end_cursor,
|
||||||
|
old_cursor);
|
||||||
|
fixCursorAfterDelete(bview, last_sel_cursor,
|
||||||
|
old_cursor);
|
||||||
|
fixCursorAfterDelete(bview, toggle_cursor, old_cursor);
|
||||||
|
fixCursorAfterDelete(bview, toggle_end_cursor,
|
||||||
|
old_cursor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user