Fresh IDE . Check-in [1b66b99b2d]
Not logged in

This repository is a mirror!

The original is located on: https://fresh.flatassembler.net/fossil/repo/fresh
If you want to follow the project, please update your remote-url

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixed the bug from [eb4d978cde6] ticket - crashes on indent/outdent/comment/uncomment commands.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:1b66b99b2d8749a137a5a6688988ff1ce6a037c2
User & Date: johnfound 2018-06-18 10:23:12
References
2018-06-18
10:26 Ticket [eb4d978cde] Crash when indenting a single line status still Verified with 4 other changes artifact: 4be54a7241 user: johnfound
Context
2018-06-18
11:09
FASM compiler has been updated to v1.73.04; Preparations for v2.6.3 release. check-in: 9d7515b73d user: johnfound tags: trunk
10:23
Fixed the bug from [eb4d978cde6] ticket - crashes on indent/outdent/comment/uncomment commands. check-in: 1b66b99b2d user: johnfound tags: trunk
10:10
The double call "fixed" in the previous commit was researched and found to be reasonable. The project file can be changed by saving the other files in different paths, so the project file must to be saved last. This functionality was implemented in better (at least more readable) way in this checkin. check-in: e582633f9f user: johnfound tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to include/libs/asmedit/asmedit.asm.

1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606


1607


1608
1609
1610
1611
1612
1613
1614
1615

1616
1617


1618
1619

1620
1621
1622
1623

1624






1625



1626
1627

1628
1629

1630




1631
1632
1633

1634


1635
1636


1637
1638

1639
1640
1641
1642
1643


1644

1645
1646
1647




1648


1649
1650


1651







1652
1653
1654
1655
1656
1657
1658
....
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
....
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908

2909
2910
2911
2912
2913
2914
2915
....
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
        push    ecx
        mov     ax, 20h
        call    .insert_character
        pop     ecx
        loop    .tab_spaces
        ret

    .indent_text:
        pushad

        cmp     [.was_selection], 0
        je      .done

        mov     ecx, [.sel_line_number]
        sub     ecx, [.caret_line_number]
        jge     .count_lines_ok





        neg     ecx
        push    ecx

        mov     eax, [.caret_line]
        mov     [.sel_line], eax

  .goto_first_line:
        mov     esi, [.caret_line]

        test    esi, esi
        jz      @f



        mov     edi, [esi + AELINE.prev]

        mov     [.caret_line], edi
        loop    .goto_first_line

@@:

        mov     ebx, [.caret_position]          ; the caret goes up and the selection down.






        mov     eax, [.sel_position]



        mov     [.sel_position], ebx
        mov     [.caret_position], eax


        mov     ebx, [.caret_line_number]

        mov     eax, [.sel_line_number]




        mov     [.caret_line_number], eax
        mov     [.sel_line_number], ebx


        pop     ecx



   .count_lines_ok:



        cmp     [.sel_position], 0

        je      @f

        mov     eax, [.sel_line]
        mov     eax, [eax+AELINE.next]
        mov     [.sel_line], eax




        inc     [.sel_line_number]

@@:







        mov     [.caret_position], 0
        mov     [.sel_position], 0










        push    [.caret_line_number] [.caret_line] [.caret_position]

   .indent_loop:

        push    ecx
        xor     eax,eax
        mov     [.caret_position], 0
................................................................................

        mov     esi, [.caret_line]
        mov     [.current_line], esi
        call    .store_line_for_undo

        mov     ax,' '
        call    .insert_character

        mov     al,' '
        call    .insert_character

      .ok_next:

        inc     [.caret_line_number]
        mov     esi, [.caret_line]
        mov     edi, [esi + AELINE.next]
................................................................................
        mov     eax,[.wparam]
        mov     [.bookmark_icon], eax
        mov     eax,[.lparam]
        mov     [.bookmark_icon+4], eax
        jmp     .wmsize

.aemcomment:
        cmp     [.was_selection], 0
        je      .done

        call    .store_status_for_undo

        mov     ecx,[.sel_line_number]
        sub     ecx,[.caret_line_number]
        cmp     ecx,0
        jge     .count_lines

        neg     ecx
        push    ecx

        mov     eax, [.caret_line]
        mov     [.sel_line], eax

   .goto_first:
        mov     esi, [.caret_line]
        mov     edi, [esi + AELINE.prev]
        mov     [.caret_line],edi
        loop    .goto_first

        mov     ebx,[.caret_position]
        mov     eax,[.sel_position]
        mov     [.sel_position],ebx
        mov     [.caret_position],eax

        mov     ebx,[.caret_line_number]
        mov     eax,[.sel_line_number]
        mov     [.sel_line_number],ebx
        mov     [.caret_line_number],eax

        pop     ecx

   .count_lines:

        cmp     [.sel_position], 0
        je      @f

        mov     eax, [.sel_line]
        mov     eax, [eax + AELINE.next]
        mov     [.sel_line], eax

        inc     [.sel_line_number]

@@:
        mov     [.caret_position],0
        mov     [.sel_position], 0


        push    [.caret_line_number] [.caret_line] [.caret_position]

      .comment_loop:

        push    ecx

        xor     eax,eax
................................................................................
.moved_caret:
        test    [.kbstate+VK_SHIFT], 80h
        jnz     .moved_selection
        mov     [.sel_line],0


.moved_selection:
        mov     [.notification],AEN_POSCHANGE and $ff
        jmp     .update


.moved_window:
        call    .update_positions
        jmp     .refresh


.text_modified:
        mov     [.notification],AEN_TEXTCHANGE and $ff


    .update:
        call    .update_positions
        call    .let_caret_appear

    .refresh:







|
<
<
|
<
<


<
>
>

>
>

|

|
|

|
<
>
|
|
>
>

<
>
|
<

<
>
|
>
>
>
>
>
>

>
>
>


>

<
>
|
>
>
>
>
|
|

>
|
>
>

<
>
>

<
>
|

|
|
<
>
>

>


<
>
>
>
>

>
>
|
<
>
>

>
>
>
>
>
>
>







 







<
<







 







<
<



<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
>







 







|









|







1591
1592
1593
1594
1595
1596
1597
1598


1599


1600
1601

1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613

1614
1615
1616
1617
1618
1619

1620
1621

1622

1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638

1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652

1653
1654
1655

1656
1657
1658
1659
1660

1661
1662
1663
1664
1665
1666

1667
1668
1669
1670
1671
1672
1673
1674

1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
....
1715
1716
1717
1718
1719
1720
1721


1722
1723
1724
1725
1726
1727
1728
....
2884
2885
2886
2887
2888
2889
2890


2891
2892
2893












































2894
2895
2896
2897
2898
2899
2900
2901
....
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
        push    ecx
        mov     ax, 20h
        call    .insert_character
        pop     ecx
        loop    .tab_spaces
        ret

; extends the selection to whole lines in order to apply line formatting commands.


.extend_selection:


        mov     ecx, [.sel_line_number]
        sub     ecx, [.caret_line_number]

        jg      .order_ok
        je      .sort_pos

; exchange the selection and caret

        neg     ecx
        mov     edx, ecx

        mov     esi, [.caret_line]
        mov     [.sel_line], esi

.gotoback:

        mov     eax, [esi + AELINE.prev]
        test    eax, eax
        jz      .first_found
        mov     esi, eax
        loop    .gotoback


.first_found:
        mov     [.caret_line], esi



        xchg    ecx, edx
        sub     ecx, edx        ; the real count in case of errors.

        mov     eax, [.caret_line_number]
        mov     [.sel_line_number], eax
        sub     eax, ecx
        mov     [.caret_line_number], eax

        mov     eax, [.sel_position]

.swap_pos:
        mov     ebx, [.caret_position]          ; the caret goes up and the selection down.
        mov     [.sel_position], ebx
        mov     [.caret_position], eax
        jmp     .order_ok


.sort_pos:
        mov     eax, [.sel_position]
        cmp     eax, [.caret_position]
        jl      .swap_pos
        jg      .order_ok

        mov     eax, [.caret_line]
        mov     [.sel_line], eax

.order_ok:
        xor     eax, eax
        cmp     [.sel_position], eax
        jne     .one_more


        test    ecx, ecx
        jnz     .clear_pos


.one_more:
        inc     ecx

        mov     edx, [.sel_line]
        mov     edx, [edx+AELINE.next]

        test    edx, edx
        jz      .no_more_lines

        mov     [.sel_line], edx
        inc     [.sel_line_number]


.clear_pos:
        mov     [.sel_position], eax
        mov     [.caret_position], eax
        retn

.no_more_lines:
        mov     [.sel_position], aeLineCharLen - 1
        mov     [.caret_position], eax

        retn
;--------------------------------------------------------


.indent_text:
        pushad

        call    .store_status_for_undo

        call    .extend_selection
        push    [.caret_line_number] [.caret_line] [.caret_position]

   .indent_loop:

        push    ecx
        xor     eax,eax
        mov     [.caret_position], 0
................................................................................

        mov     esi, [.caret_line]
        mov     [.current_line], esi
        call    .store_line_for_undo

        mov     ax,' '
        call    .insert_character


        call    .insert_character

      .ok_next:

        inc     [.caret_line_number]
        mov     esi, [.caret_line]
        mov     edi, [esi + AELINE.next]
................................................................................
        mov     eax,[.wparam]
        mov     [.bookmark_icon], eax
        mov     eax,[.lparam]
        mov     [.bookmark_icon+4], eax
        jmp     .wmsize

.aemcomment:



        call    .store_status_for_undo













































        call    .extend_selection
        push    [.caret_line_number] [.caret_line] [.caret_position]

      .comment_loop:

        push    ecx

        xor     eax,eax
................................................................................
.moved_caret:
        test    [.kbstate+VK_SHIFT], 80h
        jnz     .moved_selection
        mov     [.sel_line],0


.moved_selection:
        mov     [.notification], AEN_POSCHANGE and $ff
        jmp     .update


.moved_window:
        call    .update_positions
        jmp     .refresh


.text_modified:
        mov     [.notification], AEN_TEXTCHANGE and $ff


    .update:
        call    .update_positions
        call    .let_caret_appear

    .refresh: