[ZeroBrane Studio] Re: Help: how do you show a character limit line?

  • From: Mike Soliterman <msoliter@xxxxxxxxx>
  • To: zerobrane@xxxxxxxxxxxxx
  • Date: Mon, 26 Aug 2013 16:12:52 -0700

Hey Paul,

Thanks for the plugin! Small issue: self:GetConfig is nil. I probably
goofed up some settings elsewhere. Otherwise, the plugin (using hard-coded
location and color) works perfectly.

Mike


On Mon, Aug 26, 2013 at 3:51 PM, Paul K <paul@xxxxxxxxxxxxx> wrote:

> Hi Mike,
>
> Yes, it's not exposed through a configuration option, but you can add
> this functionality through a plugin. Just save this as "edgemark.lua"
> in packages/ folder:
>
> return {
>   name = "Mark edge plugin",
>   description = "Marks column edge for long lines.",
>   author = "Paul Kulchenko",
>
>   onEditorLoad = function(self, editor)
>     local config = self:GetConfig()
>     editor:SetEdgeMode(wxstc.wxSTC_EDGE_LINE)
>     editor:SetEdgeColumn(config.column or 80)
>     if config.color then
>       editor:SetEdgeColour(wx.wxColour((table.unpack or
> unpack)(config.color)))
>     end
>   end,
> }
>
> You can then use the following in the config file (the default is 80
> columns and light gray color):
>
> edgemark = {color = {191, 191, 255}, column = 60}
>
> If you are interested in being able to turn word wrap on/off, I have a
> plugin for that as well (save it as wordwrapmenu.lua in packages/):
>
> local G = ...
> local id = G.ID("wordwrapmenu.wordwrapmenu")
> local menuid
> return {
>   name = "Wordwrap plugin",
>   description = "Adds word wrap option to the menu.",
>   author = "Paul Kulchenko",
>
>   onRegister = function(self)
>     local menu =
> ide:GetMenuBar():GetMenu(ide:GetMenuBar():FindMenu(TR("&Edit")))
>     local pos = self:GetConfig().insertat and
>       self:GetConfig().insertat-1 or menu:GetMenuItemCount()
>     menuid = menu:InsertCheckItem(pos, id, "WordWrap\tAlt-W")
>     ide:GetMainFrame():Connect(id, wx.wxEVT_COMMAND_MENU_SELECTED,
>       function (event)
>         local wrap = event:IsChecked() and wxstc.wxSTC_WRAP_WORD or
> wxstc.wxSTC_WRAP_NONE
>         GetEditor():SetWrapMode(wrap) end)
>     ide:GetMainFrame():Connect(id, wx.wxEVT_UPDATE_UI,
>       function (event)
>         event:Check(GetEditor():GetWrapMode() ~= wxstc.wxSTC_WRAP_NONE)
> end)
>   end,
>
>   onUnRegister = function(self)
>     local menu =
> ide:GetMenuBar():GetMenu(ide:GetMenuBar():FindMenu(TR("&Edit")))
>     ide:GetMainFrame():Disconnect(id, wx.wxID_ANY, wx.wxID_ANY)
>     if menuid then menu:Destroy(menuid) end
>   end,
> }
>
> Paul.
>
> On Mon, Aug 26, 2013 at 3:22 PM, Mike Soliterman <msoliter@xxxxxxxxx>
> wrote:
> > Hey ZB folks,
> >
> > I'm trying to get my standard 80-character limit line in ZB Studio, but
> > there doesn't seem to be any configuration option for it. Does anyone
> have a
> > suggestion on how to proceed?
> >
> > The line doesn't have to forcibly wrap code, I just need it as a
> delineation
> > of the text space.
> >
> > Thanks,
> > Mike (msoliter@xxxxxxxxx)
>
>

Other related posts: