Bug 384569

Summary: %M is repeated if used in a user menu item which does not require text selection
Product: [Applications] kile Reporter: reescf
Component: user interfaceAssignee: Michel Ludwig <michel.ludwig>
Status: RESOLVED FIXED    
Severity: major    
Priority: NOR    
Version First Reported In: 2.9.91   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description reescf 2017-09-10 18:07:23 UTC
I have user menu items of the following which have the following form

<something>%M%C<something else>

for example

(%M%C)

This should mean that if text is selected when triggered, the text selection is surrounded by the insertions and the cursor is placed just after the selection. For example

ab

should become

(ab<cursor here>)

If no text is selected, I should get

(<cursor here>)

This pattern is reflected in the example.xml which uses it for small-caps with-or-without-selected-text.

\textsc{%M%C}

However, whether my menu items or small-caps from example.xml, what actually happens is that, if text is selected,

%M<something>%M%C<something else>

is inserted into the document. So, rather than

(ab<cursor here>)

you get

ab(ab<cursor here>)

This doesn't happen if you require text to be selected. However, then you can't use the item without a selection.

This is a regression: it worked just fine with user tags in previous versions of Kile.
Comment 1 Michel Ludwig 2018-01-21 17:09:33 UTC
Git commit 0a08fcaca53bd1535113435ced489cce4db99903 by Michel Ludwig.
Committed on 21/01/2018 at 17:04.
Pushed by mludwig into branch 'master'.

User menu: make 'replace text selection' independent of 'require text selection'

Also, fix cursor positioning with '%C' in combination with '%M'.

M  +4    -6    src/dialogs/usermenu/usermenudialog.cpp
M  +13   -18   src/usermenu/usermenu.cpp

https://commits.kde.org/kile/0a08fcaca53bd1535113435ced489cce4db99903