Rock on Sir ! On Wednesday, March 28, 2012 1:56:11 PM UTC+3, Kendall Conrad wrote: > > For anyone that was waiting, I did update the script to include handling > of + listed items. I also added >. I made some other enhancements too while > I was at it. The numerical listing handles both going 3. to 4., but also > 2.4. to 2.5. so it handles decimal numbering or sub sections. Lastly, I > added HTML list item support; it creates a <li> tags, copies the <li> tag's > attributes from the current line, and duplicates them and also places the > cursor inside the tag. > > If you have visited the page before you'll likely need to hit refresh to > ensure you're seeing the latest page updates. I haven't had a chance to do > thorough testing so if you see issues or have other suggestions let me know. > > http://www.angelwatt.com/words/2011/04/11/bbedit-smart-newline-open-line/ > > -Kendall > > On Tuesday, March 27, 2012 9:50:05 AM UTC-4, Kendall Conrad wrote: >> >> The link I provided does have the latest code. If you visited the page >> somewhat recently you may need to do a refresh to see the latest changes. >> The code will state that is was last updated March 26 at the top of the >> code listing. >> >> The updated code does handle doing lists that start with *, #, and -, but >> not +. I thought about it, but couldn't think of anytime I've seen it used. >> It would be very easy to add though to the code. Just edit the section >> "Check for lists" and add \\+ to the two regex finds. It has to be escaped >> since it's a special character for regex. I'll make an update when I get a >> chance, probably within the next 20 hours. >> >> -Kendall >> >> On Tuesday, March 27, 2012 2:18:19 AM UTC-4, KG wrote: >>> >>> @Kendall : just one more thing, can you provide a link to the latest >>> source. from the url you provided i don't see the numbered list edit that >>> you said you made >>> >>> Thanks >>> >>> On Tuesday, March 27, 2012 5:14:31 AM UTC+3, Kendall Conrad wrote: >>>> >>>> My Smart Newline script can achieve this. You can examine the code >>>> near the top to see how I capture to white space at the start of the >>>> line if that's all you care about. I also updated the script this >>>> evening to also handle numbered lists, which was part of the original >>>> discussion question, though this is a little late for that I suppose, >>>> but others might find it useful. >>>> >>>> >>>> http://www.angelwatt.com/words/2011/04/11/bbedit-smart-newline-open-line/ >>>> >>>> -Kendall >>>> >>>> On Mar 26, 4:45 pm, KG <for...@kaush.co> wrote: >>>> > Hey Christopher, >>>> > >>>> > Just a minor request to your existing script. This works >>>> fantastically if >>>> > you line starts with the bullet. Assuming you have some indentation >>>> like 4 >>>> > tab stops and then the bullet, the script stops. I made a couple of >>>> mods to >>>> > the script as follows: >>>> > >>>> > >>>> --------------------------------------------------------------------------------------- >>>> >>>> >>>> > tell application "BBEdit" >>>> > try >>>> > tell text of front text window >>>> > set lineOfInsertionPoint to line (startLine of >>>> selection) >>>> > set findReco to find "^\\d+\\." searching in >>>> > lineOfInsertionPoint options {search mode:grep} >>>> > if found of findReco = true then >>>> > set leadingNumber to text 1 thru -2 of (found >>>> text of >>>> > findReco) >>>> > set text of selection to return & (leadingNumber >>>> + 1) & >>>> > ". " >>>> > select insertion point after selection >>>> > else if found of findReco = false then >>>> > set findReco to find "^\\* " searching in >>>> > lineOfInsertionPoint options {search mode:grep} >>>> > if found of findReco = true then >>>> > set text of selection to return & "* " >>>> > select insertion point after selection >>>> > else >>>> > set findReco to find "^\\s*\\+" searching in >>>> > lineOfInsertionPoint options {search mode:grep} >>>> > if found of findReco = true then >>>> > >>>> > set text of selection to return & tab & >>>> "+ " >>>> > select insertion point after selection >>>> > end if >>>> > end if >>>> > end if >>>> > end tell >>>> > on error errMsg number errNum >>>> > set sep to "==============================" >>>> > set e to sep & return & "Error: " & errMsg & return & sep >>>> & >>>> > return ¬ >>>> > & "Error Number: " & errNum & return & sep >>>> > beep >>>> > display dialog e >>>> > end try >>>> > end tell >>>> > >>>> --------------------------------------------------------------------------------------- >>>> >>>> >>>> > >>>> > Essentially the \s* helps ignore white space at the beginning. >>>> There's just >>>> > one problem with my script. It inserts the new bullet point ignoring >>>> the >>>> > previous number of tab stops. Is there a way in applescript to get >>>> hold of >>>> > the number of tab stops and insert that at the beginning as well? >>>> > >>>> > Thanks again. >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > On Monday, August 8, 2011 7:04:04 AM UTC+3, Christopher Stone wrote: >>>> > >>>> > > On Aug 07, 2011, at 21:35, oliver wrote: >>>> > >>>> > > I'm thinking it might have to be an AppleScript to select the line >>>> and >>>> > > then call a Text Filter to handle finding the number/star and >>>> appending the >>>> > > next one... but my kung fu is not strong enough to figure it out. >>>> > >>>> > > >>>> ______________________________________________________________________ >>>> > >>>> > > Hey Oliver, >>>> > >>>> > > This is very quick and dirty, but it'll work with the numerical >>>> increment >>>> > > and the asterisk bullet. >>>> > >>>> > > It's expecting the insertion point (cursor) to be at the end of the >>>> line, >>>> > > but it could easily be adjusted so that anywhere in the line would >>>> do. >>>> > >>>> > > You can put it in the script menu and give it a keyboard shortcut >>>> and go >>>> > > to town. >>>> > >>>> > > The logic is pretty straightforward, so you can add more characters >>>> like >>>> > > '•' to the mix if desired. >>>> > >>>> > > -- >>>> > > Best Regards, >>>> > > Chris >>>> > >>>> > > >>>> ______________________________________________________________________ >>>> > >>>> > > tell application "BBEdit" >>>> > > try >>>> > > tell text of front text window >>>> > > set lineOfInsertionPoint to line (startLine of selection) >>>> > > set findReco to find "^\\d+\\." searching in >>>> lineOfInsertionPoint >>>> > > options {search mode:grep} >>>> > > if found of findReco = true then >>>> > > set leadingNumber to text 1 thru -2 of (found text of >>>> findReco) >>>> > > set text of selection to return & (leadingNumber + 1) & ". >>>> " >>>> > > select insertion point after selection >>>> > > else if found of findReco = false then >>>> > > set findReco to find "^\\* " searching in >>>> lineOfInsertionPoint >>>> > > options {search mode:grep} >>>> > > if found of findReco = true then >>>> > > set text of selection to return & "* " >>>> > > select insertion point after selection >>>> > > end if >>>> > > end if >>>> > > end tell >>>> > > on error errMsg number errNum >>>> > > set sep to "==============================" >>>> > > set e to sep & return & "Error: " & errMsg & return & sep & >>>> return ¬ >>>> > > & "Error Number: " & errNum & return & sep >>>> > > beep >>>> > > display dialog e >>>> > > end try >>>> > > end tell >>> >>>
-- You received this message because you are subscribed to the "BBEdit Talk" discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at <http://groups.google.com/group/bbedit?hl=en> If you have a feature request or would like to report a problem, please email "supp...@barebones.com" rather than posting to the group. Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>