Home Download Buy Blog Forum Support

[BUG] Using glueMarkedUndoGroups from a QuickPanel

[BUG] Using glueMarkedUndoGroups from a QuickPanel

Postby edanm on Mon May 10, 2010 8:52 pm

I've run into the following situation:
I'd like to use the "markUndoGroupsForGluing" and "glueMarkedUndoGroups" commands to support multiple-undo in my command.

This works fine in normal use, but when I try to use this as part of the "onDone" function which is run when a QuickPanel ends, the "glueMarkedUndoGroups" command runs out of memory.
I'm guessing this is either a problem with the way I'm using it, or a bug in the command itself as it relates to the QuickPanel.

Example code (this just adds "a" to the beginning of every selection in the view).
This crashes when run with selections on 20 lines (i.e. 20 selections at the beginning of each line).

Code: Select all
class myTest(sublimeplugin.TextCommand):
   def run(self, view, args):
      self.view = view
      window = view.window()
      window.showInputPanel('Test', "", self.onDone, None, None)

   def onDone(self, input):
      selections = self.view.sel()
      to_insert = ["a"] * len(selections)

      self.view.runCommand("markUndoGroupsForGluing")
      for i, region in enumerate(selections):
         self.view.replace(region, to_insert[i])
      self.view.runCommand("glueMarkedUndoGroups")


Related thread: http://www.sublimetext.com/forum/viewtopic.php?f=6&t=1157&start=0
edanm
 
Posts: 131
Joined: Thu Mar 04, 2010 11:05 pm

Re: [BUG] Using glueMarkedUndoGroups from a QuickPanel

Postby jps on Wed May 12, 2010 1:49 pm

This is a bug in glueMarkedUndoGroups, it'll be fixed in the next beta.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: [BUG] Using glueMarkedUndoGroups from a QuickPanel

Postby edanm on Wed May 12, 2010 5:00 pm

Excellent, thanks!
edanm
 
Posts: 131
Joined: Thu Mar 04, 2010 11:05 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 25 guests