From 4c6713b2d3225ec50e805cfabe850e54bcaaf2a3 Mon Sep 17 00:00:00 2001 From: Sergey Kalinin Date: Thu, 30 Oct 2025 12:52:21 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D1=87=D0=B0?= =?UTF-8?q?=20=D1=81=D0=B8=D0=B3=D0=BD=D0=B0=D0=BB=D0=BE=D0=B2=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B7=D0=B0=D0=BA=D1=80=D1=8B=D1=82=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=BF=D1=83=D1=89=D0=B5=D0=BD=D0=BD=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D0=BF=D1=80=D0=BE=D1=86=D0=B5=D1=81=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++++- debian/changelog | 3 +-- lib/highlight.tcl | 30 ++++++++++++++++++------------ lib/procedure.tcl | 41 +++++++++++++++++++++++++++++++++++++---- 4 files changed, 61 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 34a96f7..4dede1a 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,6 @@ Or type "projman" into terminal, Or choose the name of the program "Projman" on - Ctrl-N - Create new file - Ctrl-O - Open file - Ctrl-W - Close editor (file) -- Ctrl-K - Open folder - Ctrl-Q - Quit from ProjMan - 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 @@ -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-C - Copy selected text into 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-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-Y - Copy current line into buffer - Alt-S - Split the edited window horizontally +- Alt-K - Open folder ## Credits diff --git a/debian/changelog b/debian/changelog index 77c0972..05c1a10 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,7 +15,7 @@ projman (2.0.0-alpha18) stable; urgency=medium * Поправил тему оформления * Исправлена работа в windows - * Уменьшил колдичество выводимой отладочной информации + * Уменьшил количество выводимой отладочной информации * Добавлено определение пути до git в зависимости от платформы. * Исправлено создание файла конфигурации * Добавлены номера версий в вызов tclsh8.6 и wish8.6. @@ -387,4 +387,3 @@ projman (2.0.0-alfa0) stable; urgency=medium - diff --git a/lib/highlight.tcl b/lib/highlight.tcl index 28668bd..1f146de 100644 --- a/lib/highlight.tcl +++ b/lib/highlight.tcl @@ -191,18 +191,24 @@ namespace eval Highlight {} { ctext::addHighlightClass $txt bool #3e803b {null false true} } proc ExecuteColorized {txt} { - ctext::addHighlightClassForRegexp $txt flags orange {\s-[a-zA-Z]+} - 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::addHighlightClassWithOnlyCharStart $txt vars #4471ca "\$" - ctext::addHighlightClass $txt variable_funcs gold {set global variable unset} - ctext::addHighlightClassForSpecialChars $txt brackets green {[]{}()} - ctext::addHighlightClassForRegexp $txt paths lightblue {\.[a-zA-Z0-9\_\-]+} - ctext::addHighlightClassForRegexp $txt namespaces #4f64ff {::} - ctext::addHighlightClassForSpecialChars $txt qoute #b84a0c {"'`} - ctext::addHighlightClassForRegexp $txt colors #68ceff {(#)(\w)+?(\s|$)} - ctext::addHighlightClassForRegexp $txt comments #666666 {(^|;)\s*(#)[^\n\r]*} - ctext::addHighlightClass $txt bool #3e803b {null false true} + # ctext::addHighlightClassForRegexp $txt flags orange {\s-[a-zA-Z]+} + # 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::addHighlightClassWithOnlyCharStart $txt vars #4471ca "\$" + # ctext::addHighlightClass $txt variable_funcs gold {set global variable unset} + # # ctext::addHighlightClassForSpecialChars $txt brackets green {[]{}()} + # ctext::addHighlightClassForRegexp $txt namespaces #4f64ff {::} + # ctext::addHighlightClassForRegexp $txt qoute #b84a0c {("|'|`).+("|'|`)} + # ctext::addHighlightClassForRegexp $txt colors #68ceff {(#)(\w)+?(\s|$)} + # ctext::addHighlightClassForRegexp $txt comments #666666 {(^|;)\s*(#)[^\n\r]*} + # 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+} } } diff --git a/lib/procedure.tcl b/lib/procedure.tcl index d20cfc3..48a89b9 100644 --- a/lib/procedure.tcl +++ b/lib/procedure.tcl @@ -893,7 +893,12 @@ proc Run {w filePath} { cd [file dirname $filePath] set pipe [open "|$fullCommand 2> [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 [list SendSignal $processPID "SIGKILL"] + bind $w.frame.text [list SendSignal $processPID "SIGTSTP"] + bind $w.frame.text [list SendSignal $processPID "SIGINT"] + # set pipe [open "|$command $filePath" "r"] # set f [open [file join ~ tmp errors] "r"] fileevent $pipe readable [list DebugInfo $w.frame.text $pipe $f] @@ -909,7 +914,7 @@ proc DebugInfo {widget file f} { puts $msg $widget insert "end-4l linestart" "[::msgcat::mc "Program failed"]: $msg\n"; } else { - Highlight::ExecuteColorized $widget + # Highlight::ExecuteColorized $widget puts $msg $widget see "end-1l lineend" $widget delete "end-1l lineend" end @@ -917,9 +922,10 @@ proc DebugInfo {widget file f} { # $widget insert end "[::msgcat::mc "Program finished successfully"]\n" } Highlight::ExecuteColorized $widget + # close $f } else { - Highlight::ExecuteColorized $widget - $widget insert "end-4l linestart" [read $file] + # Highlight::ExecuteColorized $widget + $widget insert "end-4l linestart" "-->> [read $file]" } while {[gets $f line]>=0} { Highlight::ExecuteColorized $widget @@ -932,6 +938,33 @@ proc DebugInfo {widget file f} { # $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 {} { global dir