Добавлен диалог перехода по номеру строки Ctrl-G
This commit is contained in:
		| @@ -720,7 +720,7 @@ namespace eval Editor { | |||||||
|         #$txt tag bind Sel  <Control-/> {puts ">>>>>>>>>>>>>>>>>>>"} |         #$txt tag bind Sel  <Control-/> {puts ">>>>>>>>>>>>>>>>>>>"} | ||||||
|         #bind $txt <Control-slash> {puts "/////////////////"} |         #bind $txt <Control-slash> {puts "/////////////////"} | ||||||
|         #     #bind $txt <Control-g> GoToLine |         #     #bind $txt <Control-g> GoToLine | ||||||
|         #     bind $txt <Control-g> {focus .frmTool.frmGoto.entGoTo; .frmTool.frmGoto.entGoTo delete 0 end} |         bind $txt <Control-g> "Editor::GoToLineNumberDialog $txt" | ||||||
|         bind $txt <Control-agrave> "Editor::FindDialog $w" |         bind $txt <Control-agrave> "Editor::FindDialog $w" | ||||||
|         bind $txt <Control-f> "Editor::FindDialog $txt" |         bind $txt <Control-f> "Editor::FindDialog $txt" | ||||||
|         bind $txt <Control-F> "Editor::FindDialog $txt" |         bind $txt <Control-F> "Editor::FindDialog $txt" | ||||||
| @@ -1302,6 +1302,57 @@ namespace eval Editor { | |||||||
|         $text see insert |         $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 <Escape> {  | ||||||
|  |             destroy $Editor::win | ||||||
|  |             focus -force $Editor::txt.t | ||||||
|  |             break | ||||||
|  |         } | ||||||
|  |         bind $win.ent <Escape> { | ||||||
|  |             destroy $Editor::win | ||||||
|  |             focus -force $Editor::txt.t | ||||||
|  |             break | ||||||
|  |         } | ||||||
|  |         bind $win.ent <Return> { | ||||||
|  |             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} { |     proc EditorWidget {fr fileType} { | ||||||
|         global cfgVariables editors |         global cfgVariables editors | ||||||
|          |          | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ namespace eval FileOper { | |||||||
|         {"All files" *} |         {"All files" *} | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     proc GetFileType {fileFullPath {opt ""}} { |     proc GetFileMimeType {fileFullPath {opt ""}} { | ||||||
|         global cfgVariables |         global cfgVariables | ||||||
|         # Проверям наличие программы в системе, если есть то добавляем опции |         # Проверям наличие программы в системе, если есть то добавляем опции | ||||||
|         # если нет то используем тиклевый пакет |         # если нет то используем тиклевый пакет | ||||||
| @@ -32,7 +32,7 @@ namespace eval FileOper { | |||||||
|         # lappend cmd $activeProject |         # lappend cmd $activeProject | ||||||
|         lappend cmd $fileFullPath |         lappend cmd $fileFullPath | ||||||
|         catch $cmd pipe  |         catch $cmd pipe  | ||||||
|         puts $pipe |         # puts $pipe | ||||||
|         if [regexp -nocase -- {(\w+)/([[:alnum:]-]+); charset=([[:alnum:]-]+)} $pipe m fType fExt fCharset] { |         if [regexp -nocase -- {(\w+)/([[:alnum:]-]+); charset=([[:alnum:]-]+)} $pipe m fType fExt fCharset] { | ||||||
|             puts "$fType $fExt $fCharset" |             puts "$fType $fExt $fCharset" | ||||||
|         } |         } | ||||||
| @@ -360,7 +360,7 @@ namespace eval FileOper { | |||||||
|             return false |             return false | ||||||
|         } else { |         } else { | ||||||
|             # puts [::fileutil::magic::filetype $fileFullPath] |             # puts [::fileutil::magic::filetype $fileFullPath] | ||||||
|             set fileType [FileOper::GetFileType $fileFullPath] |             set fileType [FileOper::GetFileMimeType $fileFullPath] | ||||||
|         } |         } | ||||||
|         switch $fileType { |         switch $fileType { | ||||||
|             "text" { |             "text" { | ||||||
| @@ -393,7 +393,7 @@ namespace eval FileOper { | |||||||
|         $itemName.frmText.t.t see 1.0 |         $itemName.frmText.t.t see 1.0 | ||||||
|         focus -force $itemName.frmText.t.t |         focus -force $itemName.frmText.t.t | ||||||
|         .frmStatus.lblSize configure -text [GetFileAttr $fileFullPath "size"] |         .frmStatus.lblSize configure -text [GetFileAttr $fileFullPath "size"] | ||||||
|         .frmStatus.lblEncoding configure -text [GetFileType $fileFullPath "charset"] |         .frmStatus.lblEncoding configure -text [GetFileMimeType $fileFullPath "charset"] | ||||||
|         return $itemName |         return $itemName | ||||||
|     } |     } | ||||||
|      |      | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ exec wish "$0" -- "$@" | |||||||
| ###################################################### | ###################################################### | ||||||
| # Version: 2.0.0 | # Version: 2.0.0 | ||||||
| # Release: alpha | # Release: alpha | ||||||
| # Build: 09112022170027 | # Build: 10112022153556 | ||||||
| ###################################################### | ###################################################### | ||||||
|  |  | ||||||
| # определим текущую версию, релиз и т.д. | # определим текущую версию, релиз и т.д. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 svkalinin
					svkalinin