Sublime Forum

Disable destructive operations?

#1

I sometimes click on “Discard Hunk” or “Discard” on another file when I mean to discard the selected lines on the file below it. Normally I only ever discard selected lines because I too often made mistakes when using these other Discard buttons (I hate that they are fixed so their target file changes as you scroll even though they don’t move). Worst of all, these destructive actions can’t be undone.

So my question is, is there any way to disable or hide these buttons? Maybe some config hack that I can use for this?

0 Likes

#2

In Merge’s defence, they make you click that button twice before it takes affect. You should really double check what you are doing is what you actually want to do instead of just clicking the button twice.

0 Likes

#3

Yes but you need to click the “Discard lines” button twice too so in any case you intent to click whatever button you’re going to click twice.

I rarely make a mistake but it can happen and as often with software development, you can blame the user or you can try to improve the software.

0 Likes

#4

I’m not sure how it could be improved more. I would be surprised to see a feature that disables integral features such as discarding hunks and such.

Maybe there is a hack you can do, but I’m not aware of one :man_shrugging:.

0 Likes

#5

It might be possible to modify the theme to hide the button, but I’m not sure if it’s granular enough to just hide only the discard button.

If anything, maybe adding extra spacing between the two rows of buttons could help you.

0 Likes

#6

Yeah, I thought about this, but I don’t know that you have control over each button, I think it is more styling of buttons in general :man_shrugging:.

0 Likes

#7

Hmm, thanks for the info, although it looks like there’s no easy solution. I might look at theme customisation just in case, but of course a built-in solution would be even better.

0 Likes

#8

You are totally right here. I’ve discarded changes in a whole file (ugh) when I was meaning to discard a single hunk instead. The UI is definitely designed poorly in this regard.

It’s happened to me multiple times.

Thankfully, when I did that, the file was still open in Sublime Text, and I was able to go to the file and “undo” the change.

I wonder what the best way to alert the Sublime Merge author of this is?

0 Likes