Commit Graph

481 Commits

Author SHA1 Message Date
Guillaume MM
1ac48c7cba Simplify before clean-up before following bugfix 2017-05-13 16:12:25 +02:00
Günter Milde
f5ac0580ff special character "allowbreak" (ZWSP), fileformat change
New special character to mark an optional line break
without inserting a hyphen (ZWSP). See #10585.

Corresponds to the Unicode character U+200B ZERO WIDTH SPACE

 This isn't a “space”. It is an invisible character that can be used
 to provide line break opportunities.
 ​http://unicode.org/notes/tn27/

While the literal Unicode character can be used in the LyX
file, it is invisible in the GUI.

For visible feedback, the patch adds a new special character "allowbreak".

The small mark is inspired by LibereOffice.
A tooltip is added.
2017-04-20 23:28:48 +02:00
Jean-Marc Lasgouttes
01f0ab64a7 Revert "When selecting text with the mouse, inset selection happens in the middle"
This reverts commit eb4a2a190f.
2017-04-06 15:17:00 +02:00
Uwe Stöhr
e575e7eebd Add support to cross out characters
- adds support for the command \xout of the LateX package ulem
- fileformat change
2017-04-05 00:01:19 +02:00
Guillaume Munch
eb4a2a190f When selecting text with the mouse, inset selection happens in the middle 2017-02-18 23:03:53 +01:00
Guillaume Munch
71623b88b2 Generalise the deletion protection mechanism from math to text (#9540)
Now backspace and delete in text will select non-empty math and text insets
before deleting them. This is consistent with what happens in math already.

This is implemented for InsetText as well but can be disabled in case of
negative feedback.

This can be set for any sort of inset with the new virtual method
Inset::confirmDeletion.

New option "force" for the LFUN_*_DELETE_* commands, that bypasses the
confirmDeletion check.
2017-02-18 23:03:23 +01:00
Juergen Spitzmueller
3522782c44 Fix two hyperlink-insert problems
1. Do not prematurely cut selection (#10306); patch proposed by Daniel Ramöller
2. Obey lfun argument, even if there is a selection
2016-12-29 09:17:53 +01:00
Juergen Spitzmueller
c0000cc405 Improve quotation mark opening/closing guess
Fixes: #8831

This introduces
* a new inset member isPartOfTextSequence() that returns
whether the inset produces something visible at the current position
in the text flow
* an isOpenPunctuation() test that returns whether a character is in the
'Punctuation, Open' unicode class. This is used instead of just checking
for two (Western, ASCII) opening brackets

It also fixes the isChar() and isLetter() value of InsetSpecialChar,
since some types have not been assigned correctly.
2016-12-27 12:06:54 +01:00
Juergen Spitzmueller
237193f8a8 Some new quote styles
* b    `british'    (``inner quotation'')
* w    >>swedishg>> ('inner quotation')   ["g" = Guillemets]
* f    <<french>>   (``inner quotation'')
* i    <<frenchin>> (<<inner quotation>>) ["in" = Imprimerie Nationale]
* r    <<russian>>  (,,inner quotation``)

Rename "french" to "swiss"

Also rename "single/double" to "secondary/primary" ("inner/outer" in
the UI) and "left/right" to "opening/closing". Note that the inset
identifier string is left as is ("s/d" and "l/r")
2016-12-24 14:27:00 +01:00
Juergen Spitzmueller
2e255b1c4f Restructure InsetQuotes for better extensibilty
The current char-based implementation gets increasingly unreadable,
especially if styles are added that do not follow the strict
single-double paradigm.
2016-12-24 10:13:51 +01:00
Juergen Spitzmueller
cce4639b55 Rename some quote-related params
Quote Language -> Quote Style
Quote Times-> Quote Level

No change in functionality.
2016-12-20 17:55:43 +01:00
Juergen Spitzmueller
7bf6d2b9ce Extend quote-insert
Two more optional arguments to specify side and quote style.
GUI support follows.
2016-12-16 11:23:22 +01:00
Juergen Spitzmueller
e8c932ff84 Enable InsetQuote in verbatim and Hebrew
In this context, the inset outputs straight quotes in LaTeX.

File format change.

Fixes: #7309
2016-12-10 11:53:42 +01:00
Jean-Marc Lasgouttes
fb264663d8 Make insertInset use a temporary cut-and-paste area.
This is a long wanted feature, although it does not go all the way to
fix #6604 (private-cut/private-paste).

Additionally, it fixes a crash that can happen when using undefined
branches. This is done by making the action when pasting unknown
branches configurable.

Fixes bug #6570.
2016-11-09 15:28:11 +01:00
Jean-Marc Lasgouttes
b162bd6d2b When breaking an empty paragraph reduces depth, set layout too
This requires an adaptation of the Separator inset insertion code,
which has been duly provided by Enrico.
2016-10-20 14:38:12 +02:00
Jean-Marc Lasgouttes
68d825fed8 Amend b583fb26e8
It failed in the case where a selection already existed (the anchor would be wrongly reset).
2016-08-29 12:03:33 +02:00
Jean-Marc Lasgouttes
b583fb26e8 Reset anchor before selecting with S-button1 2016-08-23 12:22:35 +02:00
Richard Heck
4b64aaf4ce This patch does two closely related things.
The main thing it does is integrate mouse-modifiers into the
FuncRequest machinery. Previously, these had to be passed
separately, which led to some ugly function signatures.

There was also an unnecessary form of the constructor, which
can now be removed.

No change of behavior is intended.
2016-06-27 18:16:35 -04:00
Georg Baum
14fa2c7162 Remove using directives from headers
The only exceptions are:

- The purpose of the header is to drag in the used symbol, e.g. unique_ptr.h
- The used symbol is inside a class or a namespace other than lyx

The reason for this is that global 'using' statements effectively forbid to
use the used symbols in any other namespace in the whole program, since simply
adding or removing an #include of the corresponding header subtly changes the
name lookup. The namespace lyx is sort of global, so it should not have these
statements either.
2016-06-26 18:22:59 +02:00
Jean-Marc Lasgouttes
ccc8ad4744 Cleanup handling of LFUN_LAYOUT_PARAGRAPH in getStatus
The way it works is:
* the inset defines allowParagraphCustomization() correctly
* Text::getStatus acts on it.

Note that, in Text::getStatus, testing for cur.inset().allowParagraphCustomization() does not make much sense, since one should pass the cursor idx as parameter. Actually, for some reason the safest bet is to use the owner of the Text object as inset.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
0d21dca360 Cleanup handling of LFUN_LAYOUT in getStatus
The way it works is:
* the inset defines forcePlainLayout() correctly
* Text::getStatus acts on it.

Note that, in Text::getStatus, testing for cur.inset().forcePlainLayout() does not make much sense, since one should pass the cursor idx as parameter.

There are many other lfuns that do not have to be handled directly by insets. InsetScript in particular has tests for way too many lfuns.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
83d8e12cc1 Rename Cursor::setSelection(bool) to selection(bool)
The old name would be confusing wrt setSelection(), which does additional checks.
This one is a pure acessor, and the more complete methods are
* setSelection(), which avoids empty selections
* clearSelection(), which resets anchor, and sets word selection and mark more to false.

Most of the code should use these two instead of selection(bool), but this is for later.
2016-05-29 17:55:46 -04:00
Richard Heck
0e1834f2d9 Updates to splitting of consecutive environments.
From Enrico.
2016-05-28 17:43:01 -04:00
Jean-Marc Lasgouttes
fd1ee3b424 Rename Caption:LongTableNoNumber to Caption:Unnumbered
The term LongTable has been deprecated and moreover the renaming makes the interface easier to the eye.

File format updated to 507. (conversion based on jamatos patch)
Layout format updated to 60.
tex2ylx tests updated.
Document EmbeddedObjects.lyx has been updated.
2016-03-30 16:07:00 +02:00
Enrico Forestieri
5c891242f3 Don't merge next paragraph when removing a separator inset 2016-01-16 16:44:26 +01:00
Enrico Forestieri
1c3b6807db Insert a plain separator instead of a parbreak one.
When hitting Enter after a non-standard layout a plain separator is
now inserted. This seems to be preferred and more in line with what
is obtained with the "Alt+M P" shortcut.
2016-01-14 20:57:52 +01:00
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