Compare commits

...

6 Commits

Author SHA1 Message Date
svkalinin 88f26ffba7 Обработка ошибок 2022-10-20 10:52:46 +03:00
svkalinin 83c1a2248c Обработка ошибок 2022-10-20 10:50:55 +03:00
svkalinin 83320a2259 Новая сборка 2022-10-20 10:19:24 +03:00
svkalinin ea111c6f32 Исправлена ошибка при клике на списке с файлами 2022-10-20 10:18:06 +03:00
svkalinin a9879738b7 New build 2022-10-20 10:02:47 +03:00
svkalinin 643ceeb7d9 Сделал просмотр изменений из истории 2022-10-20 09:44:26 +03:00
3 changed files with 70 additions and 16 deletions

View File

@ -114,4 +114,7 @@
- Added procedure for the horizontal split a text window
- Fixed untitled file saved
- Fixed Alt+R (delete row), now will are deleted row with a "\n\r" symbols
20/10/200
- Added Git support: add and commit changes, show git log, show each commit...

View File

@ -150,16 +150,59 @@ namespace eval Git {
# }
puts $cmd
catch $cmd pipe
puts $pipe
# puts $pipe
foreach line [split $pipe "\n"] {
puts "$line"
# puts "$line"
lappend res $line
}
return $res
}
# git show --pretty=format:"%h;%ad;%s"
proc Show {w} {
global cfgVariables activeProject
set commitString [$w.body.lLog get [$w.body.lLog curselection]]
set hash [string trim [lindex [split $commitString " "] 0]]
$w.body.t delete 1.0 end
$w.body.tCommit delete 1.0 end
set cmd exec
lappend cmd "$cfgVariables(gitCommand)"
lappend cmd "show"
lappend cmd "--pretty=format:\"%H;%an;%ae;%ad;%s\""
lappend cmd $hash
lappend cmd "--"
lappend cmd "$activeProject"
puts $cmd
catch $cmd pipe
# puts $pipe
set i 0
foreach line [split $pipe "\n"] {
if {$i == 0} {
set str [split $line ";"]
$w.body.tCommit inser end "Hash: [string trimleft [lindex $str 0] "\""]\n"
$w.body.tCommit inser end "Author: [lindex $str 1]\n"
$w.body.tCommit inser end "Email: [lindex $str 2]\n"
$w.body.tCommit inser end "Date: [lindex $str 3]\n"
$w.body.tCommit inser end "Description: [string trimright [lindex $str 4] "\""]\n"
} else {
# puts "$line"
$w.body.t inser end "$line\n"
}
incr i
# lappend res $line
}
$w.body.t highlight 1.0 end
$w.body.tCommit highlight 1.0 end
# return $res
}
proc ListBoxPress {w} {
set fileName [$w.body.lBox get [$w.body.lBox curselection]]
if {[$w.body.lBox curselection] ne ""} {
set fileName [$w.body.lBox get [$w.body.lBox curselection]]
} else {
return
}
# puts $values
$w.body.t delete 1.0 end
set i 0
@ -234,6 +277,9 @@ namespace eval Git {
$nbEditor select $nbEditor.git_browse
return
}
if {[info exists activeProject] == 0} {
return
}
set fr [NB::InsertItem $nbEditor git_browse "git"]
ttk::frame $fr.header
set lblName "lblGit"
@ -268,10 +314,10 @@ namespace eval Git {
listbox $fr.body.lCommit -border 0 -yscrollcommand "$fr.body.vlCommit set"
ttk::scrollbar $fr.body.vlCommit -orient vertical -command "$fr.body.lCommit yview"
ttk::scrollbar $fr.body.vCommit -command "$fr.body.tCommit yview"
ttk::scrollbar $fr.body.hCommit -orient horizontal -command "$fr.body.tCommit xview"
# ttk::scrollbar $fr.body.hCommit -orient horizontal -command "$fr.body.tCommit xview"
ctext $fr.body.tCommit -tabstyle tabular -undo true \
-xscrollcommand "$fr.body.hCommit set" -yscrollcommand "$fr.body.vCommit set" \
-font $cfgVariables(font) -relief flat -wrap none -linemap 0
-yscrollcommand "$fr.body.vCommit set" \
-font $cfgVariables(font) -relief flat -wrap word -linemap 0
ttk::button $fr.body.bCommit -image done_20x20 -compound left \
-text "[::msgcat::mc "Commit changes"]" \
@ -298,19 +344,19 @@ namespace eval Git {
grid $fr.body.v -column 5 -row 1 -sticky nsw
grid $fr.body.h -column 3 -row 2 -sticky new -columnspan 2
grid $fr.body.bAdd -column 0 -row 3 -sticky nsew
grid $fr.body.bRemove -column 1 -row 3 -sticky nsew
grid $fr.body.bAdd -column 0 -row 3 -sticky nsw
grid $fr.body.bRemove -column 1 -row 3 -sticky nsw
grid $fr.body.lblCommitText -column 3 -row 3 -sticky nsew -columnspan 2
grid $fr.body.lCommit -column 0 -row 4 -sticky nsew -rowspan 3 -columnspan 2
grid $fr.body.lCommit -column 0 -row 4 -sticky nsw -rowspan 3 -columnspan 2
grid $fr.body.vlCommit -column 2 -row 4 -sticky nsw -rowspan 3
grid $fr.body.tCommit -column 3 -row 4 -sticky nsew -columnspan 2
grid $fr.body.vCommit -column 5 -row 4 -sticky nsw
grid $fr.body.hCommit -column 3 -row 5 -sticky new -columnspan 2
# grid $fr.body.hCommit -column 3 -row 5 -sticky new -columnspan 2
grid $fr.body.bCommit -column 3 -row 6 -sticky new
grid $fr.body.bPush -column 4 -row 6 -sticky new
grid $fr.body.lblLog -column 0 -row 7 -sticky nsew -columnspan 5
grid $fr.body.lblLog -column 0 -row 7 -sticky nsw -columnspan 5
grid $fr.body.lLog -column 0 -row 8 -sticky nsew -columnspan 5
grid $fr.body.vLog -column 5 -row 8 -sticky nsw
grid $fr.body.hLog -column 0 -row 9 -sticky new -columnspan 5
@ -320,8 +366,8 @@ namespace eval Git {
grid columnconfigure $fr.body $fr.body.t -weight 1
grid rowconfigure $fr.body $fr.body.tCommit -weight 1
grid columnconfigure $fr.body $fr.body.tCommit -weight 1
grid rowconfigure $fr.body $fr.body.lLog -weight 1
grid columnconfigure $fr.body $fr.body.lLog -weight 1
# grid rowconfigure $fr.body $fr.body.lLog -weight 1
# grid columnconfigure $fr.body $fr.body.lLog -weight 1
# Git repo status
foreach { word } [Git::Status] {
@ -341,9 +387,12 @@ namespace eval Git {
catch { $fr.body.lBox activate 0 ; $fr.body.lBox selection set 0 0 }
bind $fr.body.lBox <Return> "Git::CommitAdd $fr"
bind $fr.body.lBox <Double-Button-1> "Git::CommitAdd $fr"
bind $fr.body.lBox <Double-Button-1> "catch {Git::CommitAdd $fr}"
bind $fr.body.lBox <Button-1><ButtonRelease-1> "Git::ListBoxPress $fr"
bind $fr.body.lBox <KeyRelease> "Git::Key %K $fr"
bind $fr.body.lLog <Double-Button-1> "Git::Show $fr"
bind $fr.body.lLog <Return> "Git::Show $fr"
focus -force $fr.body.lBox
catch {
@ -363,5 +412,7 @@ namespace eval Git {
ctext::addHighlightClassForRegexp $fr.body.t add green {^\+.*$}
ctext::addHighlightClassForRegexp $fr.body.t gremove grey {^\-.*$}
$fr.body.t highlight 1.0 end
ctext::addHighlightClassForRegexp $fr.body.tCommit stackControl lightblue {^[\w]+:}
}
}

View File

@ -10,7 +10,7 @@ exec wish "$0" -- "$@"
######################################################
# Version: 2.0.0
# Release: alpha
# Build: 19102022155228
# Build: 20102022105211
######################################################
# определим текущую версию, релиз и т.д.