From a6a220eb5a867a51938a50795ddd1a35183bfae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D0=BB=D0=B8=D0=BD=D0=B8=D0=BD=20=D0=A1=D0=B5?= =?UTF-8?q?=D1=80=D0=B3=D0=B5=D0=B9=20=D0=92=D0=B0=D0=BB=D0=B5=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=D0=B8=D1=87?= Date: Sat, 18 Oct 2025 16:27:36 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D0=B2=D1=81=D1=82=D0=B0=D0=B2=D0=BA=D0=B5?= =?UTF-8?q?=20=D0=BA=D0=B0=D0=B2=D1=8B=D1=87=D0=B5=D0=BA,=20=D0=B0=D0=BF?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=80=D0=BE=D1=84=D0=B0,=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B4=D1=87=D0=B5=D1=80=D0=BA=D0=B8=D0=B2=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=20=D0=B2=D1=8B=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BD=D0=BE=D0=BC=20=D1=82=D0=B5=D0=BA=D1=81?= =?UTF-8?q?=D1=82=D0=B5=20(=D0=BE=D0=B1=D1=80=D0=B0=D0=BC=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=82=D0=B5=D0=BA=D1=81=D1=82=D0=B0)=20?= =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BC=D0=B5=D0=BD=D0=B0=20=D0=B2=D1=8B=D0=B4=D0=B5?= =?UTF-8?q?=D0=BE=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=8F=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=BE=D0=BA?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=81=20=D0=BF=D0=BE=D0=B4=D1=81=D0=BA=D0=B0?= =?UTF-8?q?=D0=B7=D0=BA=D0=B0=D0=BC=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D0=B0?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D0=B2=D0=B2=D0=BE=D0=B4=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/editor.tcl | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/editor.tcl b/lib/editor.tcl index 77e7e59..765b4d4 100644 --- a/lib/editor.tcl +++ b/lib/editor.tcl @@ -459,6 +459,11 @@ namespace eval Editor { # блокировка открытия диалога если запущен другой set txt $w # set win .varhelper + # Проверяем если есть выделение то блокировать появление диалога + if {[$txt tag ranges sel] != ""} { + puts "You have selected text [$txt tag ranges sel]" + return + } puts "$x $y $w $word $wordType" set fileType [dict get $editors $txt fileType] @@ -883,20 +888,31 @@ namespace eval Editor { set lineNum [lindex [split $pos "."] 0] set posNum [lindex [split $pos "."] 1] set symbol [string trim [string trimleft $symbol "\\"]] - # puts "Selindex : $selIndex, cursor position: $pos" + puts "Selindex : $selIndex, cursor position: $pos, Symbol: $symbol" if {$selIndex != ""} { set lineBegin [lindex [split [lindex $selIndex 0] "."] 0] set posBegin [lindex [split [lindex $selIndex 0] "."] 1] set lineEnd [lindex [split [lindex $selIndex 1] "."] 0] set posEnd [lindex [split [lindex $selIndex 1] "."] 1] - # set selText [$txt get $lineBegin.$posBegin $lineEnd.$posEnd] - set selText $selectionText - # puts "Selected text: $selText, pos: $pos, lineBegin: $lineBegin, posBegin: $posBegin, pos end: $posEnd" + set selText [$txt get $lineBegin.$posBegin $lineEnd.$posEnd] + # set selText $selectionText + puts "Selected text: $selText, pos: $pos, lineBegin: $lineBegin, posBegin: $posBegin, pos end: $posEnd" if {$posNum == $posEnd} { $txt insert $lineBegin.$posBegin "$symbol" } if {$posNum == $posBegin} { - $txt insert $lineBegin.$posEnd "$symbol" + if {$symbol == {"} || $symbol == {_}} { + $txt insert $lineEnd.$posEnd "$selText$symbol" + } else { + $txt insert $lineEnd.$posEnd "$symbol" + } + } + if {$symbol == "'"} { + if {$posBegin == 0} { + $txt insert $pos "$symbol" + } else { + $txt insert "$pos + 1 chars" "$symbol" + } } $txt highlight $lineBegin.$posBegin $lineEnd.end # $txt insert $lineBegin.[expr $posBegin + 1] "$symbol"