From 2eb2cb2e496d393c52846f390b5ce6d7af310c14 Mon Sep 17 00:00:00 2001 From: Willi Ballenthin Date: Wed, 22 Apr 2026 20:17:27 +0300 Subject: [PATCH] fix: rename dragEventEnter to dragEnterEvent in CapaExplorerRulegenEditor Qt dispatches drag-enter events to dragEnterEvent; the misspelled method dragEventEnter was dead code and its super() call would raise AttributeError if ever reached. --- CHANGELOG.md | 3 +-- capa/ida/plugin/view.py | 12 ++---------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a42fb9f9..9b986110 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,8 +48,7 @@ - fix: remove unreachable backports.functools_lru_cache fallback and dead dependency @williballenthin - fix: Scopes.from_dict uses cls instead of self so subclasses return the correct type @williballenthin - fix: correct wrong dict key in VMRay _compute_monitor_threads assertion (used thread_id instead of process_id) @williballenthin -fix: replace assert with isinstance guard in get_callee for invalid MethodSpec tokens @williballenthin -- fix: replace assert with isinstance guard in get_callee for invalid MethodSpec tokens @williballenthin +- fix: rename dragEventEnter to dragEnterEvent so Qt dispatches drag-enter events correctly in CapaExplorerRulegenEditor @williballenthin (SURF-64) - fix: guard against None in lessThan else-branch so sorting columns with empty cells does not raise AttributeError @williballenthin (SURF-63) - fix: add explicit import capa.loader in form.py to avoid fragile transitive import dependency @williballenthin (SURF-62) - fix: initialize f=None before try block in load_capa_function_results to prevent UnboundLocalError in except handler @williballenthin (SURF-61) diff --git a/capa/ida/plugin/view.py b/capa/ida/plugin/view.py index f7608cb0..8dae5127 100644 --- a/capa/ida/plugin/view.py +++ b/capa/ida/plugin/view.py @@ -237,7 +237,7 @@ class CapaExplorerRulegenPreview(QtWidgets.QTextEdit): # determine lineno for first selected line, and column cur.setPosition(select_start_ppos) start_lineno = self.count_previous_lines_from_block(cur.block()) - start_lineco = cur.columnNumber() + start_colno = cur.columnNumber() # determine lineno for last selected line cur.setPosition(select_end_ppos) @@ -282,7 +282,7 @@ class CapaExplorerRulegenPreview(QtWidgets.QTextEdit): select_end_ppos += (lines_modified * len(self.INDENT)) + len(self.INDENT) elif lines_modified: # user SHIFT + Tab, decrease selection positions - if start_lineco not in (0, 1) and first_modified: + if start_colno not in (0, 1) and first_modified: # only decrease start position if not in first column select_start_ppos -= len(self.INDENT) select_end_ppos -= lines_modified * len(self.INDENT) @@ -378,14 +378,6 @@ class CapaExplorerRulegenEditor(QtWidgets.QTreeWidget): """ """ return 2 - def dragMoveEvent(self, e): - """ """ - super().dragMoveEvent(e) - - def dragEventEnter(self, e): - """ """ - super().dragEventEnter(e) - def dropEvent(self, e): """ """ if not self.indexAt(e.pos()).isValid():