Permalink
Browse files

Stricter rules on what selections the Highlight All feature is activated

on.
  • Loading branch information...
1 parent edf15b2 commit 88da90052b353c298859aa7b1a5ef3a31a15b72c @dom96 dom96 committed Mar 23, 2013
Showing with 6 additions and 5 deletions.
  1. +6 −5 search.nim
View
@@ -33,12 +33,12 @@ proc newNoHighlightAll*(): THighlightAll =
proc canBeHighlighted(term: string): bool =
## Determines whether ``term`` should be highlighted.
- result = false
- if term.len == 0: return false
+ result = true
+ if term.len < 2: return false
let c = term[0]
- if c notin NonHighlightChars: return true
+ if c in NonHighlightChars: return false
for i in 1..term.len-1:
- if term[i] notin NonHighlightChars: return true
+ if term[i] in NonHighlightChars: return false
proc getSearchOptions(mode: TSearchEnum): TTextSearchFlags =
case mode
@@ -241,12 +241,13 @@ proc highlightAll*(w: var MainWin, term: string, forSearch: bool, mode = SearchC
## This is already highlighted.
return
+ stopHighlightAll(w, forSearch)
+
if not forSearch:
if not canBeHighlighted(term):
return
echod("Highlighting in ", mode)
- stopHighlightAll(w, forSearch)
type
TIdleParam = object

0 comments on commit 88da900

Please sign in to comment.