Repository: ManimCommunity/manim

Issue:
Integer MObject fails to display when changing value to less figures
## Description of bug / unexpected behavior
Updating Integer object with value sometimes fails to display correctly, in particular in countdown case when new value has less figures than old.

## Expected behavior
Integer mobject should display number with all figures.

## How to reproduce the issue
See code
<details><summary>Code for reproducing the problem</summary>

```py
class IntegerChange(VGroup):
    def __init__(self, value):
        super().__init__()
        self.content = Integer(value)
        self.add(self.content)
        
    def set_value(self, value):
        old = self.content
        self.remove(self.content)
        self.content = Integer(value).scale(2).move_to(old.get_center())
        self.add(self.content)
        return self
    
    
class IntegerBug(Scene):
    def construct(self):
        self.start_value = 102

        # Integer, changing value with set_value()
        posInteger, posIntegerLabel = 4*LEFT, 4*LEFT+2*UP
        nInt = Integer(self.start_value).scale(2).move_to(posInteger)
        labelInt=Text("Integer.set_value()").scale(0.7).move_to(posIntegerLabel)
        self.add(nInt, labelInt)

        # Integer, changin value replacing Integer MObject
        posIC, posICLabel = 4*RIGHT, 4*RIGHT+2*UP 
        nIC = IntegerChange(self.start_value).scale(2).move_to(posIC)
        labelIC=Text("MObject change").scale(0.7).move_to(posICLabel)
        self.add(labelIC, nIC)
        
        self.wait()

        for k in range(1, 6):
            nInt.set_value(self.start_value - k)
            nIC.set_value(self.start_value - k)
            self.wait()
            
        for k in range(91, 100):
            nInt.set_value(self.start_value - k)
            nIC.set_value(self.start_value - k)
            self.wait()
```

</details>


## Additional media files
<!-- Paste in the files manim produced on rendering the code above. -->

https://user-images.githubusercontent.com/66796028/124482879-07cd3580-ddaa-11eb-9a05-525ddc2fb98f.mp4


<details><summary>Images/GIFs</summary>

<!-- PASTE MEDIA HERE -->

</details>


## Logs
<details><summary>Terminal output</summary>
<!-- Add "-v DEBUG" when calling manim to generate more detailed logs -->

```
PASTE HERE OR PROVIDE LINK TO https://pastebin.com/ OR SIMILAR
```

<!-- Insert screenshots here (only when absolutely necessary, we prefer copy/pasted output!) -->

</details>


## System specifications

<details><summary>System Details</summary>

- OS (with version, e.g Windows 10 v2004 or macOS 10.15 (Catalina)):
- RAM:
- Python version (`python/py/python3 --version`):
- Installed modules (provide output from `pip list`):
```
PASTE HERE
```
</details>

<details><summary>LaTeX details</summary>

+ LaTeX distribution (e.g. TeX Live 2020):
+ Installed LaTeX packages:
<!-- output of `tlmgr list --only-installed` for TeX Live or a screenshot of the Packages page for MikTeX -->
</details>

<details><summary>FFMPEG</summary>

Output of `ffmpeg -version`:

```
PASTE HERE
```
</details>

## Additional comments
<!-- Add further context that you think might be relevant for this issue here. -->



Discussion:
This issue affects the Variable mobject too, when type_var = Integer.



Resolving patch:
diff --git a/manim/mobject/numbers.py b/manim/mobject/numbers.py
--- a/manim/mobject/numbers.py
+++ b/manim/mobject/numbers.py
@@ -190,7 +190,10 @@ def set_value(self, number, **config):
         new_decimal.scale(self[-1].height / new_decimal[-1].height)
         new_decimal.move_to(self, self.edge_to_fix)
         new_decimal.match_style(self)
-        self.become(new_decimal)
+        old_family = self.get_family()
+        self.set_submobjects(new_decimal.submobjects)
+        for mobj in old_family:
+            mobj.clear_points()
 
         self.number = number
         return self


Test patch: