Исправлено поведение при сочетании клавиш Control-y (повторение последнего действия)

This commit is contained in:
svk
2026-01-21 13:00:38 +03:00
parent 478a583c3a
commit 781352b249
5 changed files with 49 additions and 5 deletions

View File

@@ -796,7 +796,7 @@ namespace eval Editor {
bind $txt <Control-comma> "Editor::Comment $txt $fileType"
bind $txt <Control-period> "Editor::Uncomment $txt $fileType"
bind $txt <Control-eacute> Find
bind $txt <Insert> {OverWrite}
# bind $txt <Insert> {OverWrite}
bind $txt <ButtonRelease-1> "Editor::SearchBrackets $txt"
bind $txt <Button-1><ButtonRelease-1> "Editor::SelectionHighlight $txt"
bind $txt <<Modified>> "SetModifiedFlag $w $nb auto"
@@ -804,6 +804,7 @@ namespace eval Editor {
bind $txt <Control-Cyrillic_ghe> "Editor::SearchBrackets %W"
bind $txt <Control-J> "catch {Editor::GoToFunction $txt}"
bind $txt <Control-j> "catch {Editor::GoToFunction $txt}; break"
bind $txt <Control-y> {Redo; break}
bind $txt <Control-Cyrillic_o> "catch {Editor::GoToFunction $txt}; break"
bind $txt <Alt-w> "$txt delete {insert wordstart} {insert wordend}"
bind $txt <Alt-odiaeresis> "$txt delete {insert wordstart} {insert wordend}"

View File

@@ -25,8 +25,8 @@ bind . <Control-q> Quit
bind . <Control-Q> Quit
bind . <Control-Cyrillic_shorti> Quit
bind . <Control-eacute> Quit
bind . <Insert> Add
bind . <Delete> Del
# bind . <Insert> Add
# bind . <Delete> Del
bind . <F1> ShowHelpDialog
bind . <Control-n> Editor::New
bind . <Control-N> Editor::New
@@ -62,6 +62,21 @@ bind . <Alt-Cyrillic_el> {
}
}
# -------------
# Thanks https://github.com/wandrien/
# https://github.com/wandrien/projman/commit/22f6e235c3532c20573d44ee7eaaaa1fb56ad544
event add <<Copy>> <Control-Insert>
event add <<Paste>> <Shift-Insert>
event add <<Cut>> <Shift-Delete>
set latestTxtWidget {}
bind all <FocusIn> {
if {[winfo class %W] eq "Ctext"} {
global latestTxtWidget
set latestTxtWidget %W
}
}
# ---------
bind . <Control-s> {FileOper::Save}
bind . <Control-S> {FileOper::Save}
bind . <Control-Cyrillic_hardsign> {FileOper::Save}

View File

@@ -1134,3 +1134,24 @@ proc ExecutorCommandPathSetting {fileType} {
puts $cfgVariables($fileType)
}
}
# -----------
# Thanks https://github.com/wandrien/
# https://github.com/wandrien/projman/commit/22f6e235c3532c20573d44ee7eaaaa1fb56ad544
proc SendEventToLatestTxtWidget {ev} {
global latestTxtWidget
if {$latestTxtWidget eq ""} {
return
} elseif {[winfo exists $latestTxtWidget] && [winfo class $latestTxtWidget] eq "Ctext"} {
event generate ${latestTxtWidget}.t $ev
} else {
set latestTxtWidget ""
}
}
proc Cut {} { SendEventToLatestTxtWidget <<Cut>> }
proc Copy {} { SendEventToLatestTxtWidget <<Copy>> }
proc Paste {} { SendEventToLatestTxtWidget <<Paste>> }
proc Undo {} { SendEventToLatestTxtWidget <<Undo>> }
proc Redo {} { SendEventToLatestTxtWidget <<Redo>> }
# ------------