Commit Graph

237 Commits

Author SHA1 Message Date
Vincent van Ravesteijn
88eae06611 Fix FontIterator to not access pos >= par.size()
An iterator is typicall incremented passed the valid data into the 'end'
state. However, if this means that other functions are called with invalid
parameter, we should fix this.

This explains why fontSpan was called with pos==size() while this was not
expected to happen.

This patch reverts partly f5ad0c128a (Jean-Marc Lasgouttes; Get rid of
annoying warning message).
2013-04-28 19:12:16 +02:00
Richard Heck
d79225ae98 Remove all messages to user related to assertions. We'll just use
a basic message which is defined in lassert.cpp now.
2013-04-27 17:52:55 -04:00
Richard Heck
1b1f8dd235 Audit all the LASSERT calls, and try to do something sensible at
each failure.

There are several places I was not sure what to do. These are marked
by comments beginning "LASSERT:" so they can be found easily. At the
moment, they are at:

Author.cpp:105: // LASSERT: What should we do here?
Author.cpp:121: // LASSERT: What should we do here?
Buffer.cpp:4525:        // LASSERT: Is it safe to continue here, or should we just return?
Cursor.cpp:345:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:403:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:1143:                // LASSERT: There have been several bugs around this code, that seem
CursorSlice.cpp:83:     // LASSERT: This should only ever be called from an InsetMath.
CursorSlice.cpp:92:     // LASSERT: This should only ever be called from an InsetMath.
LayoutFile.cpp:303:                     // LASSERT: Why would this fail?
Text.cpp:995:           // LASSERT: Is it safe to continue here?
2013-04-25 17:27:10 -04:00
Richard Heck
f6fceea317 Const. 2013-04-11 15:56:41 -04:00
Richard Heck
e7827264e7 Eliminate the hard-coded special handing of chapters. We'll use the
new Above LabelType instead.
2013-02-09 13:44:06 -05:00
Richard Heck
32b0e8cbdb Change LabelType Top_Environment to LabelType Above, and LabelType
Centered_Top_Environment to LabelType Centered.
2013-02-09 13:44:06 -05:00
Jean-Marc Lasgouttes
c999e35e54 Make sure that undo is recorded when magic tricks are played with InsetBibitem.
Fixes bug #7111: Assertion with undo and InsetBibitem

  * add Paragraph::brokenBiblio(), with tells whether there is something to fix.
  * rename Paragraph::checkBiblio to fixBiblio; simplify it greatly by using
    InsetList methods
  * In TextMetrics::redoParagraph, call recordUndo before fixBiblio (only when
    there is something to fix obviously)

Special care is taken to update cursor only when it makes sense. Note
that there are cases where undo information is not recorded (current
cursor not in the slice where action happens)
2012-07-18 15:36:58 +02:00
Jean-Marc Lasgouttes
a756403301 "Performance" fixes suggested by cppcheck
While cppcheck did not turn out any suspicious error messages, using
the "performance" flag highlighted several nitpicks in three categories
 * do not use it++ for iterators, ++it is better
 * do not use size() to test for emptyness, empty() is here
 * do not use "const T" as a function parameter, "const & T" is better

I doubt that any of these is a real performance problem, but the code is cleaner anyway.
2012-05-28 22:42:44 +02:00
Lars Gullik Bjønnes
fb3ecca01c TextMetrics.cpp: comment out addressBreakPoint function
Only user of this function is code that has been commented out, comment
out this function as well.

Signed-off-by: Lars Gullik Bjønnes <larsbj@gullik.org>
2012-05-20 11:08:20 +02:00
Vincent van Ravesteijn
6df750aa18 TextMetrics::leftMargin(): Explain why the disabled code is wrong 2012-05-10 10:46:35 +02:00
Vincent van Ravesteijn
92ac678715 Fix bug #8152: Uneditable long rows for 'Right addresses'
As long as leftMargin() is not correctly implemented for
MARGIN_RIGHT_ADDRESS_BOX, we should also not do this here. Otherwise, long
rows will be painted off the screen and will not be editable.
2012-05-10 10:46:32 +02:00
Vincent van Ravesteijn
225bcf92df Indicate that this rtl variable is only valid on the last row
Otherwise the variable might be used incorrectly as in [0a137e31/lyxgit].
2012-04-29 22:49:30 +02:00
Vincent van Ravesteijn
d7f68078cf Fix bug #7518: Assert when selecting in RTL text
If we are in rtl text, we *need* to check whether the first character is a
space. We can't use the rtl variable for this because this is only
computed on the last row.

This bug was introduced in [0a137e31/lyxgit] to fix the computation for
freespacing paragraphs. We better can just check whether the paragraph is
freespacing or not.
2012-04-29 22:47:06 +02:00
Richard Heck
5a7672adec Fix bug #5805 and similar requests. Adds a document setting that
tells LyX not to show BLOCK text as justified, but still keeps
the usual paragraph indentation.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40427 a592a061-630c-0410-9148-cb99ea01b6c8
2011-12-07 22:33:25 +00:00
Richard Heck
88cdfb0d42 Fix bugs #7110 and #7160 by reverting r36521.
This was an attempt to fix #2743 without re-working the InsetBibitem
mess. It didn't work, so we have to do that.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38702 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-11 12:44:39 +00:00
Richard Heck
5f1d31bf16 Just whitespace and a comment.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38485 a592a061-630c-0410-9148-cb99ea01b6c8
2011-04-25 01:46:37 +00:00
Abdelrazak Younes
8d06c1ebda TextMetrics::editXY(): don't continue executing code when asserting.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37915 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-13 16:38:36 +00:00
Abdelrazak Younes
076151f508 Trying to fix #7321: add some assertions.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37914 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-13 16:26:57 +00:00
Jean-Marc Lasgouttes
53e8746b47 In the case of non-null paragraph separation, replace the hardcoded test for ERT and LISTINGS insets by proper check for newLineIsParBreak.
This fixes the display of sweave Chunks in sweave.lyx example, which uses parskip instead of indent.

The rest of the changes are just white space


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37881 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-08 14:41:01 +00:00
Georg Baum
f176a18434 Fix bug #6919 by splitting Inset::noFontChange() into inheritFont() and
resetFontEdit(). The former is used for on-screen and export formatting,
and the latter is used for interactive editing.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37761 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-22 19:41:04 +00:00
Richard Heck
13126b8060 Fix bug #6302: Allow setting of on-screen paragraph indentation when
alignment is LEFT.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37642 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-14 00:58:44 +00:00
Vincent van Ravesteijn
8e6e9d3782 Add comment.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37621 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-13 09:49:50 +00:00
Richard Heck
c981018111 Fix bug #2743.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36521 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-26 17:30:45 +00:00
Vincent van Ravesteijn
2b44b0ef4d Move TextMetrics::drawRowSelection to RowPainter::paintSelection(). RowPainter knows about a possible offset in the y-coordinate, while drawSelection uses the cached value. Instead of adding another parameter to TextMetrics::drawRowSelection, we can as weel move it to RowPainter and lose all parameters at all.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36485 a592a061-630c-0410-9148-cb99ea01b6c8
2010-11-25 13:16:30 +00:00
Stephan Witt
dec437fbac add cache of spell checker results to speed up native speller engine on macosx
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35362 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-14 05:24:04 +00:00
Jean-Marc Lasgouttes
402b9ec199 Revert r35339 for now following Enrico criticisms. I'll come back to it later.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35356 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-13 13:16:49 +00:00
Jean-Marc Lasgouttes
2a7a076f1a Make lines more compact (less interline spacing).
If there are use cases where this is useful, we can
think of a better way to reintroduce this.

Comments welcome.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35339 a592a061-630c-0410-9148-cb99ea01b6c8
2010-09-10 10:46:14 +00:00
Uwe Stöhr
7d68833dc9 remove unused include of FuncRequest
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35189 a592a061-630c-0410-9148-cb99ea01b6c8
2010-08-24 03:07:09 +00:00
Richard Heck
5577e877bb Try to move all updateBuffer() calls to a central location. We now use
DispatchResult to store a flag that tells us whether we need a buffer
update or not. 

So: If you find a missing one, go to an appropriate place in the
dispatch and call cur.forceBufferUpdate() or, if you don't have a cursor
but do have a DispatchResult, call dr.forceBufferUpdate().

There is one remaining call I could not move, in
TextMetrics::redoParagraph. But this looks like an emergency call when
the macro context has not been set. There are also a couple calls that
are connected with buffer creation that I commented out, since the same
call is done again almost immediately. But I'm not positive about those.

Now the nice thing would be to do the same for updateMacros().


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34826 a592a061-630c-0410-9148-cb99ea01b6c8
2010-07-09 14:37:00 +00:00
Jürgen Spitzmüller
0a137e315a * TextMetrics.cpp: fix metrics calculation with preceeding blank in free spacing context (bug #6746)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34705 a592a061-630c-0410-9148-cb99ea01b6c8
2010-06-25 14:07:55 +00:00
Vincent van Ravesteijn
863e1eb35b * TextMetrics.cpp: Line length.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34372 a592a061-630c-0410-9148-cb99ea01b6c8
2010-05-05 16:23:11 +00:00
Vincent van Ravesteijn
63d24ca3c4 Remove boundary parameter from BufferView::getPos(). The first DocIterator parameter already contains this information.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34247 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-21 13:03:04 +00:00
Vincent van Ravesteijn
d8db0e8515 Rename anchor() to normalAnchor() as the anchor() function was already returning a normalized anchor in stead of the real one.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34145 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-15 17:49:15 +00:00
Richard Heck
bd3f2308b4 Style, I guess.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33876 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-26 17:00:07 +00:00
Richard Heck
25df3fa83d Defer calculations we may not have to do.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33802 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-19 15:07:52 +00:00
Richard Heck
32faa2a273 Simplify a bit, after last commit.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33798 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-19 01:46:13 +00:00
Richard Heck
4d0d67872e Fix at least the most immediate manifestation of bug #6454.
Investigation of this bug revealed that we are blinking the cursor even
when it is not visible. This should also be reverted. It may, in a way,
be that bug that caused this one, but this check is worth doing anyway.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33797 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-19 01:43:53 +00:00
Vincent van Ravesteijn
ff7526a3ed No camelBump style for local variables.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33719 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-11 19:50:04 +00:00
Vincent van Ravesteijn
c5f556e43a Remove unused function.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33718 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-11 19:48:49 +00:00
Richard Heck
d65020b293 s/updateLabels/updateBuffer/g, per a suggestion of Abdel's.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33613 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-03 22:13:45 +00:00
Jürgen Spitzmüller
425d092204 * fix spelling in comments to please John.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33262 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-29 14:44:21 +00:00
Vincent van Ravesteijn
99a9d3dd69 Simplify code.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32413 a592a061-630c-0410-9148-cb99ea01b6c8
2009-12-07 19:06:15 +00:00
Vincent van Ravesteijn
5b7a7cca73 Fix bug #6113: Customized font color in footnote is not rendered in LyX.
It seems we realized the font in the wrong order. If the layout font specifies "Font Size Small", we should be able to make it large if we want to.

see:
http://thread.gmane.org/gmane.editors.lyx.devel/122682

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32129 a592a061-630c-0410-9148-cb99ea01b6c8
2009-11-21 15:33:41 +00:00
Vincent van Ravesteijn
3852f3298f * TextMetrics.cpp: cosmetics.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32117 a592a061-630c-0410-9148-cb99ea01b6c8
2009-11-21 01:15:12 +00:00
Vincent van Ravesteijn
08feb0e14c Fix bug #6161: Wrong cursor position in bidi text.
If the first character is a separator, we are in RTL text. This character will not be painted on screen and thus we should not count it and skip to the next.

This bug pretty much destroyed cursor placement in RTL text on a row with large gaps.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32116 a592a061-630c-0410-9148-cb99ea01b6c8
2009-11-20 22:28:51 +00:00
Vincent van Ravesteijn
3581c31d1b Allow PgUp and PgDwn to put the cursor on the first or last row.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32036 a592a061-630c-0410-9148-cb99ea01b6c8
2009-11-15 23:53:40 +00:00
Vincent van Ravesteijn
a9ae2abb7e Fix bug #6327: Crash in new file and press PgUp button.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32035 a592a061-630c-0410-9148-cb99ea01b6c8
2009-11-15 23:45:39 +00:00
Abdelrazak Younes
ff4460603e Make Buffer argument mandatory in most of the InsetMath based class... boring work...
Math manual loads and save correctly it seems but expect some instability period.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31898 a592a061-630c-0410-9148-cb99ea01b6c8
2009-11-08 11:45:46 +00:00
Vincent van Ravesteijn
d833a023f6 Add a FIXME to a piece of unreachable code. This dates back to r8251.
see http://www.lyx.org/trac/changeset/8251.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31858 a592a061-630c-0410-9148-cb99ea01b6c8
2009-11-04 15:30:35 +00:00
Vincent van Ravesteijn
e666039283 Only paint the paragraph end markers when a new paragraph follows. Otherwise, charstyle insets, for example, also get a paragraph end marker although they are just part of the paragraph.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31168 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-20 18:30:06 +00:00