14 Commits

Author SHA1 Message Date
7d0db9f2ea Новая сборка 2026-04-21 11:23:08 +03:00
751b334963 Исправлена ошибка с созданием нового файла 2026-04-21 11:22:19 +03:00
a437aa5ff3 Новая сборка 2026-04-15 17:03:28 +03:00
52ad7be0de Добавлена логика для работы с troff/groff файлами 2026-04-15 16:57:55 +03:00
7356fe4a3b Добавил настройку команды для troff файлов (по умолчанию groff) 2026-04-15 16:57:07 +03:00
95894f19f6 Добавлена иконка для troff файлов 2026-04-15 16:54:39 +03:00
6b21f83d03 Добавил отображение цитат. 2026-04-08 19:55:34 +03:00
4a967c6b6c Добавил обновление информации в просмотрщике MD при сохранении открытого в редакторе файла. 2026-04-08 18:17:24 +03:00
82b94e5b4e Новая сборка 2026-04-08 16:50:52 +03:00
f8a406583a Добавлены настройки для просмотрщика MD в части касаемой ссылок и выделения текста. 2026-04-08 16:48:19 +03:00
6a616b27e8 Добавлена обработка тэгов выдеоления текста курсивом или тодщиной. Релизована обработка показа ссылок и вызова брузера при щелчке на ссылке. 2026-04-08 16:47:43 +03:00
1c872c5558 Добавлены процедуры отображение подсказок и запуска броузера для ссылок. 2026-04-08 16:46:31 +03:00
153bd65929 Добавил выбор и вставку цвета в виде кода #nnnnnn 2026-04-08 12:37:31 +03:00
1cd469c68a Добавил выбор и вставку цвета в виде кода #nnnnnn 2026-04-08 12:36:56 +03:00
13 changed files with 401 additions and 67 deletions

1
.gitignore vendored
View File

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

View File

@@ -160,6 +160,7 @@ Or type "projman" into terminal, Or choose the name of the program "Projman" on
- Alt-K - Open folder - Alt-K - Open folder
### Work with external tools ### Work with external tools
ProjMan allows you to connect any external tools to the editor. To do this, you need to add an entry to the file ~/.config/projman/tools.ini. ProjMan allows you to connect any external tools to the editor. To do this, you need to add an entry to the file ~/.config/projman/tools.ini.
Calling an external program is available through the main and pop-up menus. To transfer the parameters, write the appropriate template in the file. Calling an external program is available through the main and pop-up menus. To transfer the parameters, write the appropriate template in the file.
@@ -186,9 +187,8 @@ shortCut=
## Credits ## Credits
Sergey Kalinin - author Sergey Kalinin - author
svk@nuk-svk.ru
http://nuk-svk.ru Home page: [nuk-svk.ru](https://nuk-svk.ru). E-mail: [svk@nuk-svk.ru](svk@nuk-svk.ru)
Laurent Riesterer - VisualREGEXP and TkDIFF+ parts Laurent Riesterer - VisualREGEXP and TkDIFF+ parts
laurent.riesterer@free.fr laurent.riesterer@free.fr [http://laurent.riesterer.free.fr](http://laurent.riesterer.free.fr)
http://laurent.riesterer.free.fr

19
debian/changelog vendored
View File

@@ -1,3 +1,17 @@
projman (2.0.0-beta6) stable; urgency=medium
* Добавлена логика для работы с troff/groff файлами
* Добавил настройку команды для troff файлов (по умолчанию groff)
* Добавлена иконка для troff файлов
* Добавлены настройки для просмотрщика MD в части касаемой ссылок и выделения текста.
* Добавлена обработка тэгов выдеоления текста курсивом или тодщиной. Релизована обработка показа ссылок и вызова брузера при щелчке на ссылке.
* Добавлены процедуры отображение подсказок и запуска броузера для ссылок.
* Добавил выбор и вставку цвета в виде кода #nnnnnn
* Добавил выбор и вставку цвета в виде кода #nnnnnn
* Добавил корректный путь к readme для rpm пакетов
-- Sergey Kalinin <svk@nuk-svk.ru> Fri, 27 Mar 2026 11:41:21 +0300
projman (2.0.0-beta6) stable; urgency=medium projman (2.0.0-beta6) stable; urgency=medium
* Отключил сжатие README.md в пакете * Отключил сжатие README.md в пакете
@@ -532,5 +546,10 @@ projman (2.0.0-alfa0) stable; urgency=medium

View File

@@ -75,11 +75,13 @@ RB=ruby
HTM=firefox HTM=firefox
HTML=firefox HTML=firefox
LUA=lua LUA=lua
TROFF=groff
\[Debug\] \[Debug\]
debug=false debug=false
debugOut=stdout debugOut=stdout
\[Viewer\] \[Viewer\]
listSymbol= listSymbol=
viewerFont={Droid Sans Mono} 10
h1Font={Droid Sans Mono} 20 bold h1Font={Droid Sans Mono} 20 bold
h2Font={Droid Sans Mono} 18 bold h2Font={Droid Sans Mono} 18 bold
h3Font={Droid Sans Mono} 16 bold h3Font={Droid Sans Mono} 16 bold
@@ -87,10 +89,16 @@ h4Font={Droid Sans Mono} 14 bold
h5Font={Droid Sans Mono} 12 bold h5Font={Droid Sans Mono} 12 bold
h6Font={Droid Sans Mono} 10 bold h6Font={Droid Sans Mono} 10 bold
mdListFont={Droid Sans Mono} 10 mdListFont={Droid Sans Mono} 10
italicFont={Droid Sans Mono} 10 italic
boldFont={Droid Sans Mono} 10 bold
italicBoldFont={Droid Sans Mono} 10 bold italic
codeBlockBG=#7a7a7a codeBlockBG=#7a7a7a
codeBlockFG=black codeBlockFG=black
codeBlockFont=Monospace 10 italic codeBlockFont=Monospace 10 italic
textBG=#333333 textBG=#333333
linkFont={Droid Sans Mono} 10 bold
linkFG=#54bcff
runViewer=true
" "
proc Config::create {dir} { proc Config::create {dir} {
set cfgFile [open [file join $dir projman.ini] "w+"] set cfgFile [open [file join $dir projman.ini] "w+"]

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,16 @@ 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] "."]]
# Execute the MD-file viewer
if {$fileType eq "MD" && $cfgVariables(runViewer) eq "true"} {
ShowMD $fileFullPath
return
}
if [winfo exists $w.frmText2] { if [winfo exists $w.frmText2] {
$w.panelTxt forget $w.frmText2 $w.panelTxt forget $w.frmText2
destroy $w.frmText2 destroy $w.frmText2

View File

@@ -7,7 +7,6 @@
# Working with files module # Working with files module
###################################################### ######################################################
namespace eval FileOper { namespace eval FileOper {
global packages global packages
variable types variable types
@@ -47,6 +46,9 @@ namespace eval FileOper {
proc GetFileMimeType {fileFullPath {opt ""}} { proc GetFileMimeType {fileFullPath {opt ""}} {
global cfgVariables global cfgVariables
if [regexp -nocase -- {untitled} $fileFullPath mattch] {
return text
}
# Проверям наличие программы в системе, если есть то добавляем опции # Проверям наличие программы в системе, если есть то добавляем опции
# если нет то используем тиклевый пакет # если нет то используем тиклевый пакет
if [file exists $cfgVariables(fileTypeCommand)] { if [file exists $cfgVariables(fileTypeCommand)] {
@@ -67,6 +69,7 @@ namespace eval FileOper {
if [regexp -nocase -- {(\w+)/([\w\-_\.]+); charset=([[:alnum:]-]+)} $pipe m fType fExt fCharset] { if [regexp -nocase -- {(\w+)/([\w\-_\.]+); charset=([[:alnum:]-]+)} $pipe m fType fExt fCharset] {
DebugPuts "$fType $fExt $fCharset" DebugPuts "$fType $fExt $fCharset"
} }
switch $opt { switch $opt {
"charset" { "charset" {
if [info exists fCharset] { if [info exists fCharset] {
@@ -76,7 +79,13 @@ namespace eval FileOper {
} }
# линуксовый file не всегда корректно определяет тип файла # линуксовый file не всегда корректно определяет тип файла
# используем пакет из tcl # используем пакет из tcl
if { $fType eq "text" && $fExt eq "troff"} {
set fType $fExt
set fBinaryType "text"
set fBinaryInterp "groff"
} else {
lassign [::fileutil::fileType $fileFullPath] fType fBinaryType fBinaryInterp 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 +149,9 @@ namespace eval FileOper {
} }
} }
} }
"troff" {
return troff
}
"empty" { "empty" {
return text return text
} }
@@ -395,6 +407,14 @@ namespace eval FileOper {
# puts "$f was saved" # puts "$f was saved"
close $f close $f
ResetModifiedFlag $nbEditorItem $nbEditorWindow ResetModifiedFlag $nbEditorItem $nbEditorWindow
# Проверяем если в редакторе открыт MD-файл и запущен его просмотрщик
if {[string toupper [string trimleft [file extension $filePath] "."]] eq "MD" && [winfo exists .viewer]} {
if {[wm title .viewer] eq $filePath} {
ShowMD $filePath true
}
}
if {[file tail $filePath] eq "projman.ini"} { if {[file tail $filePath] eq "projman.ini"} {
Config::read $dir(cfg) Config::read $dir(cfg)
} }
@@ -528,7 +548,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

@@ -1968,3 +1968,14 @@ image create photo cpp_16x12 -data {
AAALEwEAmpwYAAAAB3RJTUUH6gIGDxU21/OqSAAAADVJREFUCNd9jUEOACAIw7D7/58VmNF4sAco AAALEwEAmpwYAAAAB3RJTUUH6gIGDxU21/OqSAAAADVJREFUCNd9jUEOACAIw7D7/58VmNF4sAco
CbCIm5FsBTwsd+kmgVQu87p3OLfg/9AJJPFhAjDkAJmwKBolAAAAAElFTkSuQmCC CbCIm5FsBTwsd+kmgVQu87p3OLfg/9AJJPFhAjDkAJmwKBolAAAAAElFTkSuQmCC
} }
image create photo troff_16x12 -data {
iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAAXNSR0IB2cksfwAAAARnQU1BAACx
jwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dE
AAAAAAAA+UO7fwAAAAlwSFlzAAAAWAAAAFgBeNpLYgAAAAd0SU1FB+oEDw0yFseUVqEAAAEXSURB
VCjPfZE/S4JxEMc/p4/EU489Bg5BSDgECdZQU7QF0hYUuLm1+yJqj15AS2+gRWhraWvIQcEKwnIw
bIt80OcPT9fSY49pfuE47nf34X53J0xRuaxJd/G1ilCpXeS34znjx2v0sLx6SHdwRcZcB0lEOfkL
oKqEoXJz+0Hz0eO+5VHaMbm+HO+eiAf1hsNbzyefS+EMlWLBnPjuCBgMQ3rvPhnboPHgMpeCwtoM
4Lnt0ndC0gtJ6k8BRyULyzL+B0QUz4eT8zssU9jfs6ct8Hfol47P1uY8nW4RP1AytjEbyK2ksG2D
LxWqx1kSIsySfvYDPT3rarPlaFzxG40BgO4e1BTSUVHcJoYWQJayGxXoSxTHbKRvV5VqA9sEagYA
AAAASUVORK5CYII=
}

View File

@@ -9,11 +9,11 @@
# #
###################################################### ######################################################
proc ShowMD {fileFullPath} { proc ShowMD {fileFullPath {reload "false"}} {
global cfgVariables global cfgVariables
set win .viewer set win .viewer
if {$reload eq "false"} {
set parentGeometry [wm geometry .] set parentGeometry [wm geometry .]
set parentWidth [winfo width .] set parentWidth [winfo width .]
set parentHeight [winfo height .] set parentHeight [winfo height .]
@@ -32,7 +32,8 @@ proc ShowMD {fileFullPath} {
if { [winfo exists $win] } { destroy $win; return false } if { [winfo exists $win] } { destroy $win; return false }
toplevel $win toplevel $win
wm title $win "[::msgcat::mc "Help"]" # wm title $win "[::msgcat::mc "Help"]"
wm title $win $fileFullPath
wm geometry $win ${newWidth}x${newHeight}+${x}+${y} wm geometry $win ${newWidth}x${newHeight}+${x}+${y}
wm overrideredirect $win 0 wm overrideredirect $win 0
@@ -40,7 +41,7 @@ proc ShowMD {fileFullPath} {
pack $frm -expand 1 -fill both pack $frm -expand 1 -fill both
set txt [text $frm.txt -wrap $cfgVariables(editorWrap) -background $cfgVariables(textBG) \ set txt [text $frm.txt -wrap $cfgVariables(editorWrap) -background $cfgVariables(textBG) \
-xscrollcommand "$win.h set" -yscrollcommand "$frm.v set"] -xscrollcommand "$win.h set" -yscrollcommand "$frm.v set" -font $cfgVariables(viewerFont)]
pack $txt -side left -expand 1 -fill both pack $txt -side left -expand 1 -fill both
pack [ttk::scrollbar $frm.v -command "$frm.txt yview"] -side right -fill y pack [ttk::scrollbar $frm.v -command "$frm.txt yview"] -side right -fill y
ttk::scrollbar $win.h -orient horizontal -command "$frm.txt xview" ttk::scrollbar $win.h -orient horizontal -command "$frm.txt xview"
@@ -59,7 +60,15 @@ proc ShowMD {fileFullPath} {
$txt tag configure mdList -font $cfgVariables(mdListFont) $txt tag configure mdList -font $cfgVariables(mdListFont)
$txt tag configure codeBlock -foreground $cfgVariables(codeBlockFG) \ $txt tag configure codeBlock -foreground $cfgVariables(codeBlockFG) \
-background $cfgVariables(codeBlockBG) -font $cfgVariables(codeBlockFont) -background $cfgVariables(codeBlockBG) -font $cfgVariables(codeBlockFont)
$txt tag configure italic -font $cfgVariables(italicFont)
$txt tag configure bold -font $cfgVariables(boldFont)
$txt tag configure italicBold -font $cfgVariables(italicBoldFont)
$txt tag configure link -foreground $cfgVariables(linkFG) -font $cfgVariables(linkFont)
$txt tag configure quote -background $cfgVariables(codeBlockBG)
} else {
set txt .viewer.frmHelp.txt
$txt delete 0.0 end
}
set codeBlockBegin false set codeBlockBegin false
set f [open "$fileFullPath" r] set f [open "$fileFullPath" r]
@@ -91,7 +100,20 @@ proc ShowMD {fileFullPath} {
} elseif {$textTag eq "codeBlockOneString"} { } elseif {$textTag eq "codeBlockOneString"} {
ProcessLineWithCode $line $txt ProcessLineWithCode $line $txt
} elseif {$textTag eq "mdList"} { } elseif {$textTag eq "mdList"} {
$txt insert end " $cfgVariables(listSymbol) $result\n" $txt insert end " $cfgVariables(listSymbol) [lindex $result 1]\n"
} elseif {$textTag eq "breakTheLine"} {
$txt insert end "[lindex $result 1]\n\n"
} elseif {$textTag eq "link"} {
ProcessLineWithURL $line $txt $result
} elseif {$textTag eq "markable"} {
ProcessLineWithMark $line $txt $result
} elseif {$textTag eq "quote"} {
set symList [split [lindex $result 2] ">"]
for {set i 1} { $i < [llength $symList]} {incr i} {
$txt insert end " " quote
$txt insert end " "
}
$txt insert end [lindex $result 1]\n
} else { } else {
$txt insert end "[lindex $result 1]\n" $textTag $txt insert end "[lindex $result 1]\n" $textTag
} }
@@ -101,7 +123,7 @@ proc ShowMD {fileFullPath} {
} }
proc ProcessLineWithCode {line txt} { proc ProcessLineWithCode {line txt} {
set codeBlocks [ExtractCodeBlocks $line] set codeBlocks [ExtractCodeBlocks $line {`{1,3}([^`]+)`{1,3}}]
if {[llength $codeBlocks] == 0} { if {[llength $codeBlocks] == 0} {
$txt insert end "$line\n" $txt insert end "$line\n"
@@ -122,8 +144,8 @@ proc ProcessLineWithCode {line txt} {
# Вставляем текст перед кодом # Вставляем текст перед кодом
if {$start > $lastPos} { if {$start > $lastPos} {
set text_before [string range $line $lastPos [expr {$start - 1}]] set textBefore [string range $line $lastPos [expr {$start - 1}]]
$txt insert end $text_before $txt insert end $textBefore
} }
# Вставляем код с соответствующим тегом # Вставляем код с соответствующим тегом
@@ -144,13 +166,108 @@ proc ProcessLineWithCode {line txt} {
$txt insert end "\n" $txt insert end "\n"
} }
# Функция вставки ссылки
proc InsertLink {txt link url} {
global cfgVariables
set tag [format "link_%d" [incr ::link_counter]]
$txt insert end $link $tag
$txt tag configure $tag -foreground $cfgVariables(linkFG) -font $cfgVariables(linkFont)
$txt tag bind $tag <Button-1> [list OpenURL $url]
# $txt tag bind $tag <Enter> [list $txt configure -cursor hand2]
$txt tag bind $tag <Enter> [list InsertLinkEnter $txt $tag $url]
$txt tag bind $tag <Leave> [list InsertLinkLeave $txt]
# $txt tag bind $tag <Leave> [list InsertLinkLeave $txt $tag]
# $txt tag bind $tag <Enter> [list %W tag configure $tag -foreground red]
# $txt tag bind $tag <Leave> [list %W tag configure $tag -foreground blue]
}
proc InsertLinkEnter {txt tag url} {
$txt configure -cursor hand2
# Показываем подсказку с URL
ShowTooltip $txt $url
}
proc InsertLinkLeave {txt} {
if [winfo exists .baloonTip] {destroy .baloonTip}
$txt configure -cursor ""
}
proc ProcessLineWithURL {line txt urlList} {
if {[llength $urlList] == 0} {
$txt insert end "$line\n"
return
}
set resultLine ""
set lastPos 0
foreach url [lindex $urlList 1] {
set start [lindex [lindex $url 1] 0]
set end [lindex [lindex $url 1] 1]
set linkName [lindex [lindex $url 2] 0]
# set linkStart [lindex [lindex $url 2] 1]
# set linkEnd [lindex [lindex $url 2] 2]
set urlName [lindex [lindex $url 3] 0]
# set urlStart [lindex [lindex $url 3] 1]
# set urlEnd [lindex [lindex $url 3] 2]
# Вставляем текст перед ссылкой
if {$start > $lastPos} {
set textBefore [string range $line $lastPos [expr {$start - 1}]]
$txt insert end $textBefore
}
# $txt insert end $linkName link
InsertLink $txt $linkName $urlName
set lastPos [expr {$end + 1}]
}
# Вставляем остаток строки
if {$lastPos < [string length $line]} {
$txt insert end [string range $line $lastPos end]
}
$txt insert end "\n"
}
proc ProcessLineWithMark {line txt textList} {
if {[llength $textList] == 0} {
$txt insert end "$line\n"
return
}
set resultLine ""
set lastPos 0
foreach record [lindex $textList 1] {
set start [lindex [lindex $record 2] 0]
set end [lindex [lindex $record 2] 1]
set markableText [lindex $record 1]
# Вставляем текст перед ссылкой
if {$start > $lastPos} {
set textBefore [string range $line $lastPos [expr {$start - 1}]]
$txt insert end $textBefore
}
switch [lindex $record 4] {
"*" {set tag italic}
"**" {set tag bold}
"***" {set tag italicBold}
"_" {set tag italic}
"__" {set tag bold}
"___" {set tag italicBold}
}
$txt insert end " $markableText" $tag
set lastPos [expr {$end + 1}]
}
# Вставляем остаток строки
if {$lastPos < [string length $line]} {
$txt insert end [string range $line $lastPos end]
}
$txt insert end "\n"
}
proc MarkDownParser {line} { proc MarkDownParser {line} {
# Title # Title
# [regexp -nocase -line -- {^(#{1,6})\s\w+} $line match sharp] # [regexp -nocase -line -- {^(#{1,6})\s\w+} $line match sharp]
if [regexp -nocase -all -line -- {^(#{1,6})\s(.+)} $line match sharp title] { if [regexp -nocase -all -line -- {^(#{1,6})\s(.+)} $line match sharp title] {
set titlePrefixLength [string length $sharp] set titlePrefixLength [string length $sharp]
puts $title
switch $titlePrefixLength { switch $titlePrefixLength {
1 {return [list h1 "$title"]} 1 {return [list h1 "$title"]}
2 {return [list h2 "$title"]} 2 {return [list h2 "$title"]}
@@ -175,18 +292,37 @@ proc MarkDownParser {line} {
if [regexp -nocase -all -line -- {`{1,3}([^`]+)`{1,3}} $line match v1 code v2] { if [regexp -nocase -all -line -- {`{1,3}([^`]+)`{1,3}} $line match v1 code v2] {
# puts $line # puts $line
set result [ExtractCodeBlocks $line] set result [ExtractCodeBlocks $line {`{1,3}([^`]+)`{1,3}}]
# puts "$v1, $code, $v2" # puts "$v1, $code, $v2"
# puts "$result" # puts "$result"
return [list codeBlockOneString $result] return [list codeBlockOneString $result]
} }
# Line break (\, <br>, " ")
if [regexp -nocase -all -line -linestop -- {(.*)(\B|<br>| {2,})$} $line match v1 v2] {
return [list breakTheLine $v1]
}
# Italic text
if [regexp -nocase -all -line -linestop -- {(^|\s+)(_{1,3}|\*{1,3})([^_\*]+)(_{1,3}|\*{1,3})} $line match v1 v2 v3 v4] {
set result [ExtractBlocks $line {(^|\s+)(_{1,3}|\*{1,3})([^_\*]+)(_{1,3}|\*{1,3})}]
return [list markable $result]
}
# URL (link) parser
if [regexp -nocase -all -line -linestop -- {\[([^\]]+)\]\(([^)]+)\)} $line match v1 v2] {
set result [ExtractURL $line {\[([^\]]+)\]\(([^)]+)\)}]
return [list link $result]
}
# Quoted text
if [regexp -nocase -line -- {(^>(?:>|\s)*)(.*)$} $line match v1 v2] {
puts "Quoted text $match"
return [list quote $v2 $v1]
}
return [list {} $line] return [list {} $line]
} }
proc ExtractCodeBlocks {line} { proc ExtractCodeBlocks {line pattern} {
set pattern {`{1,3}([^`]+)`{1,3}} # set pattern {`{1,3}([^`]+)`{1,3}}
set result {} set result {}
# Ищем все вхождения # Ищем все вхождения
@@ -207,7 +343,58 @@ proc ExtractCodeBlocks {line} {
set pos [expr {$end + 1}] set pos [expr {$end + 1}]
} }
return $result
}
proc ExtractURL {line pattern} {
set result {}
# Ищем все вхождения
set pos 0
while {[regexp -indices -start $pos -- $pattern $line match link url]} {
set start [lindex $match 0]
set end [lindex $match 1]
set linkStart [lindex $link 0]
set linkEnd [lindex $link 1]
set urlStart [lindex $url 0]
set urlEnd [lindex $url 1]
# Получаем текст ссылки без кавычек
set linkText [string range $line $linkStart $linkEnd]
# Получаем текст url без кавычек
set urlText [string range $line $urlStart $urlEnd]
# Получаем полный текст с кавычками
set fullMatch [string range $line $start $end]
lappend result [list $fullMatch [list $start $end] [list $linkText $linkStart $linkEnd] [list $urlText $urlStart $urlEnd]]
set pos [expr {$end + 1}]
}
return $result return $result
} }
proc ExtractBlocks {line pattern} {
set result {}
# Ищем все вхождения
set pos 0
while {[regexp -indices -start $pos -- $pattern $line match v1 blockSymbolBegin code blocSymbolEnd]} {
set start [lindex $match 0]
set end [lindex $match 1]
set codeStart [lindex $code 0]
set codeEnd [lindex $code 1]
# Получаем текст кода без кавычек
set codeText [string range $line $codeStart $codeEnd]
# Получаем полный текст с кавычками
set fullMatch [string range $line $start $end]
lappend result [list $fullMatch $codeText [list $start $end] [list $codeStart $codeEnd] [string range $line [lindex $blockSymbolBegin 0] [lindex $blockSymbolBegin 1]]]
set pos [expr {$end + 1}]
}
return $result
}

View File

@@ -86,6 +86,8 @@ proc GetEditMenu {m} {
$m add separator $m add separator
$m add command -label [::msgcat::mc "Insert image"] -accelerator "Ctrl+I"\ $m add command -label [::msgcat::mc "Insert image"] -accelerator "Ctrl+I"\
-command ImageBase64Encode -command ImageBase64Encode
$m add command -label [::msgcat::mc "Insert color code"]\
-command ChooseColor
$m add separator $m add separator
$m add command -label [::msgcat::mc "Settings"] -command Settings $m add command -label [::msgcat::mc "Settings"] -command Settings
} }
@@ -190,4 +192,3 @@ proc GetConvertIdentCaseMenu {m} {
} }
# 2026 Vadim Ushakov <wandrien.dev@gmail.com> # 2026 Vadim Ushakov <wandrien.dev@gmail.com>
# ============================================================ # ============================================================

View File

@@ -18,6 +18,7 @@
::msgcat::mcset en "Braces foreground" ::msgcat::mcset en "Braces foreground"
::msgcat::mcset en "Cancel" ::msgcat::mcset en "Cancel"
::msgcat::mcset en "Can't found file:" ::msgcat::mcset en "Can't found file:"
::msgcat::mcset en "Choose color"
::msgcat::mcset en "Close" ::msgcat::mcset en "Close"
::msgcat::mcset en "Close all" ::msgcat::mcset en "Close all"
::msgcat::mcset en "Close Project Manager?" ::msgcat::mcset en "Close Project Manager?"
@@ -85,6 +86,7 @@
::msgcat::mcset en "Indent foreground" ::msgcat::mcset en "Indent foreground"
::msgcat::mcset en "Indent background" ::msgcat::mcset en "Indent background"
::msgcat::mcset en "Interface language" ::msgcat::mcset en "Interface language"
::msgcat::mcset en "Insert color code"
::msgcat::mcset en "Insert image" ::msgcat::mcset en "Insert image"
::msgcat::mcset en "Install Tcl/Tk Project Manager" ::msgcat::mcset en "Install Tcl/Tk Project Manager"
::msgcat::mcset en "Input file name" ::msgcat::mcset en "Input file name"
@@ -204,4 +206,3 @@
::msgcat::mcset en "SCREAMING-KEBAB-CASE" ::msgcat::mcset en "SCREAMING-KEBAB-CASE"
::msgcat::mcset en "Train-Case" ::msgcat::mcset en "Train-Case"
::msgcat::mcset en "space separated" ::msgcat::mcset en "space separated"

View File

@@ -24,6 +24,7 @@
::msgcat::mcset ru "Cancel" "Отмена" ::msgcat::mcset ru "Cancel" "Отмена"
::msgcat::mcset ru "Can't found file:" "Не найден файл:" ::msgcat::mcset ru "Can't found file:" "Не найден файл:"
::msgcat::mcset ru "Char" "Символ" ::msgcat::mcset ru "Char" "Символ"
::msgcat::mcset ru "Choose color" "Выбор цвета"
::msgcat::mcset ru "Close" "Закрыть" ::msgcat::mcset ru "Close" "Закрыть"
::msgcat::mcset ru "Close all" "Закрыть все" ::msgcat::mcset ru "Close all" "Закрыть все"
::msgcat::mcset ru "Close file" "Закрыть файл" ::msgcat::mcset ru "Close file" "Закрыть файл"
@@ -111,6 +112,7 @@
::msgcat::mcset ru "Init repository" "Создать репозиторий" ::msgcat::mcset ru "Init repository" "Создать репозиторий"
::msgcat::mcset ru "Insert" "Вставка" ::msgcat::mcset ru "Insert" "Вставка"
::msgcat::mcset ru "In" "В" ::msgcat::mcset ru "In" "В"
::msgcat::mcset ru "Insert color code" "Вставить код цвета"
::msgcat::mcset ru "Insert image" "Вставить изображение" ::msgcat::mcset ru "Insert image" "Вставить изображение"
::msgcat::mcset ru "Interface language" "Язык интерфейса" ::msgcat::mcset ru "Interface language" "Язык интерфейса"
::msgcat::mcset ru "Interpetator" "Интерпретатор" ::msgcat::mcset ru "Interpetator" "Интерпретатор"

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)"
} }
} }
@@ -1232,4 +1248,45 @@ proc DebugPuts {msg} {
} }
} }
proc ChooseColor {} {
global nbEditor
set txt "[$nbEditor select].frmText.t"
set color [tk_chooseColor -initialcolor white -title [::msgcat::mc "Choose color"] -parent .]
if {$color ne "" && [winfo exists $txt] == 1} {
$txt insert insert "$color"
}
}
proc OpenURL {url} {
global tcl_platform
if {$tcl_platform(platform) == "windows"} {
set cmd "cmd /c start $url"
} elseif {$tcl_platform(platform) == "mac"} {
set cmd "open $url"
} elseif {$tcl_platform(platform) == "unix"} {
set cmd "xdg-open $url"
}
puts $cmd
set pipe [open "|$cmd" "r"]
puts $pipe
fileevent $pipe readable
fconfigure $pipe -buffering none -blocking no
}
proc ShowTooltip {widget showingText} {
if [winfo exists .baloonTip] {destroy .baloonTip}
set tip [toplevel .baloonTip -bg white -bd 1 -relief solid]
wm transient $tip .
wm overrideredirect $tip 1
set x [winfo pointerx $widget]
set y [winfo pointery $widget]
wm geometry $tip +[expr {$x + 10}]+[expr {$y + 10}]
label $tip.l -text $showingText -bg white
pack $tip.l
after 5000 [list destroy $tip]
}

View File

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