[code] Highlight trailing whitespace

From: Carlos Pita <carlosjosepita.att.gmail.com>
Date: Wed, 4 Mar 2015 01:53:44 -0300

This is a cleanup and simplification of some gist around the web. I
want to share it and ask for code review from the savvy users here
(specially in case I'm missing an important event or doing something
in a very inefficient way).

-- Highlight trailing whitespace
local tw_indicator = _SCINTILLA.next_indic_number()
buffer.indic_style[tw_indicator] = buffer.INDIC_ROUNDBOX
buffer.indic_fore[tw_indicator] = 0x0000FF
events.connect(events.UPDATE_UI, function()
  buffer.indicator_current = tw_indicator
  buffer:indicator_clear_range(0, buffer.length)
  for s, e in buffer:get_text():gmatch('()[ \t]+()\r?\n') do
    buffer:indicator_fill_range(s - 1, e - (s - 1))


You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 03 Mar 2015 - 23:53:44 EST

This archive was generated by hypermail 2.2.0 : Wed 04 Mar 2015 - 06:46:34 EST