Commit Graph

576 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
e4dba53232 Do not remove character at start of paragraph when cutting
The part of code that removed space at start of paragraph have been
there forever, but its intent is unclear. For example, cutting text at
the end of a paragraph will lead to remove space at the start of this
same paragraph.

The removal of this functionality is offset by a rewrite of DEPM that
makes it more thorough.

Fixes bug #10503.
2018-07-22 23:20:21 +02:00
Jean-Marc Lasgouttes
ad5548cfe3 Fixes to input method handling
The goal of this patch is to make "self-insert <string>" act as a
sequence of individual self-insert calls. Once it is done, the
insertion of the commit string in GuiWorkArea can use that, which
fixes the issues described in bug 11183.

1/ in InsetMathNest, SELF_INSERT is rewritten to be a proper loop of
   interpretChar, instead of inserting the string as characters. This
   solves the issue of interpreting ^ properly.

2/ the text version does not need to be changed (the loop is rewritten
   using a range, though).

3/ Then {{{GuiWorkArea::inputMethodEvent}}} is changed to invoke
   directly self-insert. This removes the update issues.

Fixes bug 11183.
2018-07-05 14:32:37 +02:00
Jean-Marc Lasgouttes
3591aa833f Implement layout-toggle lfun
This is like `layout', except that the layout is reset to default if
it was already correct. In the case of a selection, the layout is set
normally if some layouts in the selection are not at the required
layout; it is reset only if all the layouts of the selection already
have the required layout.

Part of ticket #9864.
2018-05-15 00:03:55 +02:00
Jean-Marc Lasgouttes
255a5cf401 Clean up code of LFUN_LAYOUT
Factor out some code in helper functions. Improve getStatus so that
icon is selected only when the whole selection has the correct layout.

This work towards ticket #9864.
2018-05-14 16:45:46 +02:00
Scott Kostyshak
23de5e5e19 Only show Accept/Reject Change options if relevant
In the context menu for a selection, we now only show the options
"Accept Change" and "Reject Change" if there is actually a change in
the selection. Similarly, in the toolbar, the buttons are only
enabled when there is a change in the selection.

This fixes #10338.
2018-05-10 12:58:44 -04:00
Richard Kimberly Heck
c7a2011adf Remove unused function. 2018-05-05 12:02:10 -04:00
Richard Kimberly Heck
e91245362f Fix indentation. 2018-05-02 19:57:37 -04:00
Richard Kimberly Heck
ba0f28a09b Simplify some code now that we don't need it for indexes.
This has the effect that inserting nomenclature entries does not
cut the selection (implicit or explicit) but rather copies it, which
seems to me to make a lot more sense. If anyone objects, let me know.
2018-04-25 22:22:36 -04:00
Richard Kimberly Heck
aa2f409d87 Restore implicit word selection for inset insertion.
Modifies 83356ab9.
2018-04-25 21:48:25 -04:00
Richard Heck
83356ab9fe Fix #6344.
For some reason, special code was added for LFUN_INDEX_INSERT
when it was not actually needed. So just delete it.
2018-04-20 23:11:04 -04:00
Scott Kostyshak
4e9e9881b2 Greyedouts can be inserted in commands/description
This change also applies to Comment insets. For example, Greyedout
and comment insets can now be inserted in section titles.

The usage of these insets in commands relies on the newly
implemented cprotect feature. The usage of these insets in
description items already worked fine (without cprotect).

This commit also enables modification of these insets (e.g.,
converting a LyX note to a Greyedout note) in commands.

This commit is related to #6969.
2018-04-19 12:35:06 -04:00
Richard Heck
a714f6cb76 Move LFUN_UNICODE_INSERT to BufferView, per JMarc's suggestion. 2018-04-16 22:56:01 -04:00
Richard Heck
f7d502d024 Use FuncRequest::getArg instead of splitting the argument
ourselves.
2018-04-16 22:32:04 -04:00
Richard Kimberly Heck
83b1ac3b55 Fix bug #11084.
Allow unicode-insert to accept a sequence of codepoints.
2018-03-21 23:08:38 -04:00
Richard Heck
92742f63bc Fix bug #10926, and some for loops. 2018-02-24 00:20:03 -05:00
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
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
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