1 /* vi:set syntax= ts=8 sts=8 sw=8 noexpandtab: */
2 /* WARNING: this file is ROSS STYLE */
7 #include "hvl_replay.h"
16 int tcliplen
, icliplen
= 0;
20 if(c
>= '0' && c
<= '9') return c
- '0';
21 if(c
>= 'a' && c
<= 'f') return c
- 'a' + 10;
28 for(int i
= 1; i
<= 0xff; i
++){
29 for(int j
= 0; j
< tune
->tracklen
; j
++){
30 if(tune
->trk
[i
].line
[j
].note
) skiptherest
= 1;
31 for(int k
= 0; k
< 2; k
++){
32 if(tune
->trk
[i
].line
[j
].cmd
[k
]) skiptherest
= 1;
33 if(tune
->trk
[i
].line
[j
].param
[k
]) skiptherest
= 1;
36 // skip the rest of this track?
42 // this track is free, so return the index
43 if(j
== (tune
->tracklen
)-1) return i
;
47 setdisplay("nextfreetrack() failed somehow..");
52 for(int i
= 1; i
<= 0xff; i
++){
53 if(instrument
[i
].line
[0].cmd
== '0')
57 setdisplay("nextfreeinstr() failed somehow..");
68 && instrument
[currinstr
].line
[instry
].cmd
!= '+'
69 && instrument
[currinstr
].line
[instry
].cmd
!= '='){
71 case 1: SETHI(instrument
[currinstr
].line
[instry
].param
, x
); break;
72 case 2: SETLO(instrument
[currinstr
].line
[instry
].param
, x
); break;
75 if(currtab
== 1 && trackx
> 1){
77 case 2: SETHI(tune
->trk
[currtrack
].line
[tracky
].instr
, x
); break;
78 case 3: SETLO(tune
->trk
[currtrack
].line
[tracky
].instr
, x
); break;
79 case 5: if(tune
->trk
[currtrack
].line
[tracky
].cmd
[0])
80 SETHI(tune
->trk
[currtrack
].line
[tracky
].param
[0], x
); break;
81 case 6: if(tune
->trk
[currtrack
].line
[tracky
].cmd
[0])
82 SETLO(tune
->trk
[currtrack
].line
[tracky
].param
[0], x
); break;
83 case 8: if(tune
->trk
[currtrack
].line
[tracky
].cmd
[1])
84 SETHI(tune
->trk
[currtrack
].line
[tracky
].param
[1], x
); break;
85 case 9: if(tune
->trk
[currtrack
].line
[tracky
].cmd
[1])
86 SETLO(tune
->trk
[currtrack
].line
[tracky
].param
[1], x
); break;
91 case 0: SETHI(tune
->sng
[songy
].track
[songx
/ 4], x
); break;
92 case 1: SETLO(tune
->sng
[songy
].track
[songx
/ 4], x
); break;
93 case 2: SETHI(tune
->sng
[songy
].transp
[songx
/ 4], x
); break;
94 case 3: SETLO(tune
->sng
[songy
].transp
[songx
/ 4], x
); break;
102 && (instrument
[currinstr
].line
[instry
].cmd
== '+' || instrument
[currinstr
].line
[instry
].cmd
== '=')){
103 instrument
[currinstr
].line
[instry
].param
= x
;
105 if(currtab
== 1 && !trackx
){
106 tune
->trk
[currtrack
].line
[tracky
].note
= x
;
107 //htTune->ht_Tracks[currtrack][tracky].stp_Note = x;
109 tune
->trk
[currtrack
].line
[tracky
].instr
= currinstr
;
110 //htTune->ht_Tracks[currtrack][tracky].stp_Instrument = currinstr;
112 tune
->trk
[currtrack
].line
[tracky
].instr
= 0;
115 //shouldn't have to use this if statement...grr...
116 if(tune
->type
== LFT
) tune
->iedplonk(x
, currinstr
, tune
);
117 //if(tune->type == AHX) tune->iedplonk(x, currinstr, htTune);
118 if(tune
->type
== AHX
){
124 //hvl_playNote(htTune, (int8 *) hivelyLeft, (int8 *) hivelyRight, 2, &htTune->ht_Voices[0]);
125 //htTune->curNote = x;
129 if(currtab
== 2 && instrx
== 0){
130 if(strchr(validcmds
, c
))
131 instrument
[currinstr
].line
[instry
].cmd
= c
;
133 if(currtab
== 1 && (trackx
== 4 || trackx
== 7)){
134 if(strchr(validcmds
, c
)){
135 if(c
== '.' || c
== '0') c
= 0;
136 tune
->trk
[currtrack
].line
[tracky
].cmd
[(trackx
- 3) / 3] = c
;
143 // _isnumber() determines if a string is a number
144 // returns 1 if the given arg is a number, 0 otherwise.
145 // for use with isdigit(), isxdigit(), etc...
146 int _isnumber(const char* str
, int (*func
) (int)){
152 }else if( str
[i
]=='\0' ){
160 // Converts a hexadecimal string to integer
162 // 0: conversion successful
163 // 1: string is empty
164 // 2: string has more than 8 bytes
165 // 4: Conversion is in process but abnormally terminated by
166 // illegal hexadecimal character
167 // from http://devpinoy.org/blogs/cvega/archive/2006/06/19/xtoi-hex-to-integer-c-function.aspx
168 int xtoi(const char* xs
, unsigned int* result
){
169 size_t szlen
= strlen(xs
);
173 // Converting more than 32bit hexadecimal value?
174 if (szlen
>8) return 2; // exit
176 // Begin conversion here
180 // Run until no more character to convert
181 for(i
=szlen
-1; i
>=0 ;i
--){
182 if(isxdigit(*(xs
+i
))){
184 xv
= ( *(xs
+i
) - 97) + 10;
185 }else if( *(xs
+i
) >= 65){
186 xv
= (*(xs
+i
) - 65) + 10;
190 *result
+= (xv
* fact
);
193 // Conversion was abnormally terminated
194 // by non hexadecimal digit, hence
195 // returning only the converted with
196 // an error value 4 (illegal hex character)
201 // Nothing to convert
205 void _parsecmd(char cmd
[]){
208 if(strcmp(cmd
, ":w") == 0){
209 lft_savefile(filename
);
211 }else if(strcmp(cmd
, ":q") == 0){
213 setdisplay("no write since last change! use :q! to override");
220 }else if(strcmp(cmd
, ":q!") == 0){
225 }else if(strcmp(cmd
, ":write") == 0){
226 lft_savefile(filename
);
228 }else if(strcmp(cmd
, ":wq") == 0 || strcmp(cmd
, ":x") == 0){
229 lft_savefile(filename
);
235 }else if(strcmp(cmd
, ":quit") == 0){
240 }else if(cmd
[1]=='e' && cmd
[2]==' '){
241 // if the file doesn't exist, clear the song
242 if(lft_loadfile(cmd
+3)){
247 //yucky if statement below.....probably better way to do it
248 // maybe this is better??
249 }else if(!strncmp(cmd
+1,"save ",5)){
250 lft_saveinstrument(cmd
+6);
251 setdisplay("d-_-b saved ins! d-_-b");
252 }else if(!strncmp(cmd
+1,"load ",5)){
253 lft_loadinstrument(cmd
+6);
254 setdisplay("d-_-b loaded ins! d-_-b");
255 }else if( _isnumber((char *)cmd
+1,isxdigit
) ){
256 unsigned int goton
= 1;
261 songy
= (goton
>tune
->songlen
)? tune
->songlen
-1 : goton
;
264 currtrack
= (goton
>0xff)? 0xff : goton
;
267 currinstr
= (goton
>0xff)? 0xff : goton
;
270 }else if(cmd
[1] == 'c' && cmd
[2] == ' '){
271 strncpy(comment
, cmd
+3, sizeof(comment
));
273 setdisplay("not a tracker command!");
278 void normalmode(int c
){
281 // don't save the action for repeat if it's a movement or a repeat, or
282 // something else that doesnt make sense to repeat
298 lastrepeatnum
= cmdrepeatnum
;
301 for(i
=0; i
<cmdrepeatnum
; i
++){
308 // if the last command was a replace, just insert the last thing
309 // inserted instead of calling insertmode()
310 if(lastaction
== 'r')
311 _insertc(lastinsert
);
313 normalmode(lastaction
);
314 cmdrepeatnum
= lastrepeatnum
;
324 if(songy
==getmaxy(stdscr
)-3+songoffs
)
331 if(tracky
==getmaxy(stdscr
)-3+trackoffs
)
338 if(instry
==getmaxy(stdscr
)-3+instroffs
)
348 if(songy
<=tune
->songlen
-2){
355 if(tracky
<=(tune
->tracklen
)-2){
356 if(tracky
==trackoffs
)
362 if(instry
<=instrument
[currinstr
].length
-2){
363 if(instry
==instroffs
)
384 // the second cases (to the right of the colon) for M and L
385 // took some serious guesswork, so I'm not sure if they're
386 // correct but they seem to work.
390 songy
= (tune
->songlen
<= getmaxy(stdscr
)-2)?
392 : ((getmaxy(stdscr
)-6)/2) + songoffs
;
395 tracky
= (tune
->tracklen
<= getmaxy(stdscr
)-2)?
397 : ((getmaxy(stdscr
)-6)/2) + trackoffs
;
400 instry
= (instrument
[currinstr
].length
<= getmaxy(stdscr
)-2)?
401 instrument
[currinstr
].length
/2
402 : ((getmaxy(stdscr
)-6)/2) + instroffs
;
409 songy
= (tune
->songlen
<= getmaxy(stdscr
)-2)?
411 : getmaxy(stdscr
)-3+songoffs
;
414 tracky
= (tune
->tracklen
<= getmaxy(stdscr
)-2)?
416 : getmaxy(stdscr
)-3+trackoffs
;
419 instry
= (instrument
[currinstr
].length
<= getmaxy(stdscr
)-2)?
420 instrument
[currinstr
].length
-1
421 : getmaxy(stdscr
)-3+instroffs
;
426 if(nextchar() == 'g'){
442 memcpy(&tclip
, &tune
->sng
[songy
], sizeof(struct songline
));
443 }else if(currtab
== 1){
445 memcpy(&tclip
, &tune
->trk
[currtrack
].line
[tracky
], sizeof(struct trackline
));
446 }else if(currtab
== 2){
448 memcpy(&iclip
, &instrument
[currinstr
].line
[instry
], sizeof(struct instrline
));
455 memcpy(&tclip
[0], &tune
->sng
[songy
], sizeof(struct songline
));
457 memcpy(&tclip
[1], &tune
->sng
[songy
], sizeof(struct songline
));
458 }else if(currtab
== 1){
460 memcpy(&tclip
[0], &tune
->trk
[currtrack
].line
[tracky
], sizeof(struct trackline
));
462 memcpy(&tclip
[1], &tune
->trk
[currtrack
].line
[tracky
], sizeof(struct trackline
));
463 }else if(currtab
== 2){
465 memcpy(&iclip
[0], &instrument
[currinstr
].line
[instry
], sizeof(struct instrline
));
467 memcpy(&iclip
[1], &instrument
[currinstr
].line
[instry
], sizeof(struct instrline
));
474 memcpy(&tclip
[1], &tune
->sng
[songy
], sizeof(struct songline
));
476 memcpy(&tclip
[0], &tune
->sng
[songy
], sizeof(struct songline
));
477 }else if(currtab
== 1){
479 memcpy(&tclip
[1], &tune
->trk
[currtrack
].line
[tracky
], sizeof(struct trackline
));
481 memcpy(&tclip
[0], &tune
->trk
[currtrack
].line
[tracky
], sizeof(struct trackline
));
482 }else if(currtab
== 2){
484 memcpy(&iclip
[1], &instrument
[currinstr
].line
[instry
], sizeof(struct instrline
));
486 memcpy(&iclip
[0], &instrument
[currinstr
].line
[instry
], sizeof(struct instrline
));
495 if(tune
->songlen
< 256){
496 for(int i
= 0; i
< tcliplen
; i
++){
498 memmove(&tune
->sng
[songy
+ 2], &tune
->sng
[songy
+ 1], sizeof(struct songline
) * (tune
->songlen
- songy
- 1));
501 memset(&tune
->sng
[songy
], 0, sizeof(struct songline
));
504 memcpy(&tune
->sng
[songy
], &tclip
[i
], sizeof(struct songline
));
507 }else if(currtab
== 1){
508 for(int i
= 0; i
< tcliplen
; i
++){
509 memcpy(&tune
->trk
[currtrack
].line
[tracky
], &tclip
[i
], sizeof(struct trackline
));
510 if(tracky
< (tune
->tracklen
)-step
) tracky
+= step
;
511 else tracky
= (tune
->tracklen
)-1;
513 }else if(currtab
== 2){
514 if(instrument
[currinstr
].length
< 256){
516 for(int i
= 0; i
< icliplen
; i
++){
517 struct instrument
*in
= &instrument
[currinstr
];
520 memmove(&in
->line
[instry
+ 1], &in
->line
[instry
+ 0], sizeof(struct instrline
) * (in
->length
- instry
));
522 in
->line
[instry
].cmd
= '0';
523 in
->line
[instry
].param
= 0;
526 memcpy(&instrument
[currinstr
].line
[instry
], &iclip
[i
], sizeof(struct instrline
));
529 //if(instry < instrument[currinstr].length-1) instry++;
533 // copy everything in the current phrase or instrument into the next free one
537 memcpy(&tune
->trk
[f
], &tune
->trk
[currtrack
], sizeof(struct track
));
539 }else if(currtab
== 2){
541 memcpy(&instrument
[f
], &instrument
[currinstr
], sizeof(struct instrument
));
546 // TODO: Y and P can be removed after we make visual mode
547 // copy whole phrase or instrument
550 memcpy(&tclip
, &tune
->trk
[currtrack
], sizeof(struct track
));
551 }else if(currtab
== 2){
552 memcpy(&iclip
, &instrument
[currinstr
], sizeof(struct instrument
));
555 // paste whole phrase or instrument
558 memcpy(&tune
->trk
[currtrack
], &tclip
, sizeof(struct track
));
559 }else if(currtab
== 2){
560 memcpy(&instrument
[currinstr
], &iclip
, sizeof(struct instrument
));
565 // TODO: clean this SHIT up
566 // TODO: add an ACT_ function for delete
575 struct instrument
*in
= &instrument
[currinstr
];
580 memmove(&in
->line
[instry
+ 0], &in
->line
[instry
+ 1], sizeof(struct instrline
) * (in
->length
- instry
- 1));
582 if(instry
>= in
->length
) instry
= in
->length
- 1;
585 }else if(currtab
== 0){
589 if(tune
->songlen
> 1){
590 memmove(&tune
->sng
[songy
+ 0], &tune
->sng
[songy
+ 1], sizeof(struct songline
) * (tune
->songlen
- songy
- 1));
592 if(songy
>= tune
->songlen
) songy
= tune
->songlen
- 1;
599 struct instrument
*in
= &instrument
[currinstr
];
604 memmove(&in
->line
[instry
+ 0], &in
->line
[instry
+ 1], sizeof(struct instrline
) * (in
->length
- instry
- 1));
606 if(instry
>= in
->length
) instry
= in
->length
- 1;
609 }else if(currtab
== 0){
612 if(tune
->songlen
> 1){
613 memmove(&tune
->sng
[songy
+ 0], &tune
->sng
[songy
+ 1], sizeof(struct songline
) * (tune
->songlen
- songy
- 1));
615 if(songy
>= tune
->songlen
) songy
= tune
->songlen
- 1;
636 startplaytrack(currtrack
);
637 }else if(currtab
== 0){
639 startplaysong(songy
);
647 lft_savefile(filename
);
661 /* Enter command mode */
669 // TODO: make an act_ function for '`'
672 int t
= tune
->sng
[songy
].track
[songx
/ 4];
676 startplaytrack(currtrack
);
678 }else if((currtab
== 1) && ((trackx
== 2) || (trackx
== 3))){
679 int i
= tune
->trk
[currtrack
].line
[tracky
].instr
;
682 } else if(currtab
== 1){
684 }else if(currtab
== 2){
688 /* Enter insert mode */
692 /* Enter visual mode */
696 /* Enter visual line mode */
700 /* enter jammer mode */
704 /* Add new line and enter insert mode */
729 if(octave
< 8) octave
++;
732 if(currtrack
> 1) currtrack
--;
735 if(currtrack
< 255) currtrack
++;
744 }else if(currtab
== 1){
776 }else if(currtab
== 2){
782 if(instrument
[currinstr
].line
[instry
].cmd
== '+' || instrument
[currinstr
].line
[instry
].cmd
== '='){
789 if(instrument
[currinstr
].line
[instry
].cmd
== '+' || instrument
[currinstr
].line
[instry
].cmd
== '='){
805 }else if(currtab
== 1){
837 }else if(currtab
== 2){
843 if(instrument
[currinstr
].line
[instry
].cmd
== '+' || instrument
[currinstr
].line
[instry
].cmd
== '='){
850 if(instrument
[currinstr
].line
[instry
].cmd
== '+' || instrument
[currinstr
].line
[instry
].cmd
== '='){
862 }else if(currtab
== 1){
869 }else if(currtab
== 1){
918 _insertc(nextchar());
929 /* vi cmdline mode */
930 void cmdlinemode(void){
933 keypad(stdscr
, TRUE
);
935 currmode
= PM_CMDLINE
;
936 strncat(cmdstr
, ":", 100);
944 currmode
= PM_NORMAL
;
952 cmdstr
[strlen(cmdstr
)-1] = '\0';
958 len
= strlen(cmdstr
);
960 cmdstr
[len
++] = '\0';
966 keypad(stdscr
, FALSE
);
971 void insertmode(void){
973 currmode
= PM_INSERT
;
976 if((c
= getch()) != ERR
) switch(c
){
978 currmode
= PM_NORMAL
;
1001 if(octave
< 8) octave
++;
1003 /* change instrument */
1007 }else if(currtab
== 1){
1014 }else if(currtab
== 1){
1037 lft_savefile(filename
);
1053 currmode
= PM_NORMAL
;
1059 startplaytrack(currtrack
);
1060 }else if(currtab
== 0){
1062 startplaysong(songy
);
1068 int t
= tune
->sng
[songy
].track
[songx
/ 4];
1069 if(t
) currtrack
= t
;
1071 }else if(currtab
== 1){
1079 tracky
%= (tune
->tracklen
);
1080 }else if(currtab
== 2){
1081 //if(instry < instrument[currinstr].length-1) instry++;
1082 if(instrx
< 2) instrx
++;
1084 instry
%= instrument
[currinstr
].length
;
1094 void jammermode(void){
1096 currmode
= PM_JAMMER
;
1097 while(currmode
== PM_JAMMER
){
1098 if((c
= getch()) != ERR
) switch(c
){
1100 currmode
= PM_NORMAL
;
1109 if(octave
) octave
--;
1112 if(octave
< 8) octave
++;
1117 //shouldn't have to use this if statement...grr...
1118 if(tune
->type
== LFT
) tune
->iedplonk(x
, currinstr
, tune
);
1119 else if(tune
->type
== AHX
) tune
->iedplonk(x
, currinstr
, htTune
);
1129 void visualmode(void){
1132 currmode
= PM_VISUAL
;
1133 //attrset(A_REVERSE);
1135 }else if(currtab
== 1){
1136 highlight_firstx
= trackx
;
1137 highlight_lastx
= trackx
;
1138 highlight_firsty
= tracky
;
1139 highlight_lasty
= tracky
;
1140 }else if(currtab
== 2){
1142 highlight_firstx
= -1;
1143 highlight_lastx
= -1;
1144 highlight_firsty
= -1;
1145 highlight_lasty
= -1;
1148 while(currmode
== PM_VISUAL
){
1149 if((c
= getch()) != ERR
) switch(c
){
1152 currmode
= PM_NORMAL
;
1160 }else if(currtab
==1){
1161 highlight_lastx
= trackx
;
1162 }else if(currtab
==2){
1168 }else if(currtab
==1){
1169 highlight_lasty
= tracky
;
1170 }else if(currtab
==2){
1176 }else if(currtab
==1){
1177 highlight_lasty
= tracky
;
1178 }else if(currtab
==2){
1184 }else if(currtab
==1){
1185 highlight_lastx
= trackx
;
1186 }else if(currtab
==2){
1196 /* visual line mode */
1197 void visuallinemode(void){
1202 currmode
= PM_VISUALLINE
;
1204 /* Store the current line as the first and last node of a linked list */
1206 highlight_firstline
= songy
;
1207 highlight_lastline
= songy
;
1208 }else if(currtab
==1){
1209 highlight_firstline
= tracky
;
1210 highlight_lastline
= tracky
;
1211 }else if(currtab
==2){
1212 highlight_firstline
= instry
;
1213 highlight_lastline
= instry
;
1215 highlight_firstline
= -1;
1216 highlight_lastline
= -1;
1219 // initialize difference
1220 highlight_lineamount
= 1;
1222 // make it visible to gui.c
1223 //highlightlines = firstnode;
1225 while(currmode
== PM_VISUALLINE
){
1226 if((c
= getch()) != ERR
) switch(c
){
1229 currmode
= PM_NORMAL
;
1240 highlight_lastline
= songy
;
1241 }else if(currtab
==1){
1242 highlight_lastline
= tracky
;
1243 }else if(currtab
==2){
1244 highlight_lastline
= instry
;
1246 // update the highlighted length
1247 highlight_lineamount
= (highlight_firstline
>highlight_lastline
)?
1248 highlight_firstline
- highlight_lastline
+1
1249 : highlight_lastline
- highlight_firstline
+1;
1255 highlight_lastline
= songy
;
1256 }else if(currtab
==1){
1257 highlight_lastline
= tracky
;
1258 }else if(currtab
==2){
1259 highlight_lastline
= instry
;
1261 // update the highlighted length
1262 highlight_lineamount
= (highlight_firstline
>highlight_lastline
)?
1263 highlight_firstline
- highlight_lastline
+1
1264 : highlight_lastline
- highlight_firstline
+1;
1270 if(nextchar() == 'g'){
1277 // d: copy every line that is highlighted to the paste buffer and clear them, too
1279 min
= (highlight_firstline
< highlight_lastline
)?
1281 : highlight_lastline
;
1282 max
= (highlight_firstline
< highlight_lastline
)?
1284 : highlight_firstline
;
1286 for(int i
=min
; i
<=max
; i
++)
1287 act_clrinsongtab(i
);
1288 }else if(currtab
== 1){
1289 for(int i
=min
; i
<=max
; i
++)
1290 act_clrintracktab(currtrack
, i
);
1291 }else if(currtab
== 2){
1292 for(int i
=min
; i
<=max
; i
++)
1293 act_clrininstrtab(currinstr
, i
);
1295 //snprintf(buf, sizeof(buf), "%d fewer lines", highlight_lineamount);
1296 //infinitemsg = buf;
1297 currmode
= PM_NORMAL
;
1299 // y: copy every line that is highlighted to the paste buffer
1303 //memcpy(&tclip, &tune->sng[songy], sizeof(struct songline)*highlight_lineamount);
1304 tcliplen
= highlight_lineamount
;
1305 //moved up, then yanked
1306 if(highlight_firstline
> highlight_lastline
){
1307 for(int i
= 0; i
< highlight_lineamount
; i
++)
1308 memcpy(&tclip
[i
], &tune
->sng
[songy
+i
], sizeof(struct songline
));
1309 //moved down, then yanked
1310 }else if(highlight_lastline
> highlight_firstline
){
1311 for(int i
= highlight_lineamount
-1, j
= 0; i
>= 0; i
--, j
++){
1312 memcpy(&tclip
[i
], &tune
->sng
[songy
-j
], sizeof(struct songline
));
1315 }else if(currtab
== 1){
1316 tcliplen
= highlight_lineamount
;
1317 //moved up, then yanked
1318 if(highlight_firstline
> highlight_lastline
){
1319 for(int i
= 0; i
< highlight_lineamount
; i
++)
1320 memcpy(&tclip
[i
], &tune
->trk
[currtrack
].line
[tracky
+i
], sizeof(struct trackline
));
1321 //moved down, then yanked
1322 }else if(highlight_lastline
> highlight_firstline
){
1323 for(int i
= highlight_lineamount
-1, j
= 0; i
>= 0; i
--, j
++){
1324 memcpy(&tclip
[i
], &tune
->trk
[currtrack
].line
[tracky
-j
], sizeof(struct trackline
));
1327 }else if(currtab
== 2){
1329 //memcpy(&iclip, &instrument[currinstr].line[instry], sizeof(struct instrline)*highlight_lineamount);
1330 icliplen
= highlight_lineamount
;
1331 //moved up, then yanked
1332 if(highlight_firstline
> highlight_lastline
){
1333 for(int i
= 0; i
< highlight_lineamount
; i
++)
1334 memcpy(&iclip
[i
], &instrument
[currinstr
].line
[instry
+i
], sizeof(struct instrline
));
1335 //moved down, then yanked
1336 }else if(highlight_lastline
> highlight_firstline
){
1337 for(int i
= highlight_lineamount
-1, j
= 0; i
>= 0; i
--, j
++){
1338 memcpy(&iclip
[i
], &instrument
[currinstr
].line
[instry
-j
], sizeof(struct instrline
));
1343 snprintf(buf
, sizeof(buf
), "%d lines yanked", highlight_lineamount
);
1345 currmode
= PM_NORMAL
;
1350 // update the highlighted length
1351 /*highlight_lineamount = (highlight_firstline>highlight_lastline)?
1352 highlight_firstline - highlight_lastline +1
1353 : highlight_lastline - highlight_firstline +1;
1356 highlight_firstline
= -1;
1357 highlight_lastline
= -1;