Package: scite
Version: 1.76-1
Severity: normal

I use SciTE on Windows, Debian (Lenny & Squeeze), CentOS and Ubuntu. I have a 
startup script which adds a sort function to SciTE, that function works in all 
SciTE installs I have except Debian.

This is the startup script I use (~/scite_commands.lua):

-- From http://lua-users.org/wiki/SciteSortSelection.
 
-- Sort a selected text
 
function lines(str)
  local t = {}
  local i, lstr = 1, #str
  while i <= lstr do
    local x, y = string.find(str, "\r?\n", i)
    if x then t[#t + 1] = string.sub(str, i, x - 1)
    else break
    end
    i = y + 1
  end
  if i <= lstr then t[#t + 1] = string.sub(str, i) end
  return t
end
 
function sort_text()
  local sel = editor:GetSelText()
  if #sel == 0 then return end
  local eol = string.match(sel, "\n$")
  local buf = lines(sel)
  --table.foreach(buf, print) --used for debugging
  table.sort(buf)
  local out = table.concat(buf, "\n")
  if eol then out = out.."\n" end
  editor:ReplaceSel(out)
end
 
function sort_text_reverse()
  local sel = editor:GetSelText()
  if #sel == 0 then return end
  local eol = string.match(sel, "\n$")
  local buf = lines(sel)
  --table.foreach(buf, print) --used for debugging
  table.sort(buf, function(a, b) return a > b end)
  local out = table.concat(buf, "\n")
  if eol then out = out.."\n" end
  editor:ReplaceSel(out)
end

This is added to .SciTEUser.properties:

ext.lua.startup.script=$(SciteUserHome)/scite_commands.lua
command.name.1.*=Sort text
command.1.*=sort_text

After restart of SciTE, you should be able to mark some lines and have them 
sorted alpabetically, either by pressing Ctrl+1 or selecting "Tools -> Sort 
text" from the menu.

As stated before, the sort function works in SciTE running on Windows, Ubuntu 
and CentOS, but not in Debian (Lenny or Squeeze).

-- System Information:
Debian Release: 5.0.4
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages scite depends on:
ii  libatk1.0-0             1.22.0-1         The ATK accessibility toolkit
ii  libc6                   2.7-18lenny4     GNU C Library: Shared libraries
ii  libcairo2               1.6.4-7          The Cairo 2D vector graphics libra
ii  libgcc1                 1:4.3.2-1.1      GCC support library
ii  libglib2.0-0            2.16.6-3         The GLib library of C routines
ii  libgtk2.0-0             2.12.12-1~lenny1 The GTK+ graphical user interface 
ii  libpango1.0-0           1.20.5-5+lenny1  Layout and rendering of internatio
ii  libstdc++6              4.3.2-1.1        The GNU Standard C++ Library v3

scite recommends no packages.

scite suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to