Eskil

Check-in [30dff04537]
Login

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

Overview
Comment:More Edit Mode commands
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 30dff0453799eb8156011db752319719341b50159f0cc454bc19358cde27e632
User & Date: peter 2019-11-10 19:47:37
Context
2020-01-07
10:06
Handle multiple screens better for balloon help check-in: 62ba2f60a5 user: peter tags: trunk
2019-11-10
19:47
More Edit Mode commands check-in: 30dff04537 user: peter tags: trunk
17:28
Cleanup check-in: f02d0c04f1 user: peter tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Changes.







1
2
3
4
5
6
7






2019-08-28
 Allow multiple pairs of files on the command line to open multiple windows.

2019-07-05
 Ctrl-E to enable Edit Mode.
 Do not ask about overwriting in Edit Mode. Hidden preference to turn it on.
 Added -subst command line, to acces PreProcess Subst function.
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
2019-11-10
 More combinations allowed in edit mode. Including copy block of selected text.

2019-11-10
 Code cleanup to adhere a bit to some consistent standard.

2019-08-28
 Allow multiple pairs of files on the command line to open multiple windows.

2019-07-05
 Ctrl-E to enable Edit Mode.
 Do not ask about overwriting in Edit Mode. Hidden preference to turn it on.
 Added -subst command line, to acces PreProcess Subst function.

Changes to htdocs/changes.wiki.

2
3
4
5
6
7
8


9
10
11
12
13
14
15

Upcoming changes (not yet released):

  *  TBW
  *  Added -subst command line, to access PreProcess Subst function.
  *  Better SVN commit, handling added directories.
  *  Ctrl-E to enable Edit Mode.



Changes in v2.8.4 (2019-02-06):

  *  Commit dialog includes a selection of files, for partial commit.
  *  Better support for multiple files and directories with -review.
  *  Added save-reload option in edit mode.
  *  Bug-fix with deleted files in GIT directory diff.







>
>







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

Upcoming changes (not yet released):

  *  TBW
  *  Added -subst command line, to access PreProcess Subst function.
  *  Better SVN commit, handling added directories.
  *  Ctrl-E to enable Edit Mode.
  *  Allow copying selected lines in Edit Mode.
  *  Allow deleting any line in Edit Mode.

Changes in v2.8.4 (2019-02-06):

  *  Commit dialog includes a selection of files, for partial commit.
  *  Better support for multiple files and directories with -review.
  *  Added save-reload option in edit mode.
  *  Bug-fix with deleted files in GIT directory diff.

Changes to src/eskil.tcl.

2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062

2063
2064
2065





2066
2067
2068

























2069

2070
2071
2072
2073
2074
2075
2076
2077

2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089

2090
2091
2092
2093
2094
2095
2096
2097
2098
....
2800
2801
2802
2803
2804
2805
2806


2807
2808
2809
2810
2811
2812
2813
....
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854

# Called by popup menus over row numbers to add commands for editing.
# Returns 1 if nothing was added.
proc editMenu {mW top side changeIndex x y} {

    if { ! [mayEdit $top $side]} {return 1}

    # Only copy when in a change block
    if {$changeIndex ne ""} {
        set other [expr {$side == 1 ? 2 : 1}]
        set editOther [mayEdit $top $other]


        set W $::widgets($top,wLine$side)
        set oW $::widgets($top,wLine$other)






        # Get the row that was clicked
        set index [$W index @$x,$y]
        set row [lindex [split $index "."] 0]



























        set line  [regexp -inline {\d+} [$W  get $row.0 $row.end]]
        set lineo [regexp -inline {\d+} [$oW get $row.0 $row.end]]

        # Row copy
        if {$lineo ne ""} {
            $mW add command -label "Copy Row from other side" \
                    -command [list copyRow $top $other $row]
        } else {

            $mW add command -label "Delete Row" \
                    -command [list deleteBlock $top $side $row]
        }
        if {$line ne "" && $editOther} {
            $mW add command -label "Copy Row to other side" \
                    -command [list copyRow $top $side $row]
        }

        # Get ranges for the change block
        set range  [$W tag ranges hl$changeIndex]
        set rangeo [$oW tag ranges hl$changeIndex]


        # Get the lines involved in the block
        lassign [getLinesFromRange $W  $range ] from  to  froml  tol
        lassign [getLinesFromRange $oW $rangeo] fromo too fromlo tolo

        # More than one line in the block?
        set thisSize 0
        set otherSize 0
        if {$froml ne "" && $tol ne ""} {
            set thisSize [expr {$tol - $froml + 1}]
................................................................................
        cloneDiff $top [concat $::eskil($top,separatelines1) \
                               $::eskil($top,separatelines2)]
        unset ::eskil($top,separate1)
        unset ::eskil($top,separate2)
    }
}



proc hlPopup {top side changeIndex X Y x y} {
    if {[info exists ::eskil($top,nopopup)] && $::eskil($top,nopopup)} return
    destroy .lpm
    menu .lpm

    if { ! [editMenu .lpm $top $side $changeIndex $x $y]} {
        .lpm add separator
................................................................................
proc rowPopup {W X Y x y} {
    set top [winfo toplevel $W]
    if {[info exists ::eskil($top,nopopup)] && $::eskil($top,nopopup)} return
    destroy .lpm
    menu .lpm

    regexp {(\d+)\D*$} $W -> side
    set tmp1 [editMenu  .lpm $top $side "" $x $y]
    if { ! $tmp1} {.lpm add separator}
    set tmp2 [alignMenu .lpm $top $side $x $y]
    if {$tmp1 && $tmp2} {
        # Nothing in the menu
        return
    }
    if { ! $tmp1 && $tmp2} {.lpm delete last}







<
<
|
|
|
>
|
|

>
>
>
>
>

|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
|

|
|
|
|
<
>
|
|
<
|
|
|
|

<
<
<
<
>

|







 







>
>







 







|







2051
2052
2053
2054
2055
2056
2057


2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106

2107
2108
2109

2110
2111
2112
2113
2114




2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
....
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
....
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882

# Called by popup menus over row numbers to add commands for editing.
# Returns 1 if nothing was added.
proc editMenu {mW top side changeIndex x y} {

    if { ! [mayEdit $top $side]} {return 1}



    set other [expr {$side == 1 ? 2 : 1}]
    set editOther [mayEdit $top $other]
 
    set dW $::widgets($top,wDiff$side)
    set lW $::widgets($top,wLine$side)
    set oW $::widgets($top,wLine$other)

    set changed 1
    
    if {$changeIndex eq "_"} {
        # The popup is on unchanged line numbers
        set changed 0
        # Get the row that was clicked
        set index [$lW index @$x,$y]
        set row [lindex [split $index "."] 0]
        # Range is that row
        set range  [list $row.0 $row.end]
        set rangeo [list $row.0 $row.end]
    } elseif {$changeIndex eq ""} {
        # The popup is on selected text.
        # Get the row that was clicked
        set index [$dW index @$x,$y]
        set row [lindex [split $index "."] 0]
        # Figure out the rows involved in the selection.
        set range [$dW tag ranges sel]
        set from [lindex $range 0]
        set to   [lindex $range 1]
        lassign [split $from "."] froml fromi
        lassign [split $to   "."] tol   toi
        if {$toi == 0} {incr tol -1}
        set range  [list $froml.0 $tol.end]
        set rangeo [list $froml.0 $tol.end]
    } else {
        # The popup is on a change block in line numbers
        # Get the row that was clicked
        set index [$lW index @$x,$y]
        set row [lindex [split $index "."] 0]
        # Get ranges for the change block
        set range  [$lW tag ranges hl$changeIndex]
        set rangeo [$oW tag ranges hl$changeIndex]
    }

    set line  [regexp -inline {\d+} [$lW get $row.0 $row.end]]
    set lineo [regexp -inline {\d+} [$oW get $row.0 $row.end]]

    # Row copy
    if {$lineo ne ""} {
        $mW add command -label "Copy Row from other side" \
                -command [list copyRow $top $other $row]

    }
    $mW add command -label "Delete Row" \
            -command [list deleteBlock $top $side $row]

    if {$line ne "" && $editOther && $changed} {
        $mW add command -label "Copy Row to other side" \
                -command [list copyRow $top $side $row]
    }





    if {$changed} {
        # Get the lines involved in the block
        lassign [getLinesFromRange $lW $range ] from  to  froml  tol
        lassign [getLinesFromRange $oW $rangeo] fromo too fromlo tolo

        # More than one line in the block?
        set thisSize 0
        set otherSize 0
        if {$froml ne "" && $tol ne ""} {
            set thisSize [expr {$tol - $froml + 1}]
................................................................................
        cloneDiff $top [concat $::eskil($top,separatelines1) \
                               $::eskil($top,separatelines2)]
        unset ::eskil($top,separate1)
        unset ::eskil($top,separate2)
    }
}

# No changeIndex means that the popup is over selected text rather than
# line numbers.
proc hlPopup {top side changeIndex X Y x y} {
    if {[info exists ::eskil($top,nopopup)] && $::eskil($top,nopopup)} return
    destroy .lpm
    menu .lpm

    if { ! [editMenu .lpm $top $side $changeIndex $x $y]} {
        .lpm add separator
................................................................................
proc rowPopup {W X Y x y} {
    set top [winfo toplevel $W]
    if {[info exists ::eskil($top,nopopup)] && $::eskil($top,nopopup)} return
    destroy .lpm
    menu .lpm

    regexp {(\d+)\D*$} $W -> side
    set tmp1 [editMenu  .lpm $top $side "_" $x $y]
    if { ! $tmp1} {.lpm add separator}
    set tmp2 [alignMenu .lpm $top $side $x $y]
    if {$tmp1 && $tmp2} {
        # Nothing in the menu
        return
    }
    if { ! $tmp1 && $tmp2} {.lpm delete last}