Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

[solved] SciTE-Lua: Selection problem

$
0
0

I've an unexpected behavior by selections  in SciTE.

The following script causes, the word under the cursor is selected. This can either apply to the Word character (by pressing Ctrl + Shift + E) or additionally with leading "$" for variables (by pressing Ctrl + E).

 

This works perfectly - as long as the right of the term is a space. If this is not so, then ranges are selected that do not correspond to the markers. Incidentally, it does not matter how I run the selection ( Selection Start / Stop; SetSel (); CharRightExtend () ), always the same behavior.

 

Any Ideas..

 

 Edit: Have found the failure - by default use SciTe "Ctrl+E" to match next brace. No i've changed the hotkey and it works like expected.  :shifty:

Plain Text         
------------------------------------------------------------------------- EditKey = EventClass:new(Common) ------------------------------------------------------------------------- ------------------------------------------------------------------------- -- expand selection to full variable ($variable) or only the word characters (variable) ---------------- SetSelection( ) ----------------------------------------- function SetSelection(_part)     local isWordChar = function(_char)         if string.char(_char):find('[a-zA-Z0-9_]') then return true end         return false     end     local iStart = editor.CurrentPos     local iEnd = iStart     while isWordChar(editor.CharAt[iStart-1]) do         iStart = iStart - 1     end     if string.char(editor.CharAt[iStart-1]) == "$" and _part == false then iStart = iStart - 1 end     while isWordChar(editor.CharAt[iEnd]) do         iEnd = iEnd + 1     end     if iStart ~= iEnd then         editor.SelectionStart = iStart         editor.SelectionEnd   = iEnd     end end -->SetSelection ------------------------------------------------------------------------- ----------------- Event: OnKey ----------------------------------------- function EditKey:OnKey(_keycode, _shift, _ctrl, _alt)     if _ctrl and     _shift and not _alt and _keycode == 69 then SetSelection(true) end   --- expand selection to full word with only Wordcharacters     if _ctrl and not _shift and not _alt and _keycode == 69 then SetSelection(false) end  --- expand selection to full word with Wordcharacters and leading "$"     return nil end  --> EditKey -------------------------------------------------------------------------

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>