Compare commits
4 Commits
c9d827a5d8
...
b1f15ca15e
Author | SHA1 | Date |
---|---|---|
svkalinin | b1f15ca15e | |
svkalinin | 095434dc70 | |
svkalinin | 0b8584d4f8 | |
svkalinin | 2f5af66c5c |
105
lib/editor.tcl
105
lib/editor.tcl
|
@ -394,10 +394,11 @@ namespace eval Editor {
|
|||
wm transient $win .
|
||||
wm overrideredirect $win 1
|
||||
|
||||
listbox $win.lBox -width 30 -border 2 -yscrollcommand "$win.yscroll set" -border 1
|
||||
ttk::scrollbar $win.yscroll -orient vertical -command "$win.lBox yview"
|
||||
# listbox $win.lBox -width 30 -border 2 -yscrollcommand "$win.yscroll set" -border 1
|
||||
# ttk::scrollbar $win.yscroll -orient vertical -command "$win.lBox yview"
|
||||
listbox $win.lBox -width 30 -border 2 -border 1
|
||||
pack $win.lBox -expand true -fill y -side left
|
||||
pack $win.yscroll -side left -expand false -fill y
|
||||
# pack $win.yscroll -side left -expand false -fill y
|
||||
|
||||
foreach { word } $findedVars {
|
||||
$win.lBox insert end $word
|
||||
|
@ -471,40 +472,43 @@ namespace eval Editor {
|
|||
# .varhelper.lBox activate $index
|
||||
# }
|
||||
# # bind $win.lBox <Any-Key> {Editor::ListBoxSearch %W %A}
|
||||
|
||||
# Определям расстояние до края экрана (основного окна) и если
|
||||
# оно меньше размера окна со списком то сдвигаем его вверх
|
||||
set winGeom [winfo reqheight $win]
|
||||
set winGeomY [winfo reqheight $win]
|
||||
set winGeomX [winfo reqwidth $win]
|
||||
|
||||
set topHeight [winfo height .]
|
||||
# puts "$x, $y, $winGeom, $topHeight"
|
||||
if [expr [expr $topHeight - $y] < $winGeom] {
|
||||
set y [expr $topHeight - $winGeom]
|
||||
}
|
||||
wm geom $win +$x+$y
|
||||
set topWidth [winfo width .]
|
||||
set topLeftUpperX [winfo x .]
|
||||
set topLeftUpperY [winfo y .]
|
||||
set topRightLowerX [expr $topLeftUpperX + $topWidth]
|
||||
set topRightLowerY [expr $topLeftUpperY + $topHeight]
|
||||
|
||||
if {[expr [expr $x + $winGeomX] > $topRightLowerX]} {
|
||||
set x [expr $x - $winGeomX]
|
||||
}
|
||||
if {[expr [expr $y + $winGeomY] > $topRightLowerY]} {
|
||||
set y [expr $y - $winGeomY]
|
||||
}
|
||||
|
||||
wm geom $win +$x+$y
|
||||
}
|
||||
|
||||
proc ReleaseKey {k txt} {
|
||||
global cfgVariables
|
||||
proc ReleaseKey {k txt fileType} {
|
||||
global cfgVariables lexers
|
||||
set pos [$txt index insert]
|
||||
set lineNum [lindex [split $pos "."] 0]
|
||||
set posNum [lindex [split $pos "."] 1]
|
||||
set box [$txt bbox insert]
|
||||
set box_x [expr [lindex $box 0] + [winfo rootx $txt] ]
|
||||
set box_y [expr [lindex $box 1] + [winfo rooty $txt] + [lindex $box 3] ]
|
||||
SearchBrackets $txt
|
||||
# set lineStart [$txt index "$pos linestart"]
|
||||
# puts "$pos $lineStart"
|
||||
if {$cfgVariables(variableHelper) eq "true"} {
|
||||
set lastSymbol [string last "$" [$txt get $lineNum.0 $pos]]
|
||||
if {$lastSymbol ne "-1"} {
|
||||
set word [string trim [$txt get $lineNum.[expr $lastSymbol + 1] $pos]]
|
||||
# puts "$pos; $lineNum; $pos; $lastSymbol; $word"
|
||||
set box [$txt bbox insert]
|
||||
set box_x [expr [lindex $box 0] + [winfo rootx $txt] ]
|
||||
set box_y [expr [lindex $box 1] + [winfo rooty $txt] + [lindex $box 3] ]
|
||||
Editor::VarHelper $box_x $box_y $txt $word
|
||||
}
|
||||
}
|
||||
if {$cfgVariables(procedureHelper) eq "true"} {
|
||||
puts "Find proc"
|
||||
}
|
||||
set lpos [split $pos "."]
|
||||
set lblText "[::msgcat::mc "Row"]: [lindex $lpos 0], [::msgcat::mc "Column"]: [lindex $lpos 1]"
|
||||
.frmStatus.lblPosition configure -text $lblText
|
||||
unset lpos
|
||||
$txt tag remove lightSelected 1.0 end
|
||||
|
||||
switch $k {
|
||||
Return {
|
||||
|
@ -513,12 +517,47 @@ namespace eval Editor {
|
|||
$txt insert insert $spaceStart
|
||||
Editor::Indent $txt
|
||||
}
|
||||
Up {
|
||||
return
|
||||
}
|
||||
Down {
|
||||
return
|
||||
}
|
||||
Left {
|
||||
return
|
||||
}
|
||||
Right {
|
||||
return
|
||||
}
|
||||
}
|
||||
# set lineStart [$txt index "$pos linestart"]
|
||||
# puts "$pos $lineStart"
|
||||
if {$cfgVariables(variableHelper) eq "true"} {
|
||||
if {[dict exists $lexers $fileType variableSymbol] != 0} {
|
||||
set varSymbol [dict get $lexers $fileType variableSymbol]
|
||||
set lastSymbol [string last $varSymbol [$txt get $lineNum.0 $pos]]
|
||||
if {$lastSymbol ne "-1"} {
|
||||
set word [string trim [$txt get $lineNum.[expr $lastSymbol + 1] $pos]]
|
||||
Editor::VarHelper $box_x $box_y $txt $word
|
||||
}
|
||||
} else {
|
||||
set ind [$txt search -backwards -regexp {\W} $pos {insert linestart}]
|
||||
if {$ind ne ""} {
|
||||
set _ [split $ind "."]
|
||||
set ind [lindex $_ 0].[expr [lindex $_ 1] + 1]
|
||||
set word [$txt get $ind $pos]
|
||||
Editor::VarHelper $box_x $box_y $txt $word
|
||||
} else {
|
||||
# set ind [$txt search -backwards -regexp {^} $pos {insert linestart}]
|
||||
set word [$txt get {insert linestart} $pos]
|
||||
Editor::VarHelper $box_x $box_y $txt $word
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {$cfgVariables(procedureHelper) eq "true"} {
|
||||
puts "Find proc"
|
||||
}
|
||||
set lpos [split $pos "."]
|
||||
set lblText "[::msgcat::mc "Row"]: [lindex $lpos 0], [::msgcat::mc "Column"]: [lindex $lpos 1]"
|
||||
.frmStatus.lblPosition configure -text $lblText
|
||||
unset lpos
|
||||
$txt tag remove lightSelected 1.0 end
|
||||
}
|
||||
|
||||
proc PressKey {k txt} {
|
||||
|
@ -574,7 +613,7 @@ namespace eval Editor {
|
|||
global cfgVariables
|
||||
# variable txt
|
||||
# set txt $w.frmText.t
|
||||
bind $txt <KeyRelease> "Editor::ReleaseKey %K $txt"
|
||||
bind $txt <KeyRelease> "Editor::ReleaseKey %K $txt $fileType"
|
||||
bind $txt <KeyPress> "Editor::PressKey %K $txt"
|
||||
# bind $txt <KeyRelease> "Editor::Key %k %K"
|
||||
#$txt tag bind Sel <Control-/> {puts ">>>>>>>>>>>>>>>>>>>"}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#-------------------------------------------------------
|
||||
# TCL/TK
|
||||
dict set lexers TCL commentSymbol {#}
|
||||
dict set lexers TCL variableSymbol {$}
|
||||
dict set lexers TCL procFindString {proc PROCNAME}
|
||||
dict set lexers TCL procRegexpCommand {regexp -nocase -all -- {^\s*?(proc) (.*?) \{(.*?)\} \{} $line match keyWord procName params}
|
||||
dict set lexers TCL varRegexpCommand {regexp -nocase -all -- {^\s*?set\s+([a-zA-Z0-9\:\-_$]+)\s+(.+?)($|;)} $line match varName varValue lineEnd}
|
||||
|
@ -19,6 +20,7 @@ dict set lexers GO varRegexpCommand {regexp -nocase -all -line -- {^\s*?var\s+([
|
|||
#--------------------------------------------------
|
||||
# SHELL (Bash)
|
||||
dict set lexers SH commentSymbol {#}
|
||||
dict set lexers TCL variableSymbol {$}
|
||||
dict set lexers SH procFindString {(function |)\s*?PROCNAME\(\)}
|
||||
dict set lexers SH procRegexpCommand {regexp -nocase -all -- {^\s*?(function |)\s*?(.*?)\(()\)} $line match keyWord procName params}
|
||||
|
||||
|
@ -38,6 +40,7 @@ dict set lexers RB procRegexpCommand {regexp -nocase -all -- {^\s*?(def)\s([a-zA
|
|||
#--------------------------------------------------
|
||||
# YAML (ansible)
|
||||
dict set lexers YML commentSymbol {#}
|
||||
# dict set lexers YML variableSymbol {\{\{}
|
||||
dict set lexers YML tabSize 2
|
||||
dict set lexers YML procFindString {(- name:)\s*?PROCNAME}
|
||||
dict set lexers YML procRegexpCommand {regexp -nocase -all -- {^\s*?- (name):\s(.+?)$} $line match keyWord procName}
|
||||
|
|
|
@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
|
|||
######################################################
|
||||
# Version: 2.0.0
|
||||
# Release: alpha
|
||||
# Build: 28102022165035
|
||||
# Build: 01112022162146
|
||||
######################################################
|
||||
|
||||
# определим текущую версию, релиз и т.д.
|
||||
|
|
Loading…
Reference in New Issue