And my final solution for highlighting a columnar block is:
ic(32,COUNT,crn-cn);#103=cp;cb(cn);ri(0);bb(#103);c(-1);be(cp);ce(cn)
And the secret about all that effort?
I wanted to write some de luxe cut and paste functions.
A description of functionality and outcome is given below.
^C: Store the marked block. The current mode, stream or column, is used.
Also store the information, whether the block contains a newline (#11).
Complete block marking (so the block may be left if persistent blocks are
configured).
^X: Basic function is like that of ^C. Additionaly:
If insert mode, delete the block.
If overwrite mode, backfill the block with blanks.
Backfill is not done, if stream mode and newline contained.
^V: If insert mode, insert column/stream block. Always insert, if newline
contained in a stream block.
If overwrite mode, overwrite. If stream mode, overwrite within current
line, i.e. newline will not be overridden!
If insert mode, insert.
In any case: highlight the pasted block.
The keystroke macros are listed below - for everybody, interested.
Ctrl-C [VISUAL EXIT]if(bb==CLEAR){re(11)}else{if(be==CLEAR)
{be(cp)}if(cm){ic(32,COUNT,crn-cn)}#103=cp;if(cm){#11=0;gp(min(bb,be));
#104=bolpos+min(cb,ce)-1;gp(max(bb,be));#105=bolpos+max(cb,ce);
rcb(11,#104,#105,COLUMN)}else{#11=sb("|N",bb,be,BEGIN+NOERR);rcb(11,bb,be)}gp(#103)}v
Ctrl-X [VISUAL EXIT]if(bb==CLEAR){re(11)}else{if(be==CLEAR){be(cp)}
if(cm){ic(32,COUNT,crn-cn)}sm(0,cp);#103=cp;if(cm){#11=0;gp(min(bb,be));
#104=bolpos+min(cb,ce)-1;gp(max(bb,be));#105=bolpos+max(cb,ce);
rcb(11,#104,#105,COLUMN+DELETE+(!im)*FILL)}else{#11=sb("|N",bb,be,BEGIN+NOERR);
rcb(11,bb,be,DELETE+(!im&!#11)*FILL)}if(im){gm(0);bb(CLEAR)}else{gp(#103)}}v
Ctrl-V [VISUAL EXIT]bb(CLEAR);if(cm){ic(32,COUNT,crn-cn);#103=cp;
cb(cn);ri(11,(!im&!#11)*OVERWRITE);bb(#103);c(-1);be(cp);ce(cn)}else
{if(im|#11|eolpos-cp
be(cp);gp(bb)}else{ri(11,BEGIN+OVERWRITE);bb(cp);c(rsize(11));be(cp)}}v
Regards
Bernd
|
|