Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hanging when block comments shortcut is used (and fix some crashes) #1332

Merged
merged 3 commits into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/nl/hannahsten/texifyidea/editor/LatexCommenter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ open class LatexCommenter : Commenter {

override fun getLineCommentPrefix() = "%"

override fun getBlockCommentPrefix() = ""
override fun getBlockCommentPrefix(): String? = null

override fun getBlockCommentSuffix() = ""
override fun getBlockCommentSuffix(): String? = null

override fun getCommentedBlockCommentPrefix() = ""
override fun getCommentedBlockCommentPrefix(): String? = null

override fun getCommentedBlockCommentSuffix() = ""
override fun getCommentedBlockCommentSuffix(): String? = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ open class BibtexDuplicateBibliographyInspection : TexifyInspectionBase() {
if (command.containingFile != file) continue

val parameterIndex = command.requiredParameter(0)?.indexOf(fileName) ?: break
if (parameterIndex < 0) break

descriptors.add(manager.createProblemDescriptor(
command,
TextRange(parameterIndex, parameterIndex + fileName.length).shiftRight(command.commandToken.textLength + 1),
Expand Down
9 changes: 7 additions & 2 deletions src/nl/hannahsten/texifyidea/ui/PreviewFormUpdater.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,16 @@ $previewCode
try {
// Create the default temp directory.
setPreviewCodeInTemp(createTempDir())
} catch (exception: AccessDeniedException) {
}
catch (exception: AccessDeniedException) {
// If pdf2svg or inkscape does not have access to the temp directory, try again with temp folder in the
// home directory.
setPreviewCodeInTemp(createTempDir(directory = File(System.getProperty("user.home"))))
} catch (exception: IOException) {
}
catch (exception: IOException) {
previewForm.setLatexErrorMessage("${exception.message}")
}
catch (exception: AccessDeniedException) {
previewForm.setLatexErrorMessage("${exception.message}")
}
}
Expand Down