xcode editor deletes characters on delete press but does not hide the deleted characters in the editor

Hello there. Hope you are doing good 🙂


I am on macOS Catalina 10.15.2 (19C57)


I have a swift file opened in Xcode 11.3 and inside that file when I try to delete a character by pressing the "Delete" key the code look in the editor does not change:

Lets say I have cursor put at the end of "@implementation AppDelegate" code and when I press "Delete" even a couple of times then it still remains the same "@implementation AppDelegate".

But I did check that file content via git and git does show the file content has changed. So something wrong here.

I checked the same with Xcode 10.1 and the same behavior.



Regards.

Accepted Reply

Have you checked key bindings, to see if some binding catches backspace ?


What happens when you type ctrl-d (should delete forward)

Replies

May be teh file you see is not the one you edit !!!


So, close the file, restart XCode and reopen the file, not from recent files but by selecting in the left pane file browser.


Does it work now ?

Let say via Xcode I have changed the playground(Contents.swift file) code.


When press delete button when on Xcode editor then no visual changes happen in the Xcode editor but when I do `cat Contents.swift` I do see my file changes.




Regards

Are you working in playground ?


Let say via Xcode I have changed the playground(Contents.swift file) code.

Where is this Contents.swift file ?


When press delete button when on Xcode editor

To be sure we speak of the same thing:

- you have opened a playground

- you click somewhere to get the insertion cursor

- you hit backspace key (what you call delete)

-> the character before insertion poiont is not deleted.


Is that correct ?


when I do `cat Contents.swift` I do see my file changes.

What do you mean exactly ?

Where do you type this `cat Contents.swift`?

Yes, I am working in the playground.


Let's say I have created a playground called "My-playground" and have opened it using Xcode.


Yes by 'Delete' I meant 'Backspace' key.


So I am talking about `cat My-playground.playground/Contents.swift` command and I am typing it in the terminal so I get proof that the edit was actually done or not.

I don't understand.


You said in first post:

Lets say I have cursor put at the end of "@implementation AppDelegate"


Now you say you created a playground


Please clarify what is your code environment.

That was another example where it did not work either.


The playground thing was completely a separate example. And that issue also happened with playground example. It did not work.

I would try to reinstall XCode and then reboot the Mac.

That did not help

Have you checked key bindings, to see if some binding catches backspace ?


What happens when you type ctrl-d (should delete forward)

My question is why if I press `Backspace` Xcode shows no changes in the editor but the swift file content does change?

Hence I don't understand what key binding issues have to do with this.

I would need to sit at your computer to understand.


Hence I don't understand what key binding issues have to do with this

I'm just trying trying to guess what could happen. But if you don't want to check, please don't do it.


Have you tested :

What happens when you type ctrl-d (should delete forward)

Here again, to try to isolate the issue.

Thank you very much all this long trying to help me. I am really grateful.


Here is what happens when I press Ctrl+d 10 times. It deletes 4 char then does nothing for the 6 next presses.

And if you type command-backspace, do you delete the whole line ?


So, you did reinstall XCode and then reboot the Mac. Correct ?


If so, I would contact developer support.

I figured this out and you have already told me the solution in our dialog here. It was an incorrect key binding.

For some reason with a fresh 11.3 Xcode, the 'Backspace' key was bound to the 'Duplicate' action and hence I removed it from Duplicate action and bound it to the "Delete backward' action.


But the thing that tripped me up all the time before doing the above-mentioned stuff is that 'Backspace' sometimes was removing things but most of the time it was not doing anything.



Thank you very much for your awesome support. Have a good day.

Thanks for feedback.


When investigating a problem, you should never ignore tests to be made :

Hence I don't understand what key binding issues have to do with this.

In fact, that was the cause 😉


Don't forget to close the thread on correct answer of Dec 15, 2019 1:12 PM