From 3582ac9f7747865aa77d20ba3553a574a6eff438 Mon Sep 17 00:00:00 2001 From: John Foerch Date: Thu, 13 May 2010 21:13:03 -0400 Subject: [PATCH] unfocus: support scrollable divs resolves issue204 --- modules/buffer.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/buffer.js b/modules/buffer.js index 9751ce7..ff81a1b 100644 --- a/modules/buffer.js +++ b/modules/buffer.js @@ -1,6 +1,6 @@ /** * (C) Copyright 2004-2007 Shawn Betts - * (C) Copyright 2007-2009 John J. Foerch + * (C) Copyright 2007-2010 John J. Foerch * (C) Copyright 2007-2008 Jeremy Maitin-Shepard * * Use, modification, and distribution are subject to the terms specified in the @@ -760,10 +760,14 @@ define_buffer_local_hook("unfocus_hook"); function unfocus (window, buffer) { // 1. if there is a selection, clear it. var selc = buffer.focused_selection_controller; - if (selc && selc.getSelection(selc.SELECTION_NORMAL).isCollapsed == false) { + if (selc) { + var sel = selc.getSelection(selc.SELECTION_NORMAL); + var active = ! sel.isCollapsed; clear_selection(buffer); - window.minibuffer.message("cleared selection"); - return; + if (active) { + window.minibuffer.message("cleared selection"); + return; + } } // 2. if there is a focused element, unfocus it. if (buffer.focused_element) { -- 2.11.4.GIT