Hi
i want to write a funktion to remove empty lines in a selection
this is my code:

function removeEmptyLines()
  local buf={}
  local sel = editor:GetSelText()
  buf = lines(sel)
  for i=table.getn(buf),1,-1 do
    _ALERT(i.." - "..buf[i])
    if buf[i]=='' then
      table.remove(buf,i)
    end
  end
  editor:ReplaceSel(buf)
end

it seems that the last entry of the table contains the full seletion, al others the exact line.

the following selection:
123

456

789

gives me in the output pane:
5 - 123

456

789
4 -
3 - 456
2 -
1 - 123

if the remove is called, the complete selection is deleted.

what have i done wrong?

regards Frank
_______________________________________________
Scite-interest mailing list
Scite-interest@lyra.org
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to