Исправлено комментирование выделенного фрагмента (последняя строка)
Исправлено закрытие untitled вкладок
This commit is contained in:
parent
5ee6d02cb9
commit
39aa7ecafe
|
@ -38,3 +38,7 @@
|
||||||
|
|
||||||
22/07/2022
|
22/07/2022
|
||||||
- Added GO highlight
|
- Added GO highlight
|
||||||
|
|
||||||
|
27/07/2022
|
||||||
|
- Fixed comment/uncomment procedure (last line in selected text)
|
||||||
|
- Fixed error with save new (untitled) file
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace eval Editor {
|
||||||
set lineEnd [lindex [split [lindex $selIndex 1] "."] 0]
|
set lineEnd [lindex [split [lindex $selIndex 1] "."] 0]
|
||||||
set posBegin [lindex [split [lindex $selIndex 1] "."] 0]
|
set posBegin [lindex [split [lindex $selIndex 1] "."] 0]
|
||||||
set posEnd [lindex [split [lindex $selIndex 1] "."] 1]
|
set posEnd [lindex [split [lindex $selIndex 1] "."] 1]
|
||||||
if {$lineEnd == $lineNum || $posEnd == 0} {
|
if {$lineEnd == $lineNum && $posEnd == 0} {
|
||||||
set lineEnd [expr $lineEnd - 1]
|
set lineEnd [expr $lineEnd - 1]
|
||||||
}
|
}
|
||||||
for {set i $lineBegin} {$i <=$lineEnd} {incr i} {
|
for {set i $lineBegin} {$i <=$lineEnd} {incr i} {
|
||||||
|
@ -394,24 +394,29 @@ namespace eval Editor {
|
||||||
} else {
|
} else {
|
||||||
set untitledNumber 0
|
set untitledNumber 0
|
||||||
}
|
}
|
||||||
set filePath untitled-$untitledNumber
|
# set filePath untitled-$untitledNumber
|
||||||
set fileName untitled-$untitledNumber
|
# set fileName untitled-$untitledNumber
|
||||||
set fileFullPath untitled-$untitledNumber
|
set fileFullPath untitled-$untitledNumber
|
||||||
#puts [Tree::InsertItem $tree {} $fileFullPath "file" $fileName]
|
#puts [Tree::InsertItem $tree {} $fileFullPath "file" $fileName]
|
||||||
set nbEditorItem [NB::InsertItem $nbEditor $fileFullPath "file"]
|
set nbEditorItem [NB::InsertItem $nbEditor $fileFullPath "file"]
|
||||||
puts "$nbEditorItem, $nbEditor"
|
# puts "$nbEditorItem, $nbEditor"
|
||||||
Editor $fileFullPath $nbEditor $nbEditorItem
|
Editor $fileFullPath $nbEditor $nbEditorItem
|
||||||
SetModifiedFlag $nbEditorItem
|
SetModifiedFlag $nbEditorItem
|
||||||
}
|
}
|
||||||
|
|
||||||
proc Editor {fileFullPath nb itemName} {
|
proc Editor {fileFullPath nb itemName} {
|
||||||
global cfgVariables
|
global cfgVariables
|
||||||
set fr $itemName
|
set fr $itemName
|
||||||
if ![string match "*untitled*" $itemName] {
|
if ![string match "*untitled*" $itemName] {
|
||||||
set lblName "lbl[string range $itemName [expr [string last "." $itemName] +1] end]"
|
set lblText $fileFullPath
|
||||||
ttk::label $fr.$lblName -text $fileFullPath
|
} else {
|
||||||
pack $fr.$lblName -side top -anchor w -fill x
|
set lblText ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set lblName "lbl[string range $itemName [expr [string last "." $itemName] +1] end]"
|
||||||
|
ttk::label $fr.$lblName -text $lblText
|
||||||
|
pack $fr.$lblName -side top -anchor w -fill x
|
||||||
|
|
||||||
set frmText [ttk::frame $fr.frmText -border 1]
|
set frmText [ttk::frame $fr.frmText -border 1]
|
||||||
set txt $frmText.t
|
set txt $frmText.t
|
||||||
|
|
||||||
|
@ -420,7 +425,7 @@ namespace eval Editor {
|
||||||
ctext $txt -yscrollcommand "$frmText.s set" -font $cfgVariables(font) -linemapfg $cfgVariables(lineNumberFG) \
|
ctext $txt -yscrollcommand "$frmText.s set" -font $cfgVariables(font) -linemapfg $cfgVariables(lineNumberFG) \
|
||||||
-tabs "[expr {4 * [font measure $cfgVariables(font) 0]}] left" -tabstyle tabular -undo true
|
-tabs "[expr {4 * [font measure $cfgVariables(font) 0]}] left" -tabstyle tabular -undo true
|
||||||
pack $txt -fill both -expand 1
|
pack $txt -fill both -expand 1
|
||||||
puts ">>>>>>> [bindtags $txt]"
|
# puts ">>>>>>> [bindtags $txt]"
|
||||||
if {$cfgVariables(lineNumberShow) eq "false"} {
|
if {$cfgVariables(lineNumberShow) eq "false"} {
|
||||||
$txt configure -linemap 0
|
$txt configure -linemap 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,9 +77,11 @@ namespace eval FileOper {
|
||||||
$nbEditor forget $nbItem
|
$nbEditor forget $nbItem
|
||||||
destroy $nbItem
|
destroy $nbItem
|
||||||
set treeItem "file::[string range $nbItem [expr [string last "." $nbItem] +1] end ]"
|
set treeItem "file::[string range $nbItem [expr [string last "." $nbItem] +1] end ]"
|
||||||
if {[$tree parent $treeItem] eq "" } {
|
if [$tree exists $treeItem] {
|
||||||
|
if {[$tree parent $treeItem] eq ""} {
|
||||||
$tree delete $treeItem
|
$tree delete $treeItem
|
||||||
}
|
}
|
||||||
|
}
|
||||||
unset modified($nbItem)
|
unset modified($nbItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,11 +94,12 @@ namespace eval FileOper {
|
||||||
if {$filePath eq ""} {
|
if {$filePath eq ""} {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
set fileName [string range $filePath [expr [string last "/" $filePath]+1] end]
|
# set fileName [string range $filePath [expr [string last "/" $filePath]+1] end]
|
||||||
puts ">>>>>$filePath, $fileName"
|
set fileName [file tail $filePath]
|
||||||
|
$nbEditor tab $nbEditorItem -text $fileName
|
||||||
# set treeitem [Tree::InsertItem $tree {} $filePath "file" $fileName]
|
# set treeitem [Tree::InsertItem $tree {} $filePath "file" $fileName]
|
||||||
# Close
|
set lblName "lbl[string range $nbEditorItem [expr [string last "." $nbEditorItem] +1] end]"
|
||||||
# Edit $filePath
|
$nbEditorItem.$lblName configure -text $filePath
|
||||||
} else {
|
} else {
|
||||||
set treeItem "file::[string range $nbEditorItem [expr [string last "." $nbEditorItem] +1] end ]"
|
set treeItem "file::[string range $nbEditorItem [expr [string last "." $nbEditorItem] +1] end ]"
|
||||||
set filePath [Tree::GetItemID $tree $treeItem]
|
set filePath [Tree::GetItemID $tree $treeItem]
|
||||||
|
|
|
@ -28,11 +28,10 @@ namespace eval NB {
|
||||||
puts "NB item - $fm"
|
puts "NB item - $fm"
|
||||||
return $fm
|
return $fm
|
||||||
}
|
}
|
||||||
|
|
||||||
proc CloseTab {w x y} {
|
proc CloseTab {w x y} {
|
||||||
if {[$w identify $x $y] == "close_button"} {
|
if {[$w identify $x $y] == "close_button"} {
|
||||||
puts "Hurrah! Close tab [$w index @$x,$y] plz."
|
|
||||||
FileOper::Close
|
FileOper::Close
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,4 +73,3 @@ proc SetModifiedFlag {w} {
|
||||||
}
|
}
|
||||||
$nbEditor tab $w -text $lbl
|
$nbEditor tab $w -text $lbl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user