Bug 416309 - Single quote appears twice in inline math mode
Summary: Single quote appears twice in inline math mode
Status: REPORTED
Alias: None
Product: kile
Classification: Applications
Component: editor (other bugs)
Version First Reported In: 2.9.93
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Michel Ludwig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-15 20:03 UTC by abyss
Modified: 2020-01-16 01:41 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description abyss 2020-01-15 20:03:19 UTC
SUMMARY
When in inline math mode (i.e. in between two `$` characters), typing a single quote (') automatically adds two single quotes ('') instead. This is undesirable since several mathematical symbols I use are defined with a single ' character and not two.
I would be very pleased if someone could suggest where in the source code this feature is written, so that I could tweak/patch it myself. I tried checking several files in `src/`, specifically `src/editorextension.cpp` and `src/codecompletion.cpp` but couldn't find the piece of code that adds automatic closing brackets and quotation marks.

Thanks,
Abhinav

STEPS TO REPRODUCE
1. Enable Automatic Brackets in Settings-> Configure Kile-> Editing-> Auto Brackets->Enable automatic brackets
2. Go to math mode either through a shortcut or by typing `$ $` manually. Navigate to any cursor position between the $ signs and type `'`.

OBSERVED RESULT
Kile automatically adds two instances of the character (`''`).

EXPECTED RESULT
Inline math mode should behave the same as other modes: only a single character should be added.

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Linux (x86_64) release 5.4.11-arch1-1
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: KDE Frameworks 5.66.0
Qt Version: Qt 5.14.0 (built against 5.14.0)


ADDITIONAL INFORMATION
Comment 1 abyss 2020-01-16 01:41:47 UTC
I added a user-defined script that lets me work around this. The script is activated when I press the key `'`.
If anyone else is interested, here it is:

document.editBegin();
var range = view.selectionRange();

if ( range.isValid() ) {
	view.clearSelection();
	document.insertText(range.end,"'");
	var c = view.cursorPosition();
	document.insertText(range.start,"'");
	c.column = c.column + 1;
	view.setCursorPosition(c);
}
else {
	document.insertText("'");
}
document.editEnd();