Skip to content

Commit

Permalink
Merge pull request #3829 from Hannah-Sten/various
Browse files Browse the repository at this point in the history
Various small fixes
  • Loading branch information
PHPirates authored Dec 29, 2024
2 parents 90b30fd + 0e2cfe4 commit 63bed79
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
* Fix parse error when using commands with arguments in parameter of \href or \url
* Fix parse error when using parentheses in a group in a key value command argument
* Fix parse erron when using inline math in cases* environment in inline math
*
* Fix exceptions #3813, #3818
* Fix false positive non-breaking space warning for \nameref
* Fix confusion with \micro and \mu unicode characters

## [0.9.10-alpha.4] - 2024-12-21

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class LatexUnicodeInspection : TexifyInspectionBase() {
// Try to find in lookup for special command
val replacement: String?
val command: LatexCommand? = if (inMathMode) {
LatexMathCommand.findByDisplay(c)?.firstOrNull()
LatexMathCommand.findByDisplay(c)?.firstOrNull() ?: LatexRegularCommand.findByDisplay(c)?.firstOrNull()
}
else {
LatexRegularCommand.findByDisplay(c)?.firstOrNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ open class LatexNonBreakingSpaceInspection : TexifyInspectionBase() {
"\\Cref",
"\\cpageref",
"\\autoref",
"\\nameref",
"\\citeauthor",
"\\textcite",
"\\Textcite"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum class LatexSiunitxCommand(
NUM("num", "options".asOptional(), "number".asRequired(), dependency = SIUNITX),
UNIT("unit", "options".asOptional(), "unit".asRequired(), dependency = SIUNITX),
QTY("qty", "options".asOptional(), "number".asRequired(), "unit".asRequired(), dependency = SIUNITX),
MICRO("micro", display = "µ", dependency = SIUNITX),
NUMLIST("numlist", "options".asOptional(), "numbers".asRequired(), dependency = SIUNITX),
NUMPRODUCT("numproduct", "options".asOptional(), "numbers".asRequired(), dependency = SIUNITX),
NUMRANGE("numrange", "options".asOptional(), "number1".asRequired(), "number2".asRequired(), dependency = SIUNITX),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ object EvinceInverseSearchListener {
}
catch (e: Exception) {
Notification("LaTeX", "Cannot get connection to DBus", "Check if the correct packages are installed", NotificationType.ERROR).notify(project)
return
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/nl/hannahsten/texifyidea/util/parser/Psi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fun PsiElement.lineNumber(): Int? = containingFile.document()?.getLineNumber(tex
*/
fun <T : PsiElement> PsiElement.childrenOfType(clazz: KClass<T>): Collection<T> {
return runReadAction {
if (project.isDisposed || !this.isValid) {
if (!this.isValid || project.isDisposed) {
emptyList()
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ class LatexUnicodeInspectionQuickFix : LatexUnicodeInspectionTest() {
testNamedQuickFix("é", "\\'e", "Escape Unicode character", 2)
}

fun `test mu`() {
setUnicodeSupport(false)

testNamedQuickFix("$ µ$", "$ \\micro$", "Escape Unicode character", 1)
testNamedQuickFix("$ μ$", "$ \\mu$", "Escape Unicode character", 1)
}

@Suppress("NonAsciiCharacters")
fun `test escape unicode quick fix î`() {
setUnicodeSupport(false)
Expand Down

0 comments on commit 63bed79

Please sign in to comment.