Добавлена логика для работы с troff/groff файлами

This commit is contained in:
2026-04-15 16:57:55 +03:00
parent 7356fe4a3b
commit 52ad7be0de
6 changed files with 57 additions and 7 deletions

2
.gitignore vendored
View File

@@ -8,4 +8,4 @@ debian/*.tmp
debian/errors debian/errors
*.tmp *.tmp
errors errors
test.tcl test.*

7
debian/changelog vendored
View File

@@ -1,3 +1,9 @@
projman (2.0.0-beta6) stable; urgency=medium
* Добавил отображение цитат.
-- Sergey Kalinin <svk@nuk-svk.ru> Wed, 8 Apr 2026 19:55:34 +0300
projman (2.0.0-beta6) stable; urgency=medium projman (2.0.0-beta6) stable; urgency=medium
* Добавил обновление информации в просмотрщике MD при сохранении открытого в редакторе файла. * Добавил обновление информации в просмотрщике MD при сохранении открытого в редакторе файла.
@@ -559,4 +565,5 @@ projman (2.0.0-alfa0) stable; urgency=medium

View File

@@ -1462,7 +1462,25 @@ namespace eval Editor {
} }
set fileType [string toupper [string trimleft [file extension $fileFullPath] "."]] set fileType [string toupper [string trimleft [file extension $fileFullPath] "."]]
if {$fileType eq ""} {set fileType "Unknown"} # Set file type if file extention is digits
switch -regexp -- $fileType {
[[:digit:]]+ {
if {[FileOper::GetFileMimeType $fileFullPath] eq "troff"} {
set fileType TROFF
} else {
set fileType "Unknow"
}
}
^$ {
if {[FileOper::GetFileMimeType $fileFullPath] eq "troff"} {
set fileType TROFF
} else {
set fileType "Unknow"
}
}
}
DebugPuts "Editor::Editor: file type is \"$fileType\""
# if {$fileType eq ""} {set fileType "Unknown"}
ExecutorCommandPathSetting $fileType ExecutorCommandPathSetting $fileType
@@ -1510,7 +1528,7 @@ namespace eval Editor {
puts $fileFullPath puts $fileFullPath
} }
# puts [$w.panelTxt panes] # puts [$w.panelTxt panes]
DebugPuts "$w $fileType $nb $fileFullPath" DebugPuts "Editor::SplitEditorForExecute: $w $fileType $nb $fileFullPath"
# set fileType [string toupper [string trimleft [file extension $filePath] "."]] # set fileType [string toupper [string trimleft [file extension $filePath] "."]]

View File

@@ -76,7 +76,13 @@ namespace eval FileOper {
} }
# линуксовый file не всегда корректно определяет тип файла # линуксовый file не всегда корректно определяет тип файла
# используем пакет из tcl # используем пакет из tcl
lassign [::fileutil::fileType $fileFullPath] fType fBinaryType fBinaryInterp if { $fType eq "text" && $fExt eq "troff"} {
set fType $fExt
set fBinaryType "text"
set fBinaryInterp "groff"
} else {
lassign [::fileutil::fileType $fileFullPath] fType fBinaryType fBinaryInterp
}
DebugPuts "File type is $fType, $fBinaryType, $fBinaryInterp" DebugPuts "File type is $fType, $fBinaryType, $fBinaryInterp"
set ext [string tolower [file extension $fileFullPath]] set ext [string tolower [file extension $fileFullPath]]
@@ -140,6 +146,9 @@ namespace eval FileOper {
} }
} }
} }
"troff" {
return troff
}
"empty" { "empty" {
return text return text
} }
@@ -536,7 +545,7 @@ namespace eval FileOper {
set fileType [FileOper::GetFileMimeType $fileFullPath] set fileType [FileOper::GetFileMimeType $fileFullPath]
} }
# puts "$fileType <<<<<<<<<<<" DebugPuts "FileOper::Edit: file type is \"$fileType\""
switch $fileType { switch $fileType {
"text" { "text" {

View File

@@ -925,6 +925,22 @@ proc Execute {filePath w activeEditor} {
# Added executor from config # Added executor from config
set fileType [string toupper [string trimleft [file extension $filePath] "."]] set fileType [string toupper [string trimleft [file extension $filePath] "."]]
switch -regexp -- $fileType {
[[:digit:]]+ {
if {[FileOper::GetFileMimeType $filePath] eq "troff"} {
set fileType TROFF
} else {
set fileType "Unknow"
}
}
^$ {
if {[FileOper::GetFileMimeType $filePath] eq "troff"} {
set fileType TROFF
} else {
set fileType "Unknow"
}
}
}
if {[info exists cfgVariables($fileType)] != 0 && $cfgVariables($fileType) ne ""} { if {[info exists cfgVariables($fileType)] != 0 && $cfgVariables($fileType) ne ""} {
$w.frame.text insert end "$cfgVariables($fileType) %f" $w.frame.text insert end "$cfgVariables($fileType) %f"
} }
@@ -1131,7 +1147,7 @@ proc ExecutorCommandPathSetting {fileType} {
} }
if {[info exists cfgVariables($fileType)] == 0} { if {[info exists cfgVariables($fileType)] == 0} {
set cfgVariables($fileType) "" set cfgVariables($fileType) ""
DebugPuts $cfgVariables($fileType) DebugPuts "ExecutorCommandPathSetting: cfgVariables($fileType) = $cfgVariables($fileType)"
} }
} }

View File

@@ -10,7 +10,7 @@ exec wish8.6 "$0" -- "$@"
###################################################### ######################################################
# Version: 2.0.0 # Version: 2.0.0
# Release: beta6 # Release: beta6
# Build: 08042026181732 # Build: 08042026195602
###################################################### ######################################################
# определим текущую версию, релиз и т.д. # определим текущую версию, релиз и т.д.