Archive of UserLand's first discussion group, started October 5, 1998.

Join and Split outliner commands

Author:Brent Simmons
Posted:4/10/1999; 2:19:29 PM
Topic:Join and Split outliner commands
Msg #:4939
Prev/Next:4938 / 4940

If you're using Frontier 6's wrapping headlines outliner much, you've probably wished for Join and Split commands.

If you're not familiar with the terms, Join means to combine outline lines, Split means to separate one line into two lines.

Below are scripts I've added to my custom menu -- at user.menus.customMenu -- that give me these features.

You should be able to copy-and-paste these scripts right into Frontier.

If you have any questions about editing menus in Frontier, see this page: http://frontier.userland.com/tree$2.5.4.7#menus

Join

Join works like this: if you select a line, it will add the line right below it to the selected line. (Note: a better Join command would join several lines together, but this just joins two lines.)

Here's the script:

local (w = window.frontMost ());
local (okTypes = {scriptType, outlineType});
if okTypes contains window.getType (w) {
	local (s1 = op.getLineText ());
	if not op.go (down, 1) {
		return (true)};
	local (s2 = op.getLineText ());
	if op.go (right, 1) { //are there subheads?
		op.go (left, 1);
		op.go (up, 1);
		return (false)};
	local (s = s1 + " " + s2);
	op.deleteLine ();
	op.setLineText (s)}

Split

If you place your cursor somewhere inside a headline, then choose Split, then the single line will become two lines, split where your cursor was.

Here's the script:

local (w = window.frontMost ());
local (okTypes = {scriptType, outlineType});
if okTypes contains window.getType (w) {
	local (s = op.getLineText ());
	wp.setTextMode (true);
	local (start, end);
	wp.getselect (@start, @end);
	local (s1 = string.mid (s, 1, start));
	local (s2 = string.mid (s, start + 1, infinity));
	if s2 beginsWith " " {
		s2 = string.delete (s2, 1, 1)};
	op.setLineText (s1);
	op.insert (s2, down);
	op.go (up, 1)}



There are responses to this message:


This page was archived on 6/13/2001; 4:49:18 PM.

© Copyright 1998-2001 UserLand Software, Inc.