mirror of
https://github.com/elisspace/ObsidianTweaks.git
synced 2026-08-29 15:44:02 +00:00
Fix: fixes CodeMirror word finder discrimination
CodeMirror does not consider some symbols like asterisks as part of a word. We on the other hand believe that all symbols are created equal (except whitespaces and spaces of other colours).
This commit is contained in:
13
RELEASE.md
Executable file
13
RELEASE.md
Executable file
@@ -0,0 +1,13 @@
|
||||
# Release
|
||||
|
||||
1. Update `versions.json`
|
||||
2. Update `manifest.json`
|
||||
3. Update `pacakge.json`
|
||||
4. Commit
|
||||
5. Tag (`git tag x.y.z`)
|
||||
6. Push (`git push`)
|
||||
7. Make release on GitHub
|
||||
1. manifest.json
|
||||
2. styles.css
|
||||
3. main.js
|
||||
4. versions.json
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsidian-tweaks",
|
||||
"name": "Obsidian Tweaks",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"minAppVersion": "0.12.3",
|
||||
"description": "A small plugin that implements some sorely missed features.",
|
||||
"author": "Jeppe Klitgaard",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "obsidian-tweaks",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"description": "A small plugin that implements some sorely missed features.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -34,6 +34,7 @@ export class BetterFormatting {
|
||||
|
||||
let textToWrap = editor.getRange(wordStart, wordEnd)
|
||||
|
||||
// Fix for inconsistent toggling
|
||||
if (textToWrap.trim() === "") {
|
||||
wordStart = anchor
|
||||
wordEnd = anchor
|
||||
@@ -55,7 +56,6 @@ export class BetterFormatting {
|
||||
|
||||
// Update textToWrap again
|
||||
textToWrap = editor.getRange(wordStart, wordEnd)
|
||||
|
||||
}
|
||||
|
||||
let alreadyWrapped = (
|
||||
@@ -63,6 +63,27 @@ export class BetterFormatting {
|
||||
textToWrap.endsWith(symbolEnd)
|
||||
)
|
||||
|
||||
// Fix for not all symbols considered part of word
|
||||
if (!alreadyWrapped) {
|
||||
let preWordStart = editor.getRange(
|
||||
{line: wordStart.line, ch: wordStart.ch - symbolStart.length},
|
||||
{line: wordStart.line, ch: wordStart.ch},
|
||||
)
|
||||
let postWordStart = editor.getRange(
|
||||
{line: wordEnd.line, ch: wordEnd.ch},
|
||||
{line: wordEnd.line, ch: wordEnd.ch + symbolEnd.length},
|
||||
)
|
||||
|
||||
if (preWordStart === symbolStart && postWordStart === symbolEnd) {
|
||||
wordStart = {line: wordStart.line, ch: wordStart.ch - symbolStart.length}
|
||||
wordEnd = {line: wordEnd.line, ch: wordEnd.ch + symbolEnd.length}
|
||||
|
||||
// Update textToWrap
|
||||
textToWrap = editor.getRange(wordStart, wordEnd)
|
||||
alreadyWrapped = true
|
||||
}
|
||||
}
|
||||
|
||||
let newText: string
|
||||
if (alreadyWrapped) {
|
||||
newText = textToWrap.substring(symbolStart.length, textToWrap.length - symbolEnd.length)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"0.2.1": "0.12.3",
|
||||
"0.2.0": "0.12.3",
|
||||
"0.1.1": "0.12.3",
|
||||
"0.1.0": "0.12.3"
|
||||
|
||||
Reference in New Issue
Block a user