sam-fans - fans of the sam editor
 help / color / mirror / Atom feed
From: Steve_Kilbane@cegelecproj.co.uk (Steve_Kilbane)
To: sam-fans@hawkwind.utcs.toronto.edu
Subject: 9term mark patch
Date: Fri, 7 Apr 1995 04:49:42 -0400	[thread overview]
Message-ID: <9504070749.AA01265@spirit.cegelecproj.co.uk> (raw)

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:


                 reply	other threads:[~1995-04-07  7:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9504070749.AA01265@spirit.cegelecproj.co.uk \
    --to=steve_kilbane@cegelecproj.co.uk \
    --cc=sam-fans@hawkwind.utcs.toronto.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).