sam-fans - fans of the sam editor
 help / color / mirror / Atom feed
* 9term mark patch
@ 1995-04-07  8:49 Steve_Kilbane
  0 siblings, 0 replies; only message in thread
From: Steve_Kilbane @ 1995-04-07  8:49 UTC (permalink / raw)
  To: sam-fans

This is a patch for 9term 1.6.3. It adds another toggled option to menu button 2,
with the values "mark" and "select". The former records the current position of
selected text, while the latter selects all text between the saved position and
the current selection, inclusive.

Enjoy,

steve

diff -c orig/9term.c hacked/9term.c
*** orig/9term.c	Fri Apr  7 08:39:32 1995
--- hacked/9term.c	Fri Apr  7 08:42:08 1995
***************
*** 25,36 ****
  int		waterquantum;
  int		beepmask;
  int		ninewm;
  
! static char	*items[] = { "cut", "paste", "snarf", "send", "scroll", 0 };
  static Menu	edit = {items};
  enum {	mCUT,
  	mPASTE,
  	mSNARF,
  	mSEND,
  	mSCROLL
  };
--- 25,39 ----
  int		waterquantum;
  int		beepmask;
  int		ninewm;
+ static long	mark0, mark1;
+ static int	markset;
  
! static char	*items[] = { "cut", "paste", "snarf", "mark", "send", "scroll", 0 };
  static Menu	edit = {items};
  enum {	mCUT,
  	mPASTE,
  	mSNARF,
+ 	mMARK,
  	mSEND,
  	mSCROLL
  };
***************
*** 398,403 ****
--- 401,407 ----
  	static Rune nl[] = { '\n', 0 };
  
  	specialchars(slave_fd);
+ 	edit.item[mMARK] = markset?"select":"mark";
  	edit.item[mSCROLL] = text->scrolling?"noscroll":"scroll";
  	switch (menuhit(2, m, &edit))
  	{
***************
*** 415,420 ****
--- 419,440 ----
  		if (text->snarfed) {
  			textdelete(text, text->p0, text->p1);
  			inputrune(text, text->snarfed, text->snarflen);
+ 		}
+ 		break;
+ 	case mMARK:			/* save point, or select to point */
+ 		if (markset) {
+ 			ulong m0, m1;
+ 
+ 			m0 = (mark0 < text->p0)? mark0 : text->p0;
+ 			m1 = (mark1 > text->p1)? mark1 : text->p1;
+ 			markset = 0;
+ 			if (m0 < text->base || text->end < m0)
+ 				textset(text, _backnl(text, m0, 3));
+ 			texthighlight(text,m0,m1, F & ~D);
+ 		} else {
+ 			mark0 = text->p0;
+ 			mark1 = text->p1;
+ 			markset = 1;
  		}
  		break;
  	case mSEND:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-04-07  7:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-04-07  8:49 9term mark patch Steve_Kilbane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).