-- TIME_STAMP 2013-05-22 23:43:28 -- by BugFix EditKey = EventClass:new(Common) ------------------- Description ----------------------------------------- -- EvtOnChar(charAdded) -- -- Ctrl+Shift+Up -- Move the selected lines up one line, shifting the line above after the selection -- Ctrl+Shift+Down -- Move the selected lines down one line, shifting the line below before the selection -- Ctrl+U -- Unselect any existing selection. -- Ctrl+Shift+T -- Toggle left with right char from cursor -- -- Parameters: -- _keycode - numeric, keycode from pressed key -- _shift - bool, Shift -- _ctrl - bool, Ctrl -- _alt - bool, Alt ------------------------------------------------------------------------- ----------------- Event: OnKey ----------------------------------------- function EditKey:OnKey(_keycode, _shift, _ctrl, _alt) --~ print('_keycode: '..tostring(_keycode)..', _shift: '..tostring(_shift)..', _ctrl: '..tostring(_ctrl)..', _alt: '..tostring(_alt)) -- DebugToConsole if _ctrl and _shift and _keycode == 38 then editor:BeginUndoAction() editor:MoveSelectedLinesUp() editor:EndUndoAction() end --- move line/selected lines up if _ctrl and _shift and _keycode == 40 then editor:BeginUndoAction() editor:MoveSelectedLinesDown() editor:EndUndoAction() end --- move line/selected lines down if _ctrl and _keycode == 85 then editor:BeginUndoAction() caret = editor.CurrentPos editor:SetSel(caret, caret) editor:EndUndoAction() end --- unselect any selection if _ctrl and _shift and _keycode == 84 then --- toggle char left with char right from cursor editor:BeginUndoAction() caret = editor.CurrentPos editor:SetSel(caret-1, caret) charLeft = editor:GetSelText() editor:SetSel(caret, caret+1) charRight = editor:GetSelText() editor:ReplaceSel(charLeft) editor:SetSel(caret-1, caret) editor:ReplaceSel(charRight) editor:SetSel(caret, caret) editor:EndUndoAction() end return nil end --> EditKey -------------------------------------------------------------------------