mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-03-13 23:18:09 +00:00
Tentative: Remove conditional from wrap-selection text-operation (#3749)
As per the discussion in #3749, the original purpose of the removed condition is unknown, and so we cannot be certain that removing it is safe, but doing so seems the best way of discovering more...
This commit is contained in:
parent
e5f3301c1c
commit
5e9fc661a9
@ -16,14 +16,12 @@ exports["wrap-selection"] = function(event,operation) {
|
||||
if(operation.selStart === operation.selEnd) {
|
||||
// No selection; check if we're within the prefix/suffix
|
||||
if(operation.text.substring(operation.selStart - event.paramObject.prefix.length,operation.selStart + event.paramObject.suffix.length) === event.paramObject.prefix + event.paramObject.suffix) {
|
||||
// Remove the prefix and suffix unless they comprise the entire text
|
||||
if(operation.selStart > event.paramObject.prefix.length || (operation.selEnd + event.paramObject.suffix.length) < operation.text.length ) {
|
||||
operation.cutStart = operation.selStart - event.paramObject.prefix.length;
|
||||
operation.cutEnd = operation.selEnd + event.paramObject.suffix.length;
|
||||
operation.replacement = "";
|
||||
operation.newSelStart = operation.cutStart;
|
||||
operation.newSelEnd = operation.newSelStart;
|
||||
}
|
||||
// Remove the prefix and suffix
|
||||
operation.cutStart = operation.selStart - event.paramObject.prefix.length;
|
||||
operation.cutEnd = operation.selEnd + event.paramObject.suffix.length;
|
||||
operation.replacement = "";
|
||||
operation.newSelStart = operation.cutStart;
|
||||
operation.newSelEnd = operation.newSelStart;
|
||||
} else {
|
||||
// Wrap the cursor instead
|
||||
operation.cutStart = operation.selStart;
|
||||
|
Loading…
x
Reference in New Issue
Block a user