@@ -67,18 +67,26 @@ export const webviewMessageHandler = async (
6767 operation : "delete" | "edit" ,
6868 editedContent ?: string ,
6969 ) : Promise < void > => {
70+ // Different visual order of options based on operation type
71+ const options =
72+ operation === "edit"
73+ ? [
74+ t ( "common:confirmation.edit_this_and_delete_subsequent" ) ,
75+ t ( "common:confirmation.edit_just_this_message" ) ,
76+ ]
77+ : [
78+ t ( "common:confirmation.delete_just_this_message" ) ,
79+ t ( "common:confirmation.delete_this_and_subsequent" ) ,
80+ ]
81+
7082 const answer = await vscode . window . showInformationMessage (
71- t ( "common:confirmation.delete_message" ) ,
83+ operation === "edit" ? t ( "common:confirmation.edit_message" ) : t ( "common:confirmation.delete_message" ) ,
7284 { modal : true } ,
73- t ( "common:confirmation.just_this_message" ) ,
74- t ( "common:confirmation.this_and_subsequent" ) ,
85+ ...options ,
7586 )
7687
77- if (
78- ( answer === t ( "common:confirmation.just_this_message" ) ||
79- answer === t ( "common:confirmation.this_and_subsequent" ) ) &&
80- provider . getCurrentCline ( )
81- ) {
88+ // Only proceed if user selected one of the options and we have a current cline
89+ if ( answer && options . includes ( answer ) && provider . getCurrentCline ( ) ) {
8290 const timeCutoff = messageTs - 1000 // 1 second buffer before the message
8391 const currentCline = provider . getCurrentCline ( ) !
8492
@@ -92,7 +100,12 @@ export const webviewMessageHandler = async (
92100 try {
93101 const { historyItem } = await provider . getTaskWithId ( currentCline . taskId )
94102
95- if ( answer === t ( "common:confirmation.just_this_message" ) ) {
103+ // Check if user selected the "just this message" option
104+ // For delete: options[0], for edit: options[1]
105+ if (
106+ ( operation === "delete" && answer === options [ 0 ] ) ||
107+ ( operation === "edit" && answer === options [ 1 ] )
108+ ) {
96109 // Find the next user message first
97110 const nextUserMessage = currentCline . clineMessages
98111 . slice ( messageIndex + 1 )
@@ -132,7 +145,12 @@ export const webviewMessageHandler = async (
132145 )
133146 }
134147 }
135- } else if ( answer === t ( "common:confirmation.this_and_subsequent" ) ) {
148+ } else if (
149+ // Check if user selected the "this and subsequent" option
150+ // For delete: options[1], for edit: options[0]
151+ ( operation === "delete" && answer === options [ 1 ] ) ||
152+ ( operation === "edit" && answer === options [ 0 ] )
153+ ) {
136154 // Delete this message and all that follow
137155 await currentCline . overwriteClineMessages ( currentCline . clineMessages . slice ( 0 , messageIndex ) )
138156
0 commit comments