                 sel = document.getSelection()
             sel.removeAllRanges()
             sel.addRange(rg)
-        else
-            @currentSel.sel.setSingleRange pop.initialSelRg
-        pop.style.display = 'none'
-        @setFocus()
-
-    _validateUrlPopover : () =>
-        pop = @urlPopover
-        segments = pop.segments
-        seg.style.removeProperty('background-color') for seg in segments
-        
-        # case of a cancelation => remove links of segments
-        if pop.urlInput.value == '' 
-            t
+            @setFocus()
+            return true
 
         # case if only href is changed but not the text
-        if pop.initialTxt == pop.textInput.value
+        else if pop.initialTxt == pop.textInput.value
             seg.href = pop.urlInput.value for seg in segments
             lastSeg = seg
 

        [btnOK,btnCancel,btnDelete] = pop.querySelectorAll('button')
        btnOK.addEventListener('click',@_validateUrlPopover)
        btnCancel.addEventListener('click',@_cancelUrlPopover)
        btnDelete.addEventListener 'click', () ->
            pop.urlInput.value = ''
            @_validateUrlPopover()


               shortcut in ['-tab', '-return', '-backspace', '-suppr',
                            'CtrlShift-down', 'CtrlShift-up',
                            'CtrlShift-left', 'CtrlShift-right',
                            'Ctrl-B', 'Ctrl-U', 
                            'Ctrl-V', 'Shift-tab', '-space', '-other', 'Alt-A']
            @_addHistory()
           
