Commit Graph

555 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
e1be71da59 Reset layout when inserting an inset over full paragraph(s)
1/ When inserting an inset over a selection, it makes sense if the
selection covers a complete or several paragraphs to reset the layout of
the paragraph that contains the inset to plain layout. In general the
inner inset will have the needed layout information and it does not
make sense to keep this information outside.

However, when the inset forces plain layout, it does not make sense to
do that and the outer layout is preserved.

Some code that duplicates what is done in pasteSelectionHelper is also
removed.

2/ Similarly, when dissolving an inset, do not reset the layout of the
first paragraph if the inset was alone in its own paragraph.

Note that this does not work as intended when change tracking is enabled.

Fixes bugs #10266 and #10369.
2019-09-11 10:39:02 +02:00
Scott Kostyshak
27f89144bb Enable change tracking if paragraph break change
When a selection spans more than one line, we now check for whether
there is a change at one position after the last position of each
fully selected line.

This fixes #11629.
2019-08-30 22:31:24 -04:00
Juergen Spitzmueller
9e6d22ea9c Add InsertOnNewline argument tag
This adds a paragraph break before auto-inserting arguments in flex
insets.

Useful for specific arguments (particularly ling glosses)
2019-06-02 18:07:10 +02:00
Juergen Spitzmueller
378c7e8edb Allow for auto-inserting multiple arguments 2019-06-02 09:26:32 +02:00
Juergen Spitzmueller
532765c03a Enable AutoInsert with post arguments 2019-06-02 09:25:56 +02:00
Kornel Benko
e0f5641089 Select the whole paragraph with tripple-left-click
Fixes #9175

Also added new function: paragraph-select.
2019-04-16 19:50:31 +02:00
Juergen Spitzmueller
6482ddee30 tabular-style-insert: add rows also for 1x and 2x tables
Fixes: #11537
2019-04-07 12:10:03 +02:00
Jean-Marc Lasgouttes
f609a4717f Pass a pit to Text::isRTL(), not a paragraph 2019-04-02 09:56:42 +02:00
Juergen Spitzmueller
4b3aacd13b Add TableStyle layout tag
Fixes: #8360
2019-03-26 17:42:56 +01:00
Juergen Spitzmueller
ecb2427f41 Add tablestyle buffer param
Fixes: #9901
2019-03-26 16:24:27 +01:00
Juergen Spitzmueller
683b3a05e2 Introducing table templates
The idea is simple: we insert a pre-formatted table (with a given border
style currently, but other attributes are possible as well) via file-insert
and scale it then to the requested size.

We need three sizes (1x1, 1x2 and 1x3) to generate all sizes properly (due
to border specifications).

Currently, these styles can only be accessed via lfun tabular-style-insert
and the Tabular Create dialog.

My plan is to add a buffer param to set a default style (#9901) which then
also is respected by the toolbar button and probably a layout tag to let
classes specify a default style (#8360).
2019-03-26 13:43:33 +01:00
Jean-Marc Lasgouttes
d52e04a9b3 Fix fonts used by sub/superscript in text
Several changes are needed to get things right:
* nested supersripts only work with inheritFonts=true.

* to get caret position right, it is necessary to remember the outside
  font of the inset before computing metrics.

* to get the size right at insertion time, it is necessary to trigger
  a metrics computation just after inset insertion.
2019-03-22 16:19:52 +01:00
Jean-Marc Lasgouttes
f659af339e Revert "Let tm be a reference here as elsewhere"
This commit was wrong because a reference variable can never be
re-assigned (it would change the original variable). I learn C++
pitfalls every day.

Fixes bug #11512.

This reverts commit 10e2c65835.
2019-03-12 16:03:22 +01:00
Jean-Marc Lasgouttes
10e2c65835 Let tm be a reference here as elsewhere 2019-02-18 15:47:27 +01:00
Juergen Spitzmueller
59d73f52b8 Do not auto-insert separator for keepempty layouts
Candidate for stable
2018-12-29 13:35:39 +01:00
Scott Kostyshak
c5301a6495 Fix assertion when checking if change in selection
The check for the iterator being in the same paragraph as the end of
selection was incorrect, because paragraphs in different cells could
have the same pit. We now additionally condition on having the same
idx.

This commit amends d1279875 (and thus 23de5e5e).

For discussion, see:

  https://www.mail-archive.com/search?l=mid&q=a5afd0c01a0eb9a84fd4d050d15eb23016d6f38a.camel%40lyx.org

Thanks to Jürgen.
2018-12-28 10:46:30 -05:00
Juergen Spitzmueller
2f9876a410 LFUN_TEXTSTYLE_UPDATE: Do not force any unspecified settings.
Fixes: #11111 (yay!)
2018-12-27 15:30:57 +01:00
Juergen Spitzmueller
2d876f8d9d Disable LFUN_FONT_DEFAULT if there's noting to reset. 2018-12-27 14:16:00 +01:00
Kornel Benko
9ee515c984 Amend 154b4fde 2018-12-26 17:45:34 +01:00
Juergen Spitzmueller
154b4fdece Give textstyle-apply a history
The last 20 applications are saved now and accessible both via the lfun
(textstyle-apply n) and the toolbar (via button menu)

Fixes: #7133

This also changes the default icon and toolbar position of the action,
as requested in #11427
2018-12-26 15:46:14 +01:00
Kornel Benko
06c05430d9 FindAdv: Added lyx-function search-ignore
Enable/disable ignoring the specified type
	language: e.g. british, slovak, latin, ...
	color:	blue, red, ...
	sectioning: part, chapter, ..
	font:
		series: bold, ...
		shape: upright, italic, slanted
		family: serif, monospace ...
	markup: enphasize, noun
	underline:
	strike:

Examples:
	search-ignore language true
	search-ignore shape true
2018-11-15 14:20:50 +01:00
Juergen Spitzmueller
4648f39a1e info-insert without arg is valid
it opens the info dialog.
2018-09-20 11:11:44 +02:00
Juergen Spitzmueller
92bfa07a62 Avoid infinite loop
Fixes: #11295
2018-09-19 10:19:19 +02:00
Juergen Spitzmueller
ed61ce74b7 So long, date-insert!
This function is superseded by info-insert date, which is much mightier
and more flexible.
2018-08-20 09:25:22 +02:00
Juergen Spitzmueller
b0f579655c InsetInfo: Move validateArgument() to params
and use it for LFUN_INFO_INSERT validation
2018-08-18 14:29:15 +02:00
Juergen Spitzmueller
307319e95e Introduce InsetInfoParams
This allows to open the dialog without having an inset already.
2018-08-06 20:07:15 +02:00
Juergen Spitzmueller
e730234e57 Add date-related info insets
With this commit, info insets leave the dark backstage room of an opaque
and quite hidden dev-only feature and come frontstage.

In the UI, they present themselves as "Fields" since this is what people
know from word processors. Other user-related fields that could be
implemented next: time, user name (I plan to do that for 2.4).

Since this supersedes date-insert, I removed Insert > Date from
the menu and propose to ditch date-insert and the corresponding rc.

The lyx2lyx reversion routine has lots of room for improvement and
attractive tasks for pythons (file timestamp, switch of localization).
Please feel invited!

This is a file format change.
2018-08-05 10:01:36 +02:00
Scott Kostyshak
d12798759a Fix crash when selecting text with changes
When selecting text, in some cases a DocIterator could be forwarded
to a (non-existant) paragraph after the end. The critical part of
this fix is to break the loop at the correct place. The following
are additional improvements:

- increase readability by defining a bool named "in_last_par"
- use cur.selectionEnd().pit() instead of cur.selectionEnd().paragraph().id()
- use it.lastpos() instead of it.paragraph().size()

This commit fixes a regression introduced by 23de5e5e, and reported
at #11204.

Thanks to Jürgen and JMarc.
2018-07-27 15:39:39 -04:00
Juergen Spitzmueller
803a88f243 Sort out problems with InsetInfo language settings
* use the context language of the info inset (rather than the buffer
language), and translate strings accordingly

* for menu and shortcuts, use the Gui language instead

* actually care that all translatable strings end in po
(this wasn't the case).

Fixes: #5348, rest of #10463
2018-07-27 12:14:37 +02:00
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