Добавлена передача сигналов для закрытия запущенного процесса
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
2025-10-30 12:52:21 +03:00
parent dc5fd60c0d
commit 4c6713b2d3
4 changed files with 61 additions and 19 deletions

View File

@@ -120,7 +120,6 @@ Or type "projman" into terminal, Or choose the name of the program "Projman" on
- Ctrl-N - Create new file - Ctrl-N - Create new file
- Ctrl-O - Open file - Ctrl-O - Open file
- Ctrl-W - Close editor (file) - Ctrl-W - Close editor (file)
- Ctrl-K - Open folder
- Ctrl-Q - Quit from ProjMan - Ctrl-Q - Quit from ProjMan
- Ctrl-J - Show procedures (functions) list for navigation in open editor - Ctrl-J - Show procedures (functions) list for navigation in open editor
- Ctrl-L - Find and display files where the variable is defined, the name of which is located under the cursor in the editor - Ctrl-L - Find and display files where the variable is defined, the name of which is located under the cursor in the editor
@@ -134,6 +133,10 @@ Or type "projman" into terminal, Or choose the name of the program "Projman" on
- Ctrl-G - Go to line dialog - Ctrl-G - Go to line dialog
- Ctrl-C - Copy selected text into buffer - Ctrl-C - Copy selected text into buffer
- Ctrl-V - Paste text from buffer - Ctrl-V - Paste text from buffer
- Ctrl-R - Open terminal for edited file
- Ctrl-Z - Send SIGTSTP signal
- Ctrl-D - Send SIGINT signal
- Ctrl-C - Send SIGKILL signal
- Alt-P - Show/Hide the file tree panel - Alt-P - Show/Hide the file tree panel
- Alt-W - Delete the current word - Alt-W - Delete the current word
@@ -142,6 +145,7 @@ Or type "projman" into terminal, Or choose the name of the program "Projman" on
- Alt-R - Delete current line - Alt-R - Delete current line
- Alt-Y - Copy current line into buffer - Alt-Y - Copy current line into buffer
- Alt-S - Split the edited window horizontally - Alt-S - Split the edited window horizontally
- Alt-K - Open folder
## Credits ## Credits

3
debian/changelog vendored
View File

@@ -15,7 +15,7 @@ projman (2.0.0-alpha18) stable; urgency=medium
* Поправил тему оформления * Поправил тему оформления
* Исправлена работа в windows * Исправлена работа в windows
* Уменьшил колдичество выводимой отладочной информации * Уменьшил количество выводимой отладочной информации
* Добавлено определение пути до git в зависимости от платформы. * Добавлено определение пути до git в зависимости от платформы.
* Исправлено создание файла конфигурации * Исправлено создание файла конфигурации
* Добавлены номера версий в вызов tclsh8.6 и wish8.6. * Добавлены номера версий в вызов tclsh8.6 и wish8.6.
@@ -387,4 +387,3 @@ projman (2.0.0-alfa0) stable; urgency=medium

View File

@@ -191,18 +191,24 @@ namespace eval Highlight {} {
ctext::addHighlightClass $txt bool #3e803b {null false true} ctext::addHighlightClass $txt bool #3e803b {null false true}
} }
proc ExecuteColorized {txt} { proc ExecuteColorized {txt} {
ctext::addHighlightClassForRegexp $txt flags orange {\s-[a-zA-Z]+} # ctext::addHighlightClassForRegexp $txt flags orange {\s-[a-zA-Z]+}
ctext::addHighlightClass $txt stackControl #19a2a6 [info commands] # ctext::addHighlightClass $txt stackControl #19a2a6 [info commands]
ctext::addHighlightClass $txt widgets #9d468d [list canvas ctext button entry label text labelframe frame toplevel scrollbar checkbutton canvas listbox menu menubar menubutton radiobutton scale entry message tk_chooseDir tk_getSaveFile tk_getOpenFile tk_chooseColor tk_optionMenu ttk::button ttk::checkbutton ttk::combobox ttk::entry ttk::frame ttk::intro ttk::label ttk::labelframe ttk::menubutton ttk::treeview ttk::notebook ttk::panedwindow ttk::progressbar ttk::radiobutton ttk::scale ttk::scrollbar ttk::separator ttk::sizegrip ttk::spinbox ] # ctext::addHighlightClass $txt widgets #9d468d [list canvas ctext button entry label text labelframe frame toplevel scrollbar checkbutton canvas listbox menu menubar menubutton radiobutton scale entry message tk_chooseDir tk_getSaveFile tk_getOpenFile tk_chooseColor tk_optionMenu ttk::button ttk::checkbutton ttk::combobox ttk::entry ttk::frame ttk::intro ttk::label ttk::labelframe ttk::menubutton ttk::treeview ttk::notebook ttk::panedwindow ttk::progressbar ttk::radiobutton ttk::scale ttk::scrollbar ttk::separator ttk::sizegrip ttk::spinbox ]
ctext::addHighlightClassWithOnlyCharStart $txt vars #4471ca "\$" # ctext::addHighlightClassWithOnlyCharStart $txt vars #4471ca "\$"
ctext::addHighlightClass $txt variable_funcs gold {set global variable unset} # ctext::addHighlightClass $txt variable_funcs gold {set global variable unset}
ctext::addHighlightClassForSpecialChars $txt brackets green {[]{}()} # # ctext::addHighlightClassForSpecialChars $txt brackets green {[]{}()}
ctext::addHighlightClassForRegexp $txt paths lightblue {\.[a-zA-Z0-9\_\-]+} # ctext::addHighlightClassForRegexp $txt namespaces #4f64ff {::}
ctext::addHighlightClassForRegexp $txt namespaces #4f64ff {::} # ctext::addHighlightClassForRegexp $txt qoute #b84a0c {("|'|`).+("|'|`)}
ctext::addHighlightClassForSpecialChars $txt qoute #b84a0c {"'`} # ctext::addHighlightClassForRegexp $txt colors #68ceff {(#)(\w)+?(\s|$)}
ctext::addHighlightClassForRegexp $txt colors #68ceff {(#)(\w)+?(\s|$)} # ctext::addHighlightClassForRegexp $txt comments #666666 {(^|;)\s*(#)[^\n\r]*}
ctext::addHighlightClassForRegexp $txt comments #666666 {(^|;)\s*(#)[^\n\r]*} # ctext::addHighlightClass $txt bool #3e803b {null false true}
ctext::addHighlightClass $txt bool #3e803b {null false true} # ctext::addHighlightClassForRegexp $txt paths lightblue {(\s)([\w]+)(=)}
# ctext::addHighlightClassForSpecialChars $txt tags lightgreen {<>/}
# ctext::addHighlightClassForRegexp $txt tags #199100 {/.+\s}
ctext::addHighlightClassForRegexp $txt gopaths lightblue {(.+?):(\d+):(\d+):}
ctext::addHighlightClassForRegexp $txt paths lightblue {(\\|/|\.|^)((\w)|(\.)|(/)|([\.\w]))+?\s}
ctext::addHighlightClass $txt compile_errors #ff5050 {error Error ERROR invalid undefined cannot}
ctext::addHighlightClassForRegexp $txt url lightblue {\w+://\w.+\w+}
} }
} }

View File

@@ -893,7 +893,12 @@ proc Run {w filePath} {
cd [file dirname $filePath] cd [file dirname $filePath]
set pipe [open "|$fullCommand 2> [file join [file dirname $filePath] errors]" "r"] set pipe [open "|$fullCommand 2> [file join [file dirname $filePath] errors]" "r"]
set f [open [file join [file dirname $filePath] errors] "r"] set f [open [file join [file dirname $filePath] errors] "r"]
set processPID [pid $pipe]
bind $w.frame.text <Control-c> [list SendSignal $processPID "SIGKILL"]
bind $w.frame.text <Control-z> [list SendSignal $processPID "SIGTSTP"]
bind $w.frame.text <Control-d> [list SendSignal $processPID "SIGINT"]
# set pipe [open "|$command $filePath" "r"] # set pipe [open "|$command $filePath" "r"]
# set f [open [file join ~ tmp errors] "r"] # set f [open [file join ~ tmp errors] "r"]
fileevent $pipe readable [list DebugInfo $w.frame.text $pipe $f] fileevent $pipe readable [list DebugInfo $w.frame.text $pipe $f]
@@ -909,7 +914,7 @@ proc DebugInfo {widget file f} {
puts $msg puts $msg
$widget insert "end-4l linestart" "[::msgcat::mc "Program failed"]: $msg\n"; $widget insert "end-4l linestart" "[::msgcat::mc "Program failed"]: $msg\n";
} else { } else {
Highlight::ExecuteColorized $widget # Highlight::ExecuteColorized $widget
puts $msg puts $msg
$widget see "end-1l lineend" $widget see "end-1l lineend"
$widget delete "end-1l lineend" end $widget delete "end-1l lineend" end
@@ -917,9 +922,10 @@ proc DebugInfo {widget file f} {
# $widget insert end "[::msgcat::mc "Program finished successfully"]\n" # $widget insert end "[::msgcat::mc "Program finished successfully"]\n"
} }
Highlight::ExecuteColorized $widget Highlight::ExecuteColorized $widget
# close $f
} else { } else {
Highlight::ExecuteColorized $widget # Highlight::ExecuteColorized $widget
$widget insert "end-4l linestart" [read $file] $widget insert "end-4l linestart" "-->> [read $file]"
} }
while {[gets $f line]>=0} { while {[gets $f line]>=0} {
Highlight::ExecuteColorized $widget Highlight::ExecuteColorized $widget
@@ -932,6 +938,33 @@ proc DebugInfo {widget file f} {
# $widget configure -state disabled # $widget configure -state disabled
} }
# Функция для отправки сигнала процессу
proc SendSignal {pid signal} {
global tcl_platform
if {$tcl_platform(platform) eq "unix"} {
# На Unix-системах
switch -- $signal {
"SIGINT" { exec kill -INT $pid } ; # Ctrl+C
"SIGTERM" { exec kill -TERM $pid } ; # Завершение
"SIGTSTP" { exec kill -TSTP $pid } ; # Ctrl+Z (приостановка)
"SIGKILL" { exec kill -KILL $pid } ; # Принудительное завершение
}
} else {
# На Windows
switch -- $signal {
"SIGINT" - "SIGTERM" {
# Используем taskkill для завершения
catch {exec taskkill /PID $pid /T}
}
"SIGKILL" {
# Принудительное завершение на Windows
catch {exec taskkill /PID $pid /T /F}
}
}
}
}
# Правка файла настроек # Правка файла настроек
proc Settings {} { proc Settings {} {
global dir global dir