Skip to content

Commit 44d01e9

Browse files
committed
[WARP] Only add comments once to functions
This is a little bit hacky considering you may wish to override the function to another one with different comments, in this case those comments will never appear. This does not really fix the underlying issue, just makes it so that we are not spamming undo actions really.
1 parent 3ad2555 commit 44d01e9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

plugins/warp/src/plugin/workflow.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,12 @@ pub fn insert_workflow() {
191191
}
192192
// TODO: How to clear the comments? They are just persisted.
193193
// TODO: Also they generate an undo action, i hate implicit undo actions so much.
194-
for comment in matched_function.comments {
195-
let bn_comment = comment_to_bn_comment(&function, comment);
196-
function.set_comment_at(bn_comment.addr, &bn_comment.comment);
194+
// TODO: For now we will only apply the comments as a one-shot action, because of the above
195+
if function.comments().is_empty() {
196+
for comment in matched_function.comments {
197+
let bn_comment = comment_to_bn_comment(&function, comment);
198+
function.set_comment_at(bn_comment.addr, &bn_comment.comment);
199+
}
197200
}
198201
if let Some(mlil) = ctx.mlil_function() {
199202
for variable in matched_function.variables {

0 commit comments

Comments
 (0)