Kein-Hong Man | 1 May 11:40
Picon

Re: Question for sorting lines

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)

Kein-Hong Man | 1 May 12:19
Picon

Re: Question for sorting lines

Kein-Hong Man wrote:
> 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:

Sorry 'bout having to reply to my own posts, I made a blunder. 
Here is a function that does word count:

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
(Continue reading)

Neil Hodgson | 2 May 06:31
Picon

Re: Scite ends (crashes?) with php Files

Evan Panagiotopoulos:

> Immediately after installation, I go to File -> Open and if I select
> any php file the program closes. It does work on txt files, though.

   Works for me using SciTE 1.63 on Windows 2000 using this file x.php:

<?php
// break
$a = '<?xml';
$a = 'Hello';
// break
$b = 'version="1.0"?>';
$b = "${a} or {$a}). Bye";
?>

   Neil
Neil Hodgson | 2 May 06:53
Picon

Re: Local options somewhere else?

   This does not look like a good idea to me. Current local properties
files move with the files they refer to so will still be valid through
moves or downloads from source control to different locations. Adding
another mechanism looks like adding more complexity than it is  worth.
My advice is to write a script that backs up and restores your
SciTE.properties files into/from a shadow directory tree that mirrors
your file system.

   On Linux, you could alter SciTE to prepend a prefix directory
before the file directory whenever opening the local properties file
so that the local properties for /code/widget/x.cxx would be opened
from ~/.SciTE/code/widget/SciTE.properties. This doesn't work so well
on Windows due to the multi-rooted file system. It is unlikely that I
will include this or a similar addition to the main distribution.

   Neil
kanutron (lists | 2 May 07:10

Re: Scite ends (crashes?) with php Files

Neil Hodgson:
> Evan Panagiotopoulos:
>>Immediately after installation, I go to File -> Open and if I select
>>any php file the program closes. It does work on txt files, though.
> 
>    Works for me using SciTE 1.63 on Windows 2000 using this file x.php:
> 
> <?php
> // break
> $a = '<?xml';
> $a = 'Hello';
> // break
> $b = 'version="1.0"?>';
> $b = "${a} or {$a}). Bye";
> ?>
> 

Works for me too using the same file but under Linux with SciTE 1.63 (GTK).

--

-- 
kanutron (aka Josepmaria Roca)
* mailinglists <at> kanutron.net
* http://kanutron.net/
-----------------------------------------------------------------------------
" las opiniones son como los culos,
   todo el mundo tiene el suyo "
                 - Harry Challahan -
Neil Hodgson | 2 May 08:27
Picon

Re: Re: OnUpdateUI and Lua

Bruce Dodson:

> I wouldn't be surprised if OnUpdateUI would "just work" now
> if it were added back.  

   OK, reenabled and committed.

   Neil
Philippe Lhoste | 3 May 15:26
Picon

Re: Re: OnUpdateUI and Lua

Neil Hodgson wrote:
> Bruce Dodson:
> 
>> I wouldn't be surprised if OnUpdateUI would "just work" now
>> if it were added back.  
> 
>    OK, reenabled and committed.

Good.
What about the OnStyle? I asked about it, but I never found time to try 
and reactivate it.
If it works now (can't remember why it failed, perhaps a reentrency 
problem), many users would be happy to have it, with a big need for 
scriptable lexers.

--

-- 
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --
Neil Hodgson | 4 May 12:29
Picon

Re: Re: OnUpdateUI and Lua

Philippe Lhoste:

> What about the OnStyle? I asked about it, but I never found time to try
> and reactivate it.
> If it works now (can't remember why it failed, perhaps a reentrency
> problem), many users would be happy to have it, with a big need for
> scriptable lexers.

   I had a quick look and it differs from the other methods in that it
has an Accessor argument so wrapping would be a little more complex.
Maybe this was done in the past but I haven't found the source code.

   Neil
Bruce Dodson | 5 May 16:40
Picon

Re: Re: OnUpdateUI and Lua

I will look through my archives.  I did have that event handler at one time. 
I removed it for two reasons: (1) the reentrancy problems; and (2) it seemed 
to work at a much lower level than the rest of the scripting interface. 
Issue 1 is probably solved now.  Issue 2 might benefit from a higher level 
wrapper around the OnStyle event handler.

Bruce

"Neil Hodgson" <nyamatongwe <at> gmail.com> wrote in message 
news:50862ebd050504032973479231 <at> mail.gmail.com...
> Philippe Lhoste:
>
>> What about the OnStyle? I asked about it, but I never found time to try
>> and reactivate it.
>> If it works now (can't remember why it failed, perhaps a reentrency
>> problem), many users would be happy to have it, with a big need for
>> scriptable lexers.
>
>   I had a quick look and it differs from the other methods in that it
> has an Accessor argument so wrapping would be a little more complex.
> Maybe this was done in the past but I haven't found the source code.
>
>   Neil 

SciTE performance

I use SciTE as my browsers' source viewer because it's so light-
weight and lovely, and quick to start. Not that startup time matters 
anymore, I think SciTE has always been running on this machine since 
the day I worked out how to configure it to show tabs for the buffers 
:-)
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.
--

-- 
Hallvord Reiar Michaelsen Steen
http://www.hallvord.com/

Gmane