Commit Graph

455 Commits

Author SHA1 Message Date
Enrico Forestieri
a8ab3379d9 Insert a separator only when the paragraph is empty. 2016-01-13 22:49:33 +01:00
Stephan Witt
7e72c1d0d3 Call lyx::next and lyx::prev explicitely. In case libc++ provides
std::next even when not in C++11 mode this is necessary. E.g. with
clang from Xcode7 on Mac OS X.
2016-01-10 18:06:15 +01:00
Enrico Forestieri
c8aaaff15a Avoid inserting multiple consecutive parbreak separators. 2016-01-10 00:05:24 +01:00
Jean-Marc Lasgouttes
0f5886b856 Disable LFUN_LAYOUT when layout cannot be found
Fixes bug #8077
2015-11-17 08:48:55 +01:00
Jean-Marc Lasgouttes
f6c6416f28 Remove PainterInfo argument to checkCursorScrollOffset
This will allow later to move its invokation to processUpdateFlags.

Also, remove wrong use of Update::SinglePar flag.
2015-10-05 18:09:34 +02:00
Guillaume Munch
61145265fc Math commands used in text mode now always use the current selection as contents
(#9762)

* fixes a bug where this was already the expected behaviour of
  math-subscript and math-superscript but failed.

* corrects the behaviour where if there is \newcommand in the
  selection, then a corresponding macro template is introduced
  instead of a math inset.

  * fixes a bug where math-display, math-subscript and math-supscript
    would also introduce such a macro template in a way unrelated to
    their function. Now it only happens with math-mode without
    arguments.

  * fixes a bug where a text that does not denote a macro definition,
    e.g. "aaa\newcommandaaa", would produce \invalidmacro.
2015-09-14 00:33:02 +01:00
Günter Milde
fb3bb6361c New lfun "accent-perispomeni".
This function inserts a COMBINING GREEK PERISPOMENI character that is
normalized to pre-composed characters for base characters where a 
corresponding WITH PERISPOMENI character exists.

This is a partial solution for Ticket #6463.
2015-08-26 22:43:38 +02:00
Jean-Marc Lasgouttes
2b760212e2 Reset properly the cursor font when leaving an inset to the left
There was a missing setCursorFont there.

Fixes bug #6032.
2015-07-21 11:50:36 +02:00
Stephan Witt
d16a95afe7 #9496 add a check for requested thesaurus files if thesaurusdir_path of lyxrc is empty
This path configuration variable is used for user defined location.
There are other possible places for the thesauri like mythes installers or bundled with LyX.
2015-07-16 22:07:25 +02:00
Stephan Witt
7d420669e6 #9496 factor out getting language from LFUN args or cursor position in speller LFUNs 2015-07-16 21:59:15 +02:00
Jean-Marc Lasgouttes
96692bdbb0 Move some functions out of Bidi.*
The functions reverseDirectionNeeded() and reverseDirectionNeeded() do
not rely on the Bidi class. The first one is changed into a Cursor
method, and the second one is replaced with explicit code.
2015-07-16 11:57:40 +02:00
Enrico Forestieri
8f169aa23d Properly fix #9602.
Other than checking that we are at the beginning of a paragraph,
we must also check that this is not the first paragraph before
triggering the code that removes the inset separator. This accounts
for the case that we are dissolving an inset from the inside.
Without this additonal check the old code was fooled into thinking
that the separator should have been removed.
2015-06-08 00:41:36 +02:00
Enrico Forestieri
541984e43e Revert 6bd9f885
Sorry, I was wrong. That code is still needed.
Proper fix for #9602 is on its way.
2015-06-08 00:38:10 +02:00
Enrico Forestieri
6bd9f8856f Fix bug #9602.
The removed code was introduced at [c668ebf6/lyxgit] to assure that
an inset separator in the last position of a paragraph was getting
removed when hitting backspace with the cursor at the beginning of
the next paragraph. Apparently, it is not needed anymore and can
be removed. This avoids the reported assertion.
2015-06-07 23:26:57 +02:00
Scott Kostyshak
580947bfe0 Revert "Update previews after pasting (#6211)"
As JMarc notes on the ML, the referenced commit modifies a full
buffer just in the middle of a dispatch action.

Further, this commit lead to an assertion [1], although it is not
clear to me whether the root cause of the assertion is the commit
that is being reverted here, or one of the issues we have with
previews and macros.

This reverts commit 73460423ad.

[1] http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg187921.html
2015-06-07 12:14:00 -04:00
Jean-Marc Lasgouttes
0db513c4d6 Make case-changing lfuns operate on full words by default
This is for people who cannot grasp the superior conventions of emacs ;)

A new argument "partial" has been added to word-upcase, word-lowcase
and word-capitalize that restores the old emacs-like behavior.

The (x)emacs bindings are updated to use the "partial" argument, and
also to bind correctly M-u and M-l (M-c is unfortunately not
available).

Fixes bug #2826.
2015-06-03 09:30:28 +02:00
Juergen Spitzmueller
6501bb0904 Do AutoInsert of item arguments also on paragraph break. 2015-05-28 09:46:40 +02:00
Juergen Spitzmueller
977bbd9bc3 Add InsertCotext tag also to InsetLayout argument (part of #4745) 2015-05-21 08:53:56 +02:00
Jean-Marc Lasgouttes
3176ac365c remove bogus comment
There used to be a showCursor call below the command, sometimes between 2002 and 2007.
2015-05-20 11:24:15 +02:00
Georg Baum
b596330093 Fix compilation with boost 1.58
Newer boost versions use complicated type traits for boost::next and
boost::prior, which do not work with the RandomAccessList iterators.
The long term solution is to use std::next and std::prev, for now supply
simple replacements for compilers that do not support C++11 yet.
2015-05-16 00:05:23 +02:00
Scott Kostyshak
c12dc2feef Fix pasting of PDF from clipboard
The command "paste pdf" was always disabled because the
condition in the following "if" statement always returns false

  if (arg == "pdf" && (type = Clipboard::PdfGraphicsType))

The value of "type" is zero in this case because PdfGraphicsType is
the first enum value (and it is not set explicitly to non-zero).

An alternative patch is to put AnyGraphicsType as the first
element of enum GraphicsType, or to set the first element to a
number greater than 0.

To test the bug that this commit fixes, either copy a PDF and try to
paste with the action "paste pdf", or click on the "Edit" menu and
notice (before this commit) the terminal output "Unrecognized
graphics type: pdf".
2015-05-09 20:46:43 -04:00
Juergen Spitzmueller
760b7cf2b6 Add option to Argument to let it be inserted with a copy of the co-text.
This is useful for classic "Short Titles", where one might want to start
with the full title in the inset.

Addresses: #4745
2015-05-09 12:17:24 +02:00
Scott Kostyshak
02cb5fd374 Assert if unknown argument to internal paste 2015-04-22 19:38:21 -04:00
Scott Kostyshak
73460423ad Update previews after pasting (#6211)
The reason we want to do this is for if there is pasting across buffers.
For within buffer, the previews should already be updated. Calling the
buffer-wide updatePreviews() might seem like overkill, but actually it
should be quick because only the previews that need updating are updated
(and this check feels quick to me, although I did not profile).

If we were to loop through the pasted text and update each preview
individually, this might take more time. When updating previews
together, only one .tex file is compiled.
2015-04-21 02:51:54 -04:00
Juergen Spitzmueller
6fe3dc01e0 Issue a warning if thesaurus dir is not set up (as suggested in #9496) 2015-04-12 15:55:01 +02:00
Scott Kostyshak
032da815fa Fix selection at borders of insets (#9487)
When at the last position in an inset, selecting to the right
should select the entire inset. This only worked if there was
already a selection (i.e. the selection was started not at the
boundary).

The behavior of this bug was changed by commit 73a7bf9d.  Before
that commit, if at the last position of an inset you select to
the right, nothing is selected but the selection is set. If you
select once more to the right, because the selection is set the
needsUpdate condition is satisfied so the whole inset is selected.

Note that everything here applies also to "first position of an
inset" and selecting to the left. By "selecting", I am referring
to LFUN_{CHAR,WORD}_{FORWARD,BACKWARD}_SELECT.
2015-04-03 14:24:28 -04:00
Jean-Marc Lasgouttes
11ca140667 Clean-up the undo API
* Remove the UndoKind parameter in the general interface
* move recordUndoInset to Cursor
* remove one variant of Undo::recordUndo.
* get rid of Text::recUndo.
2015-04-01 14:18:23 +02:00
Jean-Marc Lasgouttes
67ff68bd02 Improve the check for multiple paragraphs in Text::insertStringAsLine.
Rely only on InsetText::allowMultipar() to get this information.

Implement this method for InsetTabular and InsetBox.

Also rely on this method for disabling LFUN_PARAGRAPH_BREAK.
2015-03-31 14:07:45 +02:00
Stephan Witt
73242e0052 #9477 improved argument handling for LFUN_SPELLING_ADD,LFUN_SPELLING_IGNORE and LFUN_SPELLING_REMOVE 2015-03-27 08:07:05 +01:00
Jean-Marc Lasgouttes
ba0b847040 Toggle properly toolbar icons that set layout of a paragraph.
Fixes bug #9463.
2015-03-17 16:40:55 +01:00
Georg Baum
3e9e6e344a Replace automatic logofication with insets
Previously, LyX did replace some words with typeset logos, and there was no
way to prvent this except putting them, in ERT (bug #4752). Now we have
special insets for these words, and standard text is left alone.
2015-03-01 11:16:57 +01:00
Richard Heck
db954b5dc0 Add comment, so that does not happen again. 2015-02-24 20:07:32 -05:00
Richard Heck
94a5481a17 Partially revert b627b870, which broke cursor movement. 2015-02-24 20:04:59 -05:00
Jean-Marc Lasgouttes
b627b8701b Some performance stuff reported by cppcheck 2015-02-24 18:38:20 +01:00
Uwe Stöhr
4a8881c60a text3.cpp: adapt a possible fix to current code 2015-02-15 01:04:41 +01:00
Juergen Spitzmueller
d48e5330be Add pref option to disable middle-mouse-button paste
Fixes: #9399
2015-02-08 17:41:28 +01:00
Richard Heck
935646bf91 Cleanup of outliner moving code. 2015-01-03 11:33:11 -05:00
Jean-Marc Lasgouttes
38f8858671 Fix warnings reported by clang
All these problems have the same root: the address of a reference can never be 0, and it does not make sense to test it.
2014-11-27 19:10:43 +01:00
Jean-Marc Lasgouttes
e52a385493 Reimplement inset-select-all in a generic way
There are 3 possible actions (in order)
* select current cell
* select all calls of inset
* select the inset from outside (in the containing inset)

This fixes completely #7727.
2014-11-01 16:54:23 +01:00
brokenclock
11e679f73e Add LFUN_SERVER_GET_STATISTICS command
This function can be used with the LyX server to obtain the word, character or character+space count in the current document or selection.
2014-10-23 16:06:42 +02:00
Scott Kostyshak
bcbc162665 Select word on double click even when at boundary
Now when double clicking on a boundary of a word, the
word is selected. This also causes single-letter words
to now be selected (fixes #9159).
2014-06-13 10:48:49 -04:00
Scott Kostyshak
4cfc110d4a Combine OutlineIn and OutlineOut blocks
They differ only by adding/subtracting 1.
2014-06-08 03:33:32 -04:00
Enrico Forestieri
d4c21b42dd Allow inserting a blank line also after a nested environment. 2014-05-26 21:29:33 +02:00
Enrico Forestieri
02e7bc18a7 Simplify the test for inserting a parbreak separator.
Instead of simply taking into account the layout of the previous
paragraph, it is better considering the layout of the environment
in which the previous paragraph may be nested. This makes the test
simpler and, at the same time, more robust.
2014-05-22 21:47:10 +02:00
Enrico Forestieri
52ebcd6280 Correct the check for a command. 2014-05-22 11:51:21 +02:00
Enrico Forestieri
2c613d5686 Fix potential crash.
Use the lfun for breaking the paragraph here, such that the metrics
are updated before the call to the next dispatch.
2014-05-22 11:41:23 +02:00
Enrico Forestieri
10d5897327 Don't allow inserting two consecutive separators. 2014-05-18 18:04:53 +02:00
Enrico Forestieri
0616c8fe32 Disregard font properties changes when inserting a separator.
This allows to output a simple blank line instead of strange constructs.
2014-05-18 17:34:11 +02:00
Enrico Forestieri
a919cd8c68 Take into account that a blank line is always output before a command. 2014-05-18 17:31:58 +02:00
Enrico Forestieri
c668ebf611 Fix bugs #8546 and #9055, and introduce new separator inset.
The algorithm used for breaking a paragraph in LaTeX export is changed
for avoiding spurious blank lines causing too much vertical space.
This change is tied to the introduction of a new inset (with two
different specializations) helping in either outputing LaTeX paragraph
breaks or separating environments in LyX. Both of the above goals were
previously achieved by the ---Separator--- layout and can now be
accomplished by the new inset in a more natural way. As an example,
after leaving an environment by hitting the Return key for two times,
a third return automatically inserts a parbreak inset, which is
equivalent to the old separator layout, i.e., it also introduces a
blank line in the output. If this blank line is not wanted, the
parbreak separator can be changed to a plain separator by a right
click of the mouse. Of course, an environment can still be separated
by the following one by using the Alt+P+Return shortcut (or the
corresponding menu key), but now the plain separator inset is used
instead of the old separator layout, such that no blank line occurs in
the LaTeX output.

Old documents are converted such that the LaTeX output remains unchanged.
As a result of this conversion, the old separator layout is replaced by
the new parbreak inset, which may also appear in places where the old
algorithm was introducing blank lines while the new one is not.
Note that not all blank lines were actually affecting the LaTeX output,
because a blank line is simply ignored by the TeX engine when it occurs
in the so called "vertical mode" (e.g., after an alignment environment).
The old ---Separator--- layout is now gone and old layout files using it
are also automatically converted.

Round trip conversions between old and new format should leave a document
unchanged. This means that the new behavior about paragraph breaking is
not "carried back" to the old format. Indeed, this would need introducing
special LaTeX commands in ERT that would accumulate in roundtrip
conversions, horribly cluttering the document. So, when converting a
modified document to old formats, the LaTeX output may slightly differ in
vertical spacing if the document is processed by an old version of LyX.
In other words, forward compatibility is guaranteed, but not backwards.
2014-05-10 23:25:11 +02:00