Author Topic: Bug Report: Undo performs several changes at once  (Read 5066 times)

Offline damian_reloaded

  • Single posting newcomer
  • *
  • Posts: 9
Bug Report: Undo performs several changes at once
« on: May 10, 2020, 06:59:33 pm »
I'm experiencing this bugs since a few nightly builds ago. I searched the forums to see if it had been reported but couldn't find anything related.

Steps to reproduce the bug:
Inside the editor.
0. [starting state]
1. Type a character
2. Press enter.
3. Type another character
4. Press enter.
5. Type another character
6. Press backspace
7. Type another character.
8. Press Ctrl-Z
Result: After pressing Ctrl-Z the editor gets reverted to 0.[starting state] instead of [6.Press backspace]

OS: Windows 10
Name             : Code::Blocks
Version          : svn-r12072
SDK Version      : 2.2.0
Scintilla Version: 3.7.5
Author           : The Code::Blocks Team
E-mail           : info@codeblocks.org
Website          : http://www.codeblocks.org

wxWidgets Library (wxMSW port)
Version 3.1.3 (Unicode: wchar_t, debug level: 1),
compiled at Nov  1 2019 18:53:26

Runtime version of toolkit used is 10.0.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Bug Report: Undo performs several changes at once
« Reply #1 on: May 10, 2020, 08:20:06 pm »
Which is the last night build which works correctly?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline damian_reloaded

  • Single posting newcomer
  • *
  • Posts: 9
Re: Bug Report: Undo performs several changes at once
« Reply #2 on: May 11, 2020, 03:42:21 am »
I downloaded 10016 and I'm experiencing the same behavior.

I'm beginning to think I started noticing this bug after I upgraded my box to Windows 10. I don't have any computer with windows 7 or 8. I had a virtual machine with windows xp but couldn't get code blocks to work on it.

I can confirm the bug also happens in another computer with Windows 10 freshly installed.

It seems to behave differently depending on the type of source file opened.

In a new "Empty File" type
1 [enter]
2 [enter]
3 [enter]
pressing Ctrl-Z once erases the 3 lines

in a cpp file:
1 [enter]
2 [enter]
3 [enter]
pressing Ctrl-Z correctly only erases one number every time it's pressed, but at some point, after typing something else it breaks and behaves like the example above, erasing everything at once.

my2c








Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Bug Report: Undo performs several changes at once
« Reply #3 on: May 11, 2020, 10:34:13 am »
Hm, I can reproduce this... It is not OS dependant.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline damian_reloaded

  • Single posting newcomer
  • *
  • Posts: 9
Re: Bug Report: Undo performs several changes at once
« Reply #4 on: May 11, 2020, 06:57:44 pm »
I just tested 16.01 on Debian and the bug is there too... what's going on?
I've been using Code::blocks for most of the last decade and I've never noted this before... and I would have noted it because is pretty annoying.
Some basic dependency common to all versions that got bugged? Or some surreptitious firmware update?
Maybe someone traveled to the past and stepped on a butterfly. I'm scared. :/
« Last Edit: May 11, 2020, 07:00:36 pm by damian_reloaded »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Bug Report: Undo performs several changes at once
« Reply #5 on: May 11, 2020, 08:09:25 pm »
My guess is that you've never noticed it for plain text files :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline damian_reloaded

  • Single posting newcomer
  • *
  • Posts: 9
Re: Bug Report: Undo performs several changes at once
« Reply #6 on: May 11, 2020, 10:54:40 pm »
There must be something else going on besides that example because I'm currently coding and sometimes the Undo will erase entire blocks of typed code. This I can bet my life wasn't happening a few months ago...

Do you know from the top of your head if any plugin taps with the Undo feature?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Bug Report: Undo performs several changes at once
« Reply #7 on: May 11, 2020, 10:57:59 pm »
I don't think so. The scintilla component hasn't been updated recently, either.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Bug Report: Undo performs several changes at once
« Reply #8 on: May 11, 2020, 11:44:34 pm »
You'll have to do a bisect on the night builds to find out where this behaviour started.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline damian_reloaded

  • Single posting newcomer
  • *
  • Posts: 9
Re: Bug Report: Undo performs several changes at once
« Reply #9 on: May 12, 2020, 12:02:03 am »
I think I'm going crazy.

I just opened notepad++ and it behaves the same way, example:

hello world [enter]
[enter]
testing bug [enter]
[enter]
asdf [backspace] [backspace] [backspace] [backspace]
hello
[ctrl-z] (erases the word "hello")
[ctrl-z] (restores the word "asdf")
[ctrl-z] (clears the entire editor to blank)

At this point I'm freaking out, so I open a virtual machine with Windows XP and run Wordpad:
hello world [enter]
[enter]
testing bug [enter]
[enter]
asdf [backspace] [backspace] [backspace] [backspace]
hello
[ctrl-z] (erases EVERYTHING)

Then Visual Studio behaves as I remember undo used to work (last year I've been working with visual studio mostly which might be the cause of my confusion?)

hello world [enter]
[enter]
testing bug [enter]
[enter]
asdf [backspace] [backspace] [backspace] [backspace]
hello
[ctrl-z] (erases the word "hello")
[ctrl-z] (restores character "a")
[ctrl-z] (restores character "s")
[ctrl-z] (restores character "d")
[ctrl-z] (restores character "f")
[ctrl-z] (erases word "asdf")
[ctrl-z] (erases new line)
[ctrl-z] (erases new line)
[ctrl-z] (erases phrase "testing bug")
[ctrl-z] (erases new line)
[ctrl-z] (erases new line)
[ctrl-z] (erases phrase "hello world")

Open Office Writer undo function seems to work on a character basis so ctrl-z will erase the last character

Apparently it's not an issue with Code::Blocks. Is this how Code::Blocks works for you? Maybe it's a locale or a keyboard issue? I'm bafled. :/

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Bug Report: Undo performs several changes at once
« Reply #10 on: May 12, 2020, 12:11:19 am »
https://www.scintilla.org/ScintillaDoc.html#UndoAndRedo

Both notepad++ and Code::Blocks use the same component.

BTW: Your example behaves differently when using different highlight modes. For C++ it seems to work fine, for plain text it is broken as you describe.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]