From c291cd1bb338d15dc03fb06afd8dad46b6f2ea26 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 30 May 2012 10:51:27 -0600 Subject: [PATCH] Cache hidden/visible state of cursor to avoid extra DOM hit when updating its appearance --- src/app/cursor.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/cursor.coffee b/src/app/cursor.coffee index a3fc37abd..9bed85078 100644 --- a/src/app/cursor.coffee +++ b/src/app/cursor.coffee @@ -12,6 +12,7 @@ class Cursor extends View anchor: null editor: null wordRegex: /(\w+)|([^\w\s]+)/g + hidden: false initialize: ({editor, screenPosition} = {}) -> @editor = editor @@ -178,8 +179,10 @@ class Cursor extends View @editor.scrollTo(pixelPosition) if @editor.isFoldedAtScreenRow(screenPosition.row) - @hide() + @hide() unless @hidden + @hidden = true else - @show() + @show() if @hidden + @hidden = false @selection.updateAppearance()