Rev 259 | Rev 280 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 259 | Rev 267 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | func check_cur_vis_inv ;////////////////////////////////////////////////////// |
2 | func check_cur_vis_inv ;////////////////////////////////////////////////////// |
3 | ;----------------------------------------------------------------------------- |
3 | ;----------------------------------------------------------------------------- |
4 | push eax ebx |
4 | push eax ebx |
5 | xor bl,bl |
5 | xor bl,bl |
6 | .chk_y: |
6 | .chk_y: |
7 | mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] |
7 | mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
8 | or eax,eax |
8 | or eax,eax |
9 | jge @f |
9 | jge @f |
10 | mov [cur_tab.Editor.Caret.Y],0 ;! [pos.y],0 |
10 | mov [cur_editor.Caret.Y],0 ;! [pos.y],0 |
11 | jmp .chk_dy |
11 | jmp .chk_dy |
12 | @@: cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] |
12 | @@: cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] |
13 | jl .chk_dy |
13 | jl .chk_dy |
14 | mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] |
14 | mov eax,[cur_editor.Lines.Count] ;! eax,[lines] |
15 | dec eax |
15 | dec eax |
16 | mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax |
16 | mov [cur_editor.Caret.Y],eax ;! [pos.y],eax |
17 | .chk_dy: |
17 | .chk_dy: |
18 | mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] |
18 | mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] |
19 | cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] |
19 | cmp eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
20 | jle @f |
20 | jle @f |
21 | m2m [cur_tab.Editor.TopLeft.Y],[cur_tab.Editor.Caret.Y] |
21 | m2m [cur_editor.TopLeft.Y],[cur_editor.Caret.Y] |
22 | ;! push [pos.y] |
22 | ;! push [pos.y] |
23 | ;! pop [top_line] |
23 | ;! pop [top_line] |
24 | inc bl |
24 | inc bl |
25 | @@: add eax,[lines.scr] |
25 | @@: add eax,[lines.scr] |
26 | cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] |
26 | cmp eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
27 | jg .chk_x |
27 | jg .chk_x |
28 | mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] |
28 | mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
29 | sub eax,[lines.scr] |
29 | sub eax,[lines.scr] |
30 | inc eax |
30 | inc eax |
31 | mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax |
31 | mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax |
32 | inc bl |
32 | inc bl |
33 | .chk_x: |
33 | .chk_x: |
34 | mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] |
34 | mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
35 | or eax,eax |
35 | or eax,eax |
36 | jge @f |
36 | jge @f |
37 | mov [cur_tab.Editor.Caret.X],0 ;! [pos.x],0 |
37 | mov [cur_editor.Caret.X],0 ;! [pos.x],0 |
38 | jmp .chk_dx |
38 | jmp .chk_dx |
39 | @@: cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] |
39 | @@: cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] |
40 | jl .chk_dx |
40 | jl .chk_dx |
41 | mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] |
41 | mov eax,[cur_editor.Columns.Count] ;! eax,[columns] |
42 | mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax |
42 | mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
43 | .chk_dx: |
43 | .chk_dx: |
44 | mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] |
44 | mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
45 | cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] |
45 | cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
46 | jle @f |
46 | jle @f |
47 | m2m [cur_tab.Editor.TopLeft.X],[cur_tab.Editor.Caret.X] |
47 | m2m [cur_editor.TopLeft.X],[cur_editor.Caret.X] |
48 | ;! push [pos.x] |
48 | ;! push [pos.x] |
49 | ;! pop [left_col] |
49 | ;! pop [left_col] |
50 | inc bl |
50 | inc bl |
51 | @@: add eax,[columns.scr] |
51 | @@: add eax,[columns.scr] |
52 | cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] |
52 | cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
53 | jg @f |
53 | jg @f |
54 | mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] |
54 | mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
55 | sub eax,[columns.scr] |
55 | sub eax,[columns.scr] |
56 | inc eax |
56 | inc eax |
57 | mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax |
57 | mov [cur_editor.TopLeft.X],eax ;! [left_col],eax |
58 | inc bl |
58 | inc bl |
59 | @@: cmp [mev],MEV_LDOWN |
59 | @@: cmp [mev],MEV_LDOWN |
60 | jne .exit |
60 | jne .exit |
61 | push [cur_tab.Editor.Caret.X] [cur_tab.Editor.Caret.Y] ;! [pos.x] [pos.y] |
61 | push [cur_editor.Caret.X] [cur_editor.Caret.Y] ;! [pos.x] [pos.y] |
62 | pop [cur_tab.Editor.SelStart.Y] [cur_tab.Editor.SelStart.X] ;! [sel.y] [sel.x] |
62 | pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X] ;! [sel.y] [sel.x] |
63 | .exit: |
63 | .exit: |
64 | or bl,bl |
64 | or bl,bl |
65 | clc |
65 | clc |
66 | jz @f |
66 | jz @f |
67 | call draw_file |
67 | call draw_file |
Line 72... | Line 72... | ||
72 | 72 | ||
73 | ;----------------------------------------------------------------------------- |
73 | ;----------------------------------------------------------------------------- |
74 | func clear_selection ;//////////////////////////////////////////////////////// |
74 | func clear_selection ;//////////////////////////////////////////////////////// |
75 | ;----------------------------------------------------------------------------- |
75 | ;----------------------------------------------------------------------------- |
76 | push eax ebx |
76 | push eax ebx |
77 | mov eax,[cur_tab.Editor.SelStart.Y] ;! eax,[sel.y] |
77 | mov eax,[cur_editor.SelStart.Y] ;! eax,[sel.y] |
78 | mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y] |
78 | mov ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y] |
79 | cmp eax,ebx |
79 | cmp eax,ebx |
80 | jle @f |
80 | jle @f |
81 | xchg eax,ebx |
81 | xchg eax,ebx |
82 | @@: push [cur_tab.Editor.Caret.X] [cur_tab.Editor.Caret.Y] ;! [pos.x] [pos.y] |
82 | @@: push [cur_editor.Caret.X] [cur_editor.Caret.Y] ;! [pos.x] [pos.y] |
83 | pop [cur_tab.Editor.SelStart.Y] [cur_tab.Editor.SelStart.X] ;! [sel.y] [sel.x] |
83 | pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X] ;! [sel.y] [sel.x] |
84 | call draw_file.ex |
84 | call draw_file.ex |
85 | pop ebx eax |
85 | pop ebx eax |
86 | ret |
86 | ret |
Line 105... | Line 105... | ||
105 | 105 | ||
106 | ;----------------------------------------------------------------------------- |
106 | ;----------------------------------------------------------------------------- |
107 | func check_bottom_right ;///////////////////////////////////////////////////// |
107 | func check_bottom_right ;///////////////////////////////////////////////////// |
108 | ;----------------------------------------------------------------------------- |
108 | ;----------------------------------------------------------------------------- |
109 | push eax |
109 | push eax |
110 | mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] |
110 | mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line] |
111 | add eax,[lines.scr] |
111 | add eax,[lines.scr] |
112 | cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] |
112 | cmp eax,[cur_editor.Lines.Count] ;! eax,[lines] |
113 | jbe .lp1 |
113 | jbe .lp1 |
114 | mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] |
114 | mov eax,[cur_editor.Lines.Count] ;! eax,[lines] |
115 | sub eax,[lines.scr] |
115 | sub eax,[lines.scr] |
116 | jns @f |
116 | jns @f |
117 | xor eax,eax |
117 | xor eax,eax |
118 | @@: mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax |
118 | @@: mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax |
119 | .lp1: mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] |
119 | .lp1: mov eax,[cur_editor.TopLeft.X] ;! eax,[left_col] |
120 | add eax,[columns.scr] |
120 | add eax,[columns.scr] |
121 | cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] |
121 | cmp eax,[cur_editor.Columns.Count] ;! eax,[columns] |
122 | jbe .exit |
122 | jbe .exit |
123 | mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] |
123 | mov eax,[cur_editor.Columns.Count] ;! eax,[columns] |
124 | sub eax,[columns.scr] |
124 | sub eax,[columns.scr] |
125 | jns @f |
125 | jns @f |
126 | xor eax,eax |
126 | xor eax,eax |
127 | @@: mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax |
127 | @@: mov [cur_editor.TopLeft.X],eax ;! [left_col],eax |
128 | .exit: |
128 | .exit: |
129 | pop eax |
129 | pop eax |
130 | ret |
130 | ret |
Line 148... | Line 148... | ||
148 | endf |
148 | endf |
Line 149... | Line 149... | ||
149 | 149 | ||
150 | ;----------------------------------------------------------------------------- |
150 | ;----------------------------------------------------------------------------- |
151 | func check_inv_all ;////////////////////////////////////////////////////////// |
151 | func check_inv_all ;////////////////////////////////////////////////////////// |
152 | ;----------------------------------------------------------------------------- |
152 | ;----------------------------------------------------------------------------- |
153 | mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] |
153 | mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y] |
154 | mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] |
154 | mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line] |
155 | .skip_init: |
155 | .skip_init: |
156 | call check_cur_vis |
156 | call check_cur_vis |
157 | mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax |
157 | mov [cur_editor.Caret.Y],eax ;! [pos.y],eax |
158 | mov [cur_tab.Editor.TopLeft.Y],ecx ;! [top_line],ecx |
158 | mov [cur_editor.TopLeft.Y],ecx ;! [top_line],ecx |
159 | .skip_check: |
159 | .skip_check: |
160 | ; call clear_screen |
160 | ; call clear_screen |
161 | call draw_file |
161 | call draw_file |
162 | ret |
162 | ret |
Line 167... | Line 167... | ||
167 | ;----------------------------------------------------------------------------- |
167 | ;----------------------------------------------------------------------------- |
168 | cmp eax,ecx |
168 | cmp eax,ecx |
169 | jb .low |
169 | jb .low |
170 | mov edx,ecx |
170 | mov edx,ecx |
171 | add edx,[lines.scr] |
171 | add edx,[lines.scr] |
172 | cmp edx,[cur_tab.Editor.Lines] ;! edx,[lines] |
172 | cmp edx,[cur_editor.Lines.Count] ;! edx,[lines] |
173 | jbe @f |
173 | jbe @f |
174 | mov edx,[cur_tab.Editor.Lines] ;! edx,[lines] |
174 | mov edx,[cur_editor.Lines.Count] ;! edx,[lines] |
175 | @@: cmp eax,edx |
175 | @@: cmp eax,edx |
176 | jb @f |
176 | jb @f |
177 | lea ecx,[eax+1] |
177 | lea ecx,[eax+1] |
178 | sub ecx,[lines.scr] |
178 | sub ecx,[lines.scr] |
179 | jns @f |
179 | jns @f |
180 | xor ecx,ecx |
180 | xor ecx,ecx |
181 | jmp @f |
181 | jmp @f |
182 | .low: mov ecx,eax |
182 | .low: mov ecx,eax |
183 | @@: mov edx,ecx |
183 | @@: mov edx,ecx |
184 | add edx,[lines.scr] |
184 | add edx,[lines.scr] |
185 | cmp edx,[cur_tab.Editor.Lines] ;! edx,[lines] |
185 | cmp edx,[cur_editor.Lines.Count] ;! edx,[lines] |
186 | jbe @f |
186 | jbe @f |
187 | mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines] |
187 | mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines] |
188 | sub ecx,[lines.scr] |
188 | sub ecx,[lines.scr] |
189 | jns @f |
189 | jns @f |
190 | xor ecx,ecx |
190 | xor ecx,ecx |
191 | @@:;mov [top_line],ecx |
191 | @@:;mov [top_line],ecx |
Line 192... | Line 192... | ||
192 | 192 | ||
193 | pushad |
193 | pushad |
194 | mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] |
194 | mov eax,[cur_editor.Caret.X] ;! eax,[pos.x] |
195 | mov ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col] |
195 | mov ebx,[cur_editor.TopLeft.X] ;! ebx,[left_col] |
196 | mov ecx,ebx |
196 | mov ecx,ebx |
197 | add ecx,[columns.scr] |
197 | add ecx,[columns.scr] |
198 | cmp eax,ebx |
198 | cmp eax,ebx |
199 | jb .lp1 |
199 | jb .lp1 |
200 | cmp eax,ecx |
200 | cmp eax,ecx |
201 | jb .exit |
201 | jb .exit |
202 | lea ebx,[eax] |
202 | lea ebx,[eax] |
203 | sub ebx,[columns.scr] |
203 | sub ebx,[columns.scr] |
204 | jmp @f |
204 | jmp @f |
205 | .lp1: mov ebx,eax |
205 | .lp1: mov ebx,eax |
Line 206... | Line 206... | ||
206 | @@: mov [cur_tab.Editor.TopLeft.X],ebx ;! [left_col],ebx |
206 | @@: mov [cur_editor.TopLeft.X],ebx ;! [left_col],ebx |
207 | 207 | ||
208 | .exit: |
208 | .exit: |
Line 209... | Line 209... | ||
209 | mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax |
209 | mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
210 | popad |
210 | popad |
Line 230... | Line 230... | ||
230 | ; ECX = line number |
230 | ; ECX = line number |
231 | ; Output: |
231 | ; Output: |
232 | ; ESI = line data offset |
232 | ; ESI = line data offset |
233 | ;----------------------------------------------------------------------------- |
233 | ;----------------------------------------------------------------------------- |
234 | push eax ecx |
234 | push eax ecx |
235 | mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT |
235 | mov esi,[cur_editor.Lines] ;! AREA_EDIT |
236 | @@: dec ecx |
236 | @@: dec ecx |
237 | js .exit |
237 | js .exit |
238 | movzx eax,word[esi] |
238 | movzx eax,word[esi] |
239 | lea esi,[esi+eax+4] |
239 | lea esi,[esi+eax+4] |
240 | jmp @b |
240 | jmp @b |
Line 246... | Line 246... | ||
246 | ;----------------------------------------------------------------------------- |
246 | ;----------------------------------------------------------------------------- |
247 | func init_sel_vars ;////////////////////////////////////////////////////////// |
247 | func init_sel_vars ;////////////////////////////////////////////////////////// |
248 | ;----------------------------------------------------------------------------- |
248 | ;----------------------------------------------------------------------------- |
249 | pushad |
249 | pushad |
250 | mov [sel.selected],1 |
250 | mov [sel.selected],1 |
251 | mov eax,[cur_tab.Editor.SelStart.X] ;! eax,[sel.x] |
251 | mov eax,[cur_editor.SelStart.X] ;! eax,[sel.x] |
252 | mov ebx,[cur_tab.Editor.SelStart.Y] ;! ebx,[sel.y] |
252 | mov ebx,[cur_editor.SelStart.Y] ;! ebx,[sel.y] |
253 | mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] |
253 | mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x] |
254 | mov edx,[cur_tab.Editor.Caret.Y] ;! edx,[pos.y] |
254 | mov edx,[cur_editor.Caret.Y] ;! edx,[pos.y] |
255 | cmp ebx,edx |
255 | cmp ebx,edx |
256 | jl .lp2 |
256 | jl .lp2 |
257 | jne @f |
257 | jne @f |
258 | cmp eax,ecx |
258 | cmp eax,ecx |
259 | jl .lp2 |
259 | jl .lp2 |
Line 506... | Line 506... | ||
506 | movzx edx,word[esi] |
506 | movzx edx,word[esi] |
507 | cmp ecx,edx |
507 | cmp ecx,edx |
508 | jbe .exit |
508 | jbe .exit |
509 | sub ecx,edx |
509 | sub ecx,edx |
510 | push ecx |
510 | push ecx |
511 | mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2 |
511 | mov edi,[cur_editor.Lines] ;! AREA_TEMP2 |
512 | add edi,[edi-4] |
512 | add edi,[edi-4] |
513 | dec edi |
513 | dec edi |
514 | mov eax,esi |
514 | mov eax,esi |
515 | mov esi,edi |
515 | mov esi,edi |
516 | sub esi,ecx |
516 | sub esi,ecx |
Line 561... | Line 561... | ||
561 | mov ebx,[sel.begin.x] |
561 | mov ebx,[sel.begin.x] |
562 | add ebx,ecx |
562 | add ebx,ecx |
563 | mov [edi-4],bx |
563 | mov [edi-4],bx |
564 | add edi,[sel.begin.x] |
564 | add edi,[sel.begin.x] |
565 | lea esi,[esi+eax+4] |
565 | lea esi,[esi+eax+4] |
566 | mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2 |
566 | mov ecx,[cur_editor.Lines] ;! AREA_TEMP2 |
567 | add ecx,[ecx-4] |
567 | add ecx,[ecx-4] |
568 | sub ecx,esi |
568 | sub ecx,esi |
569 | cld |
569 | cld |
570 | rep movsb |
570 | rep movsb |
571 | mov eax,[sel.end.y] |
571 | mov eax,[sel.end.y] |
572 | sub eax,[sel.begin.y] |
572 | sub eax,[sel.begin.y] |
573 | sub [cur_tab.Editor.Lines],eax ;! [lines],eax |
573 | sub [cur_editor.Lines.Count],eax ;! [lines],eax |
574 | jmp .exit |
574 | jmp .exit |
Line 575... | Line 575... | ||
575 | 575 | ||
576 | .single_line: |
576 | .single_line: |
577 | call get_line_offset |
577 | call get_line_offset |
Line 587... | Line 587... | ||
587 | @@: sub ecx,[sel.begin.x] |
587 | @@: sub ecx,[sel.begin.x] |
588 | sub [esi],cx |
588 | sub [esi],cx |
589 | lea edi,[esi+4] |
589 | lea edi,[esi+4] |
590 | add edi,[sel.begin.x] |
590 | add edi,[sel.begin.x] |
591 | lea esi,[edi+ecx] |
591 | lea esi,[edi+ecx] |
592 | mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2 |
592 | mov ecx,[cur_editor.Lines] ;! AREA_TEMP2 |
593 | add ecx,[ecx-4] |
593 | add ecx,[ecx-4] |
594 | sub ecx,esi |
594 | sub ecx,esi |
595 | cld |
595 | cld |
596 | rep movsb |
596 | rep movsb |
Line 597... | Line 597... | ||
597 | 597 | ||
598 | .exit: |
598 | .exit: |
599 | mov eax,[sel.begin.x] |
599 | mov eax,[sel.begin.x] |
600 | mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax |
600 | mov [cur_editor.Caret.X],eax ;! [pos.x],eax |
601 | mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax |
601 | mov [cur_editor.SelStart.X],eax ;! [sel.x],eax |
602 | mov eax,[sel.begin.y] |
602 | mov eax,[sel.begin.y] |
603 | mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax |
603 | mov [cur_editor.Caret.Y],eax ;! [pos.y],eax |
604 | mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax |
604 | mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax |
605 | popad |
605 | popad |
606 | mov [cur_tab.Editor.Modified],1 ;! [modified],1 |
606 | mov [cur_editor.Modified],1 ;! [modified],1 |
607 | clc |
607 | clc |
Line 608... | Line 608... | ||
608 | ret |
608 | ret |
609 | 609 |