cucumber.el icon indicating copy to clipboard operation
cucumber.el copied to clipboard

Bug at highlighting when a keyword is a prefix of another keyword

Open renatofq opened this issue 9 years ago • 1 comments

When a keyword is a prefix to another keyword, the longer keyword does not get fully highlighted.

Example: in Portuguese the keyword 'E' (And) is a prefix of the keyword 'Então' (Then). Also, 'And' happens before 'Then' on the keyword name list, so when using feature-mode in Portuguese, only the letter 'E' gets highlighted when I insert 'Então'.

I think that sorting the keywords making the longer first is a proper way to fix. I would submit a PR, but my lisp is very poor, so I'm going to paste how I got it to work.

feature-mode.el
439c439,442
<     result-keywords))

---
>     (sort result-keywords 'longer-first)))
> 
> (defun longer-first (a b)
>   (> (length (car a)) (length (car b))))

renatofq avatar Feb 16 '16 01:02 renatofq

@renatofq thank you for the detailed report. Feel free to submit a PR.

michaelklishin avatar Feb 16 '16 03:02 michaelklishin