Commit Graph

511 Commits

Author SHA1 Message Date
Pavel Sanda
b7caaf6196 Proper naming of LFUN_SET_GRAPHICS_GROUP. 2018-02-08 21:59:41 +01:00
Juergen Spitzmueller
2f854bdf8c remove unnecessary braces 2018-01-20 10:39:18 +01:00
Juergen Spitzmueller
e57b245d0b Work around auto-bibitem insertion when separating bibliography environment
Manually delete bibitem insets in the separator line.

In the long term, such things should not happen at all.

Candidate for 2.3.x.
2018-01-13 15:12:10 +01:00
Juergen Spitzmueller
a09ceda2c4 Once more rework outline wrt environments.
* Fixes UNDO issues
* Takes care of some special cases

Signed-off-by: Juergen Spitzmueller <spitz@lyx.org>
2018-01-13 14:51:01 +01:00
Juergen Spitzmueller
bceaa7f929 Fix loop while separating
getMaxDepthAfter() gives wrong result here.

Fixes: #10979

Signed-off-by: Juergen Spitzmueller <spitz@lyx.org>
2018-01-13 09:59:09 +01:00
Juergen Spitzmueller
2ae51a9bb9 Complement the movement handling of environments
Make sure moved environments (such as frames) are separated from their
new neighbours in all directions.

This completes 07665d1dca
2018-01-12 10:44:01 +01:00
Juergen Spitzmueller
0fc14060b1 Amend 07665d1dca
We need to disable auto-nesting here.
2018-01-11 13:09:04 +01:00
Juergen Spitzmueller
07665d1dca Handle movement of environments better
Make sure moved environments (such as frames) are separated from their
new neighbours.
2018-01-11 10:48:47 +01:00
Jean-Marc Lasgouttes
806f40dbd4 Update buffer when an inset or an INFO inset has bee inserted
This is important for info inset, since if updateBuffer needs to be
run in redoParagraph (for the macro code), crashes can happen.

Fixes bug #10944.
2018-01-05 19:32:17 +01:00
Juergen Spitzmueller
32efb91438 Do note attempt to nest more than possible. 2018-01-04 18:38:08 +01:00
Juergen Spitzmueller
f965d23633 Disable useless environment-split function at the core. 2018-01-03 13:16:07 +01:00
Juergen Spitzmueller
99ae8d58c8 Another case where nesting needs to be preserved. 2017-12-31 14:43:45 +01:00
Juergen Spitzmueller
167c38377c Use real cursor pit, not the modified one. 2017-12-31 09:41:43 +01:00
Juergen Spitzmueller
857e70eb83 Maintain nesting when separating outer environment 2017-12-30 18:54:39 +01:00
Juergen Spitzmueller
5c704b5dd1 Revert "Fix environment-split when at pos 0 of a frame title."
This reverts commit 1ff34a973d.
2017-12-30 16:26:20 +01:00
Juergen Spitzmueller
1ff34a973d Fix environment-split when at pos 0 of a frame title.
This introduces a force argument to argument-insert that inserts
arguments even if they are already there. We need this here in order
to prevent DEPM.
2017-12-30 12:50:48 +01:00
Juergen Spitzmueller
27901b3a06 Fix environment-split previous problem spotted by Joel
Special case: append from the separator paragraph.
2017-12-30 11:54:37 +01:00
Richard Heck
60cb7a1683 Minor code simplification. 2017-12-29 16:00:58 -05:00
Juergen Spitzmueller
f3b89e4c72 Add IsAutoNestedBy
This is complementary to AutoNests: Styles can determine which other
style should auto-nest them. This is particularly useful for modules
that add new styles which should be auto-nested in a given context.
2017-12-29 10:36:03 +01:00
Juergen Spitzmueller
d6fb2abbea Some AutoNest polishment.
* Rename Nests to AutoNests
* Do it when changing from any style
2017-12-29 10:03:00 +01:00
Juergen Spitzmueller
99ecc6e2c9 Implement auto-nesting.
Now layouts can specify other layouts that should be nested in and
after the current one (if the layout is switched from the current one
and if it follows a paragraph in the current one).

This is particularly useful for things such as the beamer frames, where
particular layouts are practically always nested.
2017-12-28 17:44:54 +01:00
Juergen Spitzmueller
87a6c75d9d Introduce environment-split before
This one prepends the new environment rather than appending it.

Easy way to add a new beamer frame before the current one.
2017-12-28 14:17:40 +01:00
Juergen Spitzmueller
2907160fff Introduce environment-split previous
This one checks for an environment in the previous paragraph (outside
the nesting scope).
2017-12-28 12:28:01 +01:00
Jean-Marc Lasgouttes
34285cc683 Handle properly top/bottom of inset with mac-like cursor movement
The correct behavior is to go to position 0 going up from first row,
and to end of row when going down on last row.

The targetx value of the cursor is not updated, which makes cursor
movement more natural.

Fixes bug #10701.
2017-11-23 15:52:08 +01:00
Juergen Spitzmueller
c466baaa5b Collapsable -> Collapsible (part 2)
The current spelling is not strictly wrong, but flagged as unusual or
historical by some authorities. It is also found fault with many
spell checkers. Thus we decided to move to the more standard "-ible"
form once and for all.

See #10678 for discussion

This part covers the most tricky part: the internal naming.
Translations and layouts will follow.

This will all also all be backported to 2.3.x, for the sake of backwards
compatibility (cherry-picking).
2017-10-16 10:12:21 +02:00
Jean-Marc Lasgouttes
88d0390724 Do not forget to set cursor current font when selecting
Fix several unreleated cases where the `selecting' code path did not
reset cursor font correctly. This leads to a caret that does not have
the correct size, and can cause caret droppings with the new display
scheme.
2017-10-11 11:59:58 +02:00
Juergen Spitzmueller
0e711b414e Add missing break
As correctly pointed out by gcc7.
2017-08-12 09:55:06 +02:00
Christian Ridderström
e30f3d76d2 Bulk cleanup/fix incorrect annotation at the end of namespaces.
This commit does a bulk fix of incorrect annotations (comments) at the
end of namespaces.

The commit was generated by initially running clang-format, and then
from the diff of the result extracting the hunks corresponding to
fixes of namespace comments. The changes being applied and all the
results have been manually reviewed. The source code successfully
builds on macOS.

Further details on the steps below, in case they're of interest to
someone else in the future.

1. Checkout a fresh and up to date version of src/

    git pull && git checkout -- src && git status src

2. Ensure there's a suitable .clang-format in place, i.e. with options
   to fix the comment at the end of namespaces, including:

    FixNamespaceComments:                           true
    SpacesBeforeTrailingComments:                   1

and that clang-format is >= 5.0.0, by doing e.g.:

    clang-format -dump-config | grep Comments:
    clang-format --version

3. Apply clang-format to the source:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")

4. Create and filter out hunks related to fixing the namespace

    git diff -U0 src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace.patch

5. Filter out hunks corresponding to simple fixes into to a separate patch:

    pcregrep -M -e '^diff[^\n]+\nindex[^\n]+\n--- [^\n]+\n\+\+\+ [^\n]+\n'  \
        -e '^@@ -[0-9]+ \+[0-9]+ @@[^\n]*\n-\}[^\n]*\n\+\}[^\n]*\n'         \
        fix_namespace.patch > fix_namespace_simple.patch

6. Manually review the simple patch and then apply it, after first
   restoring the source.

    git checkout -- src
    patch -p1 < fix_namespace_simple.path

7. Manually review the (simple) changes and then stage the changes

    git diff src
    git add src

8. Again apply clang-format and filter out hunks related to any
   remaining fixes to the namespace, this time filter with more
   context. There will be fewer hunks as all the simple cases have
   already been handled:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")
    git diff src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace2.patch

9. Manually review/edit the resulting patch file to remove hunks for files
   which need to be dealt with manually, noting the file names and
   line numbers. Then restore files to as before applying clang-format
   and apply the patch:

    git checkout src
    patch -p1 < fix_namespace2.patch

10. Manually fix the files noted in the previous step. Stage files,
    review changes and commit.
2017-07-23 13:11:54 +02:00
Jean-Marc Lasgouttes
29378af4cd Rename some macro-related insets
These classes should have names that start with "Inset". Renaming done:
MathMacro => InsetMathMacro
MathMacroTemplate => InsetMathMacroTemplate
MathMacroArgument => InsetMathMacroArgument
ArgumentProxy => InsetArgumentProxy
DisplayLabelBox => InsetDisplayLabelBox
CommandInset => InsetMathCommand
2017-07-05 14:46:34 +02:00
Richard Heck
75bfed5507 Fix trailing whitespace in cpp files. 2017-07-03 13:53:14 -04:00
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