From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from cegelecproj.co.uk ([159.245.72.6]) by hawkwind.utcs.utoronto.ca with SMTP id <24081>; Fri, 7 Apr 1995 03:50:04 -0400 Received: from vampire.cegelecproj.co.uk (cerberus.cegelecproj.co.uk) by cegelecproj.co.uk (4.1/SMI-4.1) id AA24866; Fri, 7 Apr 95 08:49:54 BST Received: from spirit.cegelecproj.co.uk (spirit.limbo.cegelecproj.co.uk) by vampire.cegelecproj.co.uk (5.0/SMI-SVR4) id AA05194; Fri, 7 Apr 1995 08:48:54 +0000 Received: by spirit.cegelecproj.co.uk (5.0/SMI-SVR4) id AA01265; Fri, 7 Apr 1995 08:49:42 +0000 Date: Fri, 7 Apr 1995 04:49:42 -0400 From: Steve_Kilbane@cegelecproj.co.uk (Steve_Kilbane) Message-Id: <9504070749.AA01265@spirit.cegelecproj.co.uk> X-Planation: X-Faces images can be viewed with the XFaces program To: sam-fans@hawkwind.utcs.toronto.edu Subject: 9term mark patch X-Face: Iqsa(US9p?)Y^W+6Ff[Z]rM"uFE) lFDjag1e]\/#2 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: