Just recompute metrics instead of triggering a full redraw. The old
behavior was that, when the document was less that one page long, the
cursor would blink to the top of the document before going to its
correct position.
When the cursor is at the top, it is important to make sure that, not
only its row is visible, but also the extra margin at the beginning of
the document, that was added at 907f0207.
Fixes part of bug #12123.
This stores its argument, the currently selected text or the word under
cursor in the search cache that is used by word-find[-backward|-forward]
if no argument is given to those.
Prerequisite for a feature apparently expected on the Mac.
Following 4a4ded22, the enabling of some change-related functions is
handled in updateBuffer. However, this method is not ran at every
document change for performance reasons.
This patch adds code to every place that modifies
Paragraph::Private::changes_ that checks whether the `changedness' of
the paragraph, err... changes.
To this end, a new helper struct is introduced that remembers
paragraph state at contruction time, and compares it to new state in
the destructor.
New forceUpdate/needUpdate methods are added to Buffer class, since
the cursor is in general not available in the places where these
changes are made.
Fixes bug #12074.
It turns out that the code is the same in texted ans mathed and that
whatever is done in InsetTabular is not useful.
This means that we do not need to deal Text::dispatch idiosyncrasies
(in particular forcing the cursor to be visible).
Fix bug #11225.
The bookmarks are added as virtual elements in display Rows. Bookmarks
are shown with circled numbers. A new color "bookmarks" has been
added. Currently bookmark 0 (the return position) is not displayed
because it is very disturbing in practice.
To make this work, a new method BookmarksSection::bookmarksInPar
retuns the list of bookmarks in a paragraph along with their position.
Force redraw when using bookmark-save and bookmark-clear.
Fixes bug #2496.
The caret geometry is now computed in BufferView as a list of shapes
(caret, horizontal l-shape if needed, completion triangle if needed)
kept in a variable of type CaretGeometry.
The code in WorkArea.cpp only has to draw these shapes. The
CaretWidget (which never was a widget) in GuiWorkArea.cpp is gone
now.
As a consequence, the bounding box for the cursor is known precisely
and therefore rows should be repainted correctly now. This avoids
caret droppings.
Fixes bug #12024.
Try to find the most inner row that is overwritten by the caret. This
allows to replace the hack in TextMetrics::draw, which did not really
work.
Note that there are still issues with emphasized caret at the
beginning of inset, which will require some code reorganisation.
Fixes current recipe of bug #12024.
Intended changes:
* code is shorter and cleaner
* caret scales better with zoom when cursor_width=0: completion
indicator, l-shaped cursor...
Details:
* Rename BufferView::getPosAndHeight to getPosAndDim because ascent is
needed too and width could in the future be set depending on font.
* Get rid of rect_ in CaretWidget and record a Dimension (and y value) instead.
Remove also caret_width_ and slant_, replace rtl_ with dir.
* Make CaretWidget members public and lose the trailing _.
* change CaretWidget::update to read its parameters from current bufferview.
It did access par_metrics_[] directly because there was no non-const
parMetrics().
This patch adds one and unfriends BufferView. The code is equivalent
since in all these cases, the metrics have just been computed with
redoParagraph().
When running redoParagraph, it may happen that the ascent of the first
row changes. Since the ParagraphMetrics position is actually the
baseline of its first row, it may be necessary to update it.
Fixes bug #11601.
The 20px space on top and bottom of document have traditionally been
obtained by adding them to the ascent/descent of the first/last row.
This leads to annoyances like selections that are drawn in these
margins and issues with the nesting marker.
The change is to add the value to the ParagraphMetrics ascent/descent
only and to correct one place where the ascent of the first row may be
different from the ascent of the ParagraphMetrcs object. There may be
other places where this should be done.
Fixes bug #9545.
The 20px space on top and bottom of document have traditionally been
obtained by adding the to the ascent/descent of the first/last row.
This reads to annoyances like selections that are drawn in these
margins and issues with the nesting marker.
The change is to add the values to a separate member of the Row
object, and to add new Row::total(Ascent|Descent) methods that add the
effect of this padding.
Moreover, some methods are added to TextMetrics to simplify the
BufferView code.
Fixes bug #9545.