Skip to content

Instantly share code, notes, and snippets.

@pkulchenko
Created January 6, 2018 20:18
Show Gist options
  • Save pkulchenko/44d354e604b79c1ad1810cffb6408cdc to your computer and use it in GitHub Desktop.
Save pkulchenko/44d354e604b79c1ad1810cffb6408cdc to your computer and use it in GitHub Desktop.
Update for highlightselected to work with Output window
diff --git a/highlightselected.lua b/highlightselected.lua
index 14ee4a1..43fa281 100644
--- a/highlightselected.lua
+++ b/highlightselected.lua
@@ -2,23 +2,30 @@
local updateneeded, cfg
local indicname = "highlightselected.selected"
+local function onUpdate(event, editor)
+ if bit.band(event:GetUpdated(), wxstc.wxSTC_UPDATE_SELECTION) > 0 then updateneeded = editor end
+end
return {
name = "Highlight selected",
description = "Highlights all instances of a selected word.",
author = "Paul Kulchenko",
- version = 0.18,
+ version = 0.19,
dependencies = "1.20",
onRegister = function(package)
ide:AddIndicator(indicname)
cfg = package:GetConfig()
+ ide:GetOutput():Connect(wxstc.wxEVT_STC_UPDATEUI, function(event)
+ onUpdate(event, ide:GetOutput())
+ end)
end,
- onUnRegister = function() ide:RemoveIndicator(indicname) end,
-
- onEditorUpdateUI = function(self, editor, event)
- if bit.band(event:GetUpdated(), wxstc.wxSTC_UPDATE_SELECTION) > 0 then updateneeded = editor end
+ onUnRegister = function()
+ ide:RemoveIndicator(indicname)
+ ide:GetOutput():Disconnect(wxstc.wxEVT_STC_UPDATEUI)
end,
+ onEditorUpdateUI = function(self, editor, event) onUpdate(event, editor) end,
+
onIdle = function(self)
if not updateneeded then return end
local editor = updateneeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment