Skip to content

Commit 83e3824

Browse files
committed
CursorlessContainer: print when redrawing to standard out
1 parent 39a7365 commit 83e3824

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/main/kotlin/com/github/phillco/talonjetbrains/cursorless/CursorlessContainer.kt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ class CursorlessContainer(val editor: Editor) : JComponent() {
140140
started = true
141141
}
142142

143+
fun editorPath(): String? {
144+
val file = FileDocumentManager.getInstance().getFile(editor.document)
145+
return file?.path
146+
}
147+
143148
/**
144149
* Returns the list of hat decorations for this editor, if there is a valid one.
145150
*/
@@ -152,8 +157,7 @@ class CursorlessContainer(val editor: Editor) : JComponent() {
152157
File(HATS_PATH).readText()
153158
)
154159

155-
val editorPath = FileDocumentManager.getInstance()
156-
.getFile(editor.document)!!.path
160+
val editorPath = editorPath()
157161

158162
if (!cursorlessTempFiles.containsKey(editorPath)) {
159163
return null
@@ -209,7 +213,9 @@ class CursorlessContainer(val editor: Editor) : JComponent() {
209213
}
210214

211215
val logicalPosition = editor.offsetToLogicalPosition(offset)
212-
val coordinates = editor.visualPositionToXY(editor.logicalToVisualPosition(logicalPosition))
216+
val coordinates = editor.visualPositionToXY(
217+
editor.logicalToVisualPosition(logicalPosition)
218+
)
213219

214220
g.color = this.colorForName(colorName)
215221

@@ -226,7 +232,7 @@ class CursorlessContainer(val editor: Editor) : JComponent() {
226232
fun doPainting(g: Graphics) {
227233
val mapping = getHats() ?: return
228234

229-
log.debug("Redrawing for ${editor.document}...")
235+
println("Redrawing for ${editorPath()}...")
230236
mapping.keys.forEach { color -> renderForColor(g, mapping, color) }
231237
}
232238

0 commit comments

Comments
 (0)