Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow clearing of CodeLineEditingController's undo stack #37

@TechnicJelle

Description

@TechnicJelle

Is your feature request related to a problem? Please describe.
I have a code editor that can switch between multiple files.
When that happens, I do this: codeController.text = file.readAsStringSync(); to make the code editor switch to the new file.
However, this still allows the user to undo (Ctrl+Z) to the previous file, which effectively deletes one file, and duplicates another in its place.

Describe the solution you'd like
The solution I would like is being able to clear the history of a CodeLineEditingController.
So I can do something like this:

void readFile(File file) {
  codeLineEditingController.text = file.readAsStringSync();
  codeLineEditingController.clearHistory();
  openFile = file;
}

Describe alternatives you've considered
I could rebuild the entire CodeEditor widget instead of changing the CodeLineEditingController.text, but that makes the code highlighting reset every time, as per #2.

Additional context
I found that this library uses a _CodeLineEditingCache under the hood, to keep track of the history. It has a method void markNewRecord(bool flag), which I think already does exactly what I want.
The only thing necessary would be to open this method up to the end user. (I think)

Thank you for making this library, by the way! It is super amazing! I love it a lot!

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions