id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	branch_state	votes
4540	Macro in mcedit deletes text because return value of edit_block_delete_cmd is misinterpreted	Sprite_tm	andrew_b	"This issue is in 4.8.31 as well as Git master. I'm having issues that macros defined in .local/share/mc/mcedit/macros.d and used as text editing macros using ExecuteScript in the editor section of mc.macros simply delete any text selected rather than replace the selected text with the output of the macro script.

Seems like commit f29c5a35f7938ab1e7e83a9c9faadc5129e6bb08 reworked the return value of edit_block_delete_cmd from an int with 1 if cancelled by user and 0 otherwise, to a gboolean which is false when cancelled by user and true otherwise. (Note the inverting of logic values in this change.)

Unfortunaty, something in that commit went wrong on https://github.com/MidnightCommander/mc/blob/master/src/editor/edit.c#L1824-L1832 : it looks like this code assumes old 1 is new true and vice versa; this breaks things.


Changing it to 'gboolean rc = TRUE;' and 'if (rc)' fixed this issue for me.


"	defect	closed	major	4.8.32	mcedit	master	fixed					merged	committed-master
