diff --git a/lib/editor.tcl b/lib/editor.tcl index b18a8b5..fd7e0c7 100644 --- a/lib/editor.tcl +++ b/lib/editor.tcl @@ -720,7 +720,7 @@ namespace eval Editor { #$txt tag bind Sel {puts ">>>>>>>>>>>>>>>>>>>"} #bind $txt {puts "/////////////////"} # #bind $txt GoToLine - # bind $txt {focus .frmTool.frmGoto.entGoTo; .frmTool.frmGoto.entGoTo delete 0 end} + bind $txt "Editor::GoToLineNumberDialog $txt" bind $txt "Editor::FindDialog $w" bind $txt "Editor::FindDialog $txt" bind $txt "Editor::FindDialog $txt" @@ -1302,6 +1302,57 @@ namespace eval Editor { $text see insert } + proc GoToLineNumberDialog {w} { + global editors lexers + variable txt + variable win + # set txt $w.frmText.t + set txt $w + set win .gotoline + set box [$txt bbox insert] + set x [expr [lindex $box 0] + [winfo rootx $txt] ] + set y [expr [lindex $box 1] + [winfo rooty $txt] + [lindex $box 3] ] + + if { [winfo exists $win] } { destroy $win } + toplevel $win + wm transient $win . + wm overrideredirect $win 1 + + ttk::entry $win.ent + pack $win.ent -expand true -fill y -side left + + bind $win { + destroy $Editor::win + focus -force $Editor::txt.t + break + } + bind $win.ent { + destroy $Editor::win + focus -force $Editor::txt.t + break + } + bind $win.ent { + set lineNumber [.gotoline.ent get] + # $txt see insert $lineNumber + puts $Editor::txt + $Editor::txt mark set insert $lineNumber.0 + $Editor::txt see insert + focus $Editor::txt.t + destroy .gotoline + break + } + # Определям расстояние до края экрана (основного окна) и если + # оно меньше размера окна со списком то сдвигаем его вверх + set winGeom [winfo reqheight $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 + focus $win.ent + } + proc EditorWidget {fr fileType} { global cfgVariables editors diff --git a/lib/files.tcl b/lib/files.tcl index fccc417..f67816e 100644 --- a/lib/files.tcl +++ b/lib/files.tcl @@ -15,7 +15,7 @@ namespace eval FileOper { {"All files" *} } - proc GetFileType {fileFullPath {opt ""}} { + proc GetFileMimeType {fileFullPath {opt ""}} { global cfgVariables # Проверям наличие программы в системе, если есть то добавляем опции # если нет то используем тиклевый пакет @@ -32,7 +32,7 @@ namespace eval FileOper { # lappend cmd $activeProject lappend cmd $fileFullPath catch $cmd pipe - puts $pipe + # puts $pipe if [regexp -nocase -- {(\w+)/([[:alnum:]-]+); charset=([[:alnum:]-]+)} $pipe m fType fExt fCharset] { puts "$fType $fExt $fCharset" } @@ -360,7 +360,7 @@ namespace eval FileOper { return false } else { # puts [::fileutil::magic::filetype $fileFullPath] - set fileType [FileOper::GetFileType $fileFullPath] + set fileType [FileOper::GetFileMimeType $fileFullPath] } switch $fileType { "text" { @@ -393,7 +393,7 @@ namespace eval FileOper { $itemName.frmText.t.t see 1.0 focus -force $itemName.frmText.t.t .frmStatus.lblSize configure -text [GetFileAttr $fileFullPath "size"] - .frmStatus.lblEncoding configure -text [GetFileType $fileFullPath "charset"] + .frmStatus.lblEncoding configure -text [GetFileMimeType $fileFullPath "charset"] return $itemName } diff --git a/lib/gui.tcl b/lib/gui.tcl index 73d752a..50b794d 100644 --- a/lib/gui.tcl +++ b/lib/gui.tcl @@ -81,7 +81,7 @@ pack .frmStatus -side top -padx 1 -fill x #pack [label .frmMenu.lbl -text "ddd"] pack [ttk::label .frmStatus.lblGitLogo -justify left] -side left -pack [ttk::label .frmStatus.lblGit] -side left -exp and true -fill x +pack [ttk::label .frmStatus.lblGit] -side left -expand true -fill x bind .frmStatus.lblGit { Git::BranchDialog %X %Y } diff --git a/projman.tcl b/projman.tcl index c66e997..03f1327 100755 --- a/projman.tcl +++ b/projman.tcl @@ -10,7 +10,7 @@ exec wish "$0" -- "$@" ###################################################### # Version: 2.0.0 # Release: alpha -# Build: 09112022170027 +# Build: 10112022153556 ###################################################### # определим текущую версию, релиз и т.д.