+2001-09-27 Adrien Rebollo <adrien.rebollo@gmx.fr>
+
+ * paragraph_pimpl.C (simpleTeXSpecialChars): handle latin9 too.
+
+2001-09-26 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
+
+ * 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-09-27 Angus Leeming <a.leeming@ic.ac.uk>
* BufferView_pimpl.C (buffer): call WorkArea::show to pop-up the
*/
mutable LyXCursor cursor; // actual cursor position
- /** The structrue that keeps track of the selections set. */
+ /** The structure that keeps track of the selections set. */
struct Selection {
Selection()
: set_(false), mark_(false)
};
mutable Selection selection;
- /// needed for the toggling
- LyXCursor last_sel_cursor; // cursor position on last selection made
- ///
- LyXCursor toggle_cursor; // the following two are needed for toggling
- /// the selection in screen.C
- LyXCursor toggle_end_cursor;
+ /// needed for the toggling (cursor position on last selection made)
+ mutable LyXCursor last_sel_cursor;
+ /// needed for toggling the selection in screen.C
+ mutable LyXCursor toggle_cursor;
+ /// needed for toggling the selection in screen.C
+ mutable LyXCursor toggle_end_cursor;
/// need the selection cursor:
void setSelection(BufferView *);
float & fill_label_hfill,
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 *,
LyXCursor const & old_cursor) const;
case '°': case '±': case '²': case '³':
case '×': case '÷': case '¹': case 'ª':
case 'º': case '¬': case 'µ':
- if (bparams.inputenc == "latin1" ||
+ if ((bparams.inputenc == "latin1" ||
+ bparams.inputenc == "latin9") ||
(bparams.inputenc == "auto" &&
- font.language()->encoding()->LatexName()
- == "latin1")) {
+ (font.language()->encoding()->LatexName()
+ == "latin1" ||
+ font.language()->encoding()->LatexName()
+ == "latin9"))) {
os << "\\ensuremath{"
<< c
<< '}';
if (it != inset_owner) {
lyxerr << "InsetText is " << it << endl;
lyxerr << "inset_owner is " << inset_owner << endl;
-#warning I belive this code is wrong. (Lgb)
+#warning I believe this code is wrong. (Lgb)
#warning Jürgen, have a look at this. (Lgb)
#warning Hmmm, I guess you are right but we
#warning should verify when this is needed
}
}
+// 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::deleteEmptyParagraphMechanism(BufferView * bview,
LyXCursor const & old_cursor) const
&& old_cursor.par()->isLineSeparator(old_cursor.pos() - 1)) {
old_cursor.par()->erase(old_cursor.pos() - 1);
redoParagraphs(bview, old_cursor, old_cursor.par()->next());
- // correct cursor
- if (old_cursor.par() == cursor.par() &&
- cursor.pos() > old_cursor.pos()) {
- setCursorIntern(bview, cursor.par(),
- cursor.pos() - 1);
- } else
- setCursorIntern(bview, cursor.par(),
- cursor.pos());
+
+#ifdef WITH_WARNINGS
+#warning This will not work anymore when we have multiple views of the same buffer
+// In this case, we will have to correct also the cursors held by
+// other bufferviews. It will probably be easier to do that in a more
+// automated way in LyXCursor code. (JMarc 26/09/2001)
+#endif
+ // correct all cursors held by the LyXText
+ fixCursorAfterDelete(bview, cursor, old_cursor);
+ fixCursorAfterDelete(bview, selection.cursor,
+ old_cursor);
+ fixCursorAfterDelete(bview, selection.start,
+ old_cursor);
+ fixCursorAfterDelete(bview, selection.end, old_cursor);
+ fixCursorAfterDelete(bview, last_sel_cursor,
+ old_cursor);
+ fixCursorAfterDelete(bview, toggle_cursor, old_cursor);
+ fixCursorAfterDelete(bview, toggle_end_cursor,
+ old_cursor);
return;
}
}