9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] sam mod for delete-forward
@ 2001-03-26  8:45 Douglas A. Gwyn
  0 siblings, 0 replies; 9+ messages in thread
From: Douglas A. Gwyn @ 2001-03-26  8:45 UTC (permalink / raw)
  To: 9fans

Recently I got tired of not being able to delete in front of the cursor
with DEL the way most other text editors work these days, so I changed
"samterm" to do that.  I made it conditional on DELFWD so you can compile
it to work either way; this could be made an environmental switch or
command-line option instead.  Or, my preference, officially change sam
to always work this way.

term% diff main.BAK main.c
488d487
< 			case '\b':
489a489,494
> #ifdef DELFWD	/* DAG -- want DEL key to delete forward, not backward */
> 				l->p0 = a;
> 				l->p1 = a<l->origin+l->f.nchars? a+1 : a;
> 				break;
> #endif
> 			case '\b':
490a496
> 				l->p1 = a;
493a500
> 				l->p1 = a;
496a504
> 				l->p1 = a;
499d506
< 			l->p1 = a;

Here is what the updated section of /sys/src/cmd/samterm/main.c looks like:

	}else if(backspacing && !hostlock){
		if(l->f.p0>0 && a>0){
			switch(c){
			case 0x7F:	/* del */
#ifdef DELFWD	/* DAG -- want DEL key to delete forward, not backward */
				l->p0 = a;
				l->p1 = a<l->origin+l->f.nchars? a+1 : a;
				break;
#endif
			case '\b':
				l->p0 = a-1;
				l->p1 = a;
				break;
			case 0x15:	/* ctrl-u */
				l->p0 = ctlu(&t->rasp, l->origin, a);
				l->p1 = a;
				break;
			case 0x17:	/* ctrl-w */
				l->p0 = ctlw(&t->rasp, l->origin, a);
				l->p1 = a;
				break;
			}
			if(l->p1 != l->p0){
				/* cut locally if possible */


^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <rob@plan9.bell-labs.com>]

end of thread, other threads:[~2001-03-29  8:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-26  8:45 [9fans] sam mod for delete-forward Douglas A. Gwyn
     [not found] <rob@plan9.bell-labs.com>
2001-03-26 14:12 ` rob pike
2001-03-26 15:37   ` Douglas A. Gwyn
2001-03-27  8:25     ` Boyd Roberts
2001-03-27 14:01       ` Sam
2001-03-27 16:51         ` Dan Cross
2001-03-28  8:37           ` Douglas A. Gwyn
2001-03-29  8:26             ` Boyd Roberts
2001-03-26 15:42   ` Scott Schwartz

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).