1 May 11:40
Re: Question for sorting lines
Kein-Hong Man <mkh <at> pl.jaring.my>
2005-05-01 09:40:08 GMT
2005-05-01 09:40:08 GMT
Hi,
Bob Norris wrote:
> I have a question,, How can I sort files by the word count before the
> |msg| ? In PHP scripts read backwards from longest to
> shortest so I need to sort them like below. I would gladly donate for a
> soultion.
>
> Example before:
> [snip]
> *Desired results:*
> [snip]
Assuming you want something that executes in SciTE, here is a Lua
script:
function SortSentences()
local sentence = {} -- list of sentences with |msg|
local location = {} -- list of where matches were found
for ln = 0, editor.LineCount - 1 do
local text = editor:GetLine(ln)
if not text then break end -- empty last line without EOL
local x, y = string.find(text, "|msg|")
if x and x > 0 then
table.insert(sentence, text)
table.insert(location, ln)
end
end
if table.getn(sentence) == 0 then return end -- none found
editor:BeginUndoAction() -- allow easy undo
(Continue reading)
However, this means that I often view/search through/edit code that
is not written by me and not even meant for editing, quite often all
on one line and scrambled in various ways. SciTE's performance issues
with such code are really sad to witness. Opening, scrolling,
searching, typing/autocomplete matching - all at times are so slow
that it freezes the whole interface for seconds.
Is this a generally known problem or is it my specific and perhaps
not intended usage that causes it? Perhaps even my settings? (I know
I certainly should turn autocomplete off for such code).
I hope I don't come across as whining. Since I work for Opera
Software's QA department, the source viewer is probably my most
important daily tool, and I appreciate SciTE very, very much.
RSS Feed