hi, i got finally frustrated that i cant use temp bookmark similarly as `` do in vim. would be anybody opposed to adding new button for the back navigation into the main toolbar?
pavel
diff --git a/lib/ui/stdcontext.inc b/lib/ui/stdcontext.inc index 9d4d5fa..301608c 100644 --- a/lib/ui/stdcontext.inc +++ b/lib/ui/stdcontext.inc @@ -88,7 +88,7 @@ Menuset # Menu "context-label" Item "Next Cross-Reference|N" "reference-next" - Item "Go back to Reference|G" "bookmark-goto 0" + Item "Go back|G" "bookmark-goto 0" Separator Item "Copy as Reference|C" "copy-label-as-reference" Separator @@ -275,7 +275,7 @@ Menuset Item "Paste" "paste" Submenu "Paste Recent|e" "edit_pasterecent" Separator - Item "Jump to Saved Bookmark|B" "bookmark-goto 0" + Item "Jump Back to Saved Bookmark|B" "bookmark-goto 0" Separator Item "Move Paragraph Up|o" "paragraph-move-up" Item "Move Paragraph Down|v" "paragraph-move-down" diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 35edfe9..6ec979d 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -218,7 +218,7 @@ struct BufferView::Private Private(BufferView & bv): wh_(0), cursor_(bv), anchor_pit_(0), anchor_ypos_(0), inlineCompletionUniqueChars_(0), - last_inset_(0), gui_(0) + last_inset_(0), editLastParCache_(0), gui_(0) {} /// @@ -261,6 +261,9 @@ struct BufferView::Private */ Inset * last_inset_; + // id of the paragraph which was edited the last time + int editLastParCache_; + mutable TextMetricsCache text_metrics_; /// Whom to notify. @@ -670,6 +673,16 @@ CursorStatus BufferView::cursorStatus(DocIterator const & dit) const } +void BufferView::editBookmarkSave() +{ + // Don't eat cpu time for each keystroke + if (d->cursor_.paragraph().id() == d->editLastParCache_) + return; + saveBookmark(0); + d->editLastParCache_ = d->cursor_.paragraph().id(); +} + + void BufferView::saveBookmark(unsigned int idx) { // tentatively save bookmark, id and pos will be used to diff --git a/src/BufferView.h b/src/BufferView.h index d13d7d9..a8c5c25 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -289,6 +289,8 @@ public: void insertPlaintextFile(support::FileName const & f, bool asParagraph); /// void insertLyXFile(support::FileName const & f); + /// save temporary bookmark for jump back navigation + void editBookmarkSave(); private: /// noncopyable diff --git a/src/Text3.cpp b/src/Text3.cpp index c4373d5..6db6a77 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1385,6 +1385,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) cur.resetAnchor(); moveCursor(cur, false); + bv->editBookmarkSave(); break; }