Please sign in to access this page
Originally a remake of my Win-forms Sticky Notes app, but for the terminal... which evolved into some sort of odd text editor..
---
tangentröra
text editor made in c#
runs in the cli
accepts file paths as cli arguments
- - -
github copilot is installed in my editor mostly for auto-completions
b068931
Check their projects out: BMP Reader, Typename Array, From Scratch Interpreter (FSI)
Hannes Leonhartsberger
Check their projects out: Vexillum, Google Ai Eradicator, Psychisches Kriegsgerät, Photoshop Wakatime Plugin
Once you ship this you can't edit the description of the project, but you'll be able to add more devlogs and re-ship it as you add new features!
ive been testing the program on a few different terminals and cleaning up some code, things seem to be working pretty well but i am planning mess a bit with window-resize detection, as its a bit messy right now.
image attached is running via st
I've been working on the filetype-detetection stuff and the configuration file. If nerd fonts are enabled in the config, alot of supported filetypes will have its own icon, it is also very confurable, anyone can add / modify filetype names and icon relations as it is all stored in /resources/filetypeicons.json following a simple format:
{
.cs: {
name: C#,
icon: \ue7b2
},
(icons are utf-8 encoded nerd font icons in the filetypeicons.json)
you can also now edit the config file directly from the program (C in the start menu)
help.md & redme.md are both included in the published builds now too, & i have written a short powershell script to easily build the binaries for multiple platforms + a bash wrapper for my powershell script
been working on detecting filetype and showing the proper icon for it in the status bar now via nerd fonts, its a bit janky but it does work i just need to clean it up a bit
fixed where the recorder didnt show last input while in visual mode, as i forgot to include visual mode inputs for it...
(the thing with the red emoji that shows last key pressed)
I have been working on a Visual / select mode + changing some of the help text in the status bar to be a bit shorter
I have implemented that you can now quicksave with CTRL+S (a bit late i know...)
Some rendering has also been optimized, and I've also made it so the cursor is hidden more often while rendering to avoid looking choppy and weird.
Lines are also a bit more obvious now as they have a darker background (this may not be visible depending on your terminal theme though) and a few other fixes ive already forgotten
I created a wrapper class for System.Console which implements ansi escape code for easy cross platform formatting coloring etc, I have replaced most of these Console calls with my custom AnsiConsole class and its methods instead, (System.Console still gets called, but these methods will insert ansi codes via a simple format and a few other functions),
an example would be;
AnsiConsole.WriteLine({BOLD}This text is bold{RESET});
rather than writing;
Console.WriteLine(\x1b[1mThis text is bold\x1b[0m);
And i have methods for switching colors etc, to replace the built in ConsoleColor stuff, as that was what i originally wanted to achieve with this.
Another example;
AnsiConsole.WriteLine({GREEN} [N] {WHITE}Create a new file);
AnsiConsole.WriteLine({BLUE} [O] {WHITE}Open an existing file);
AnsiConsole.WriteLine({RED} [Q] {WHITE}Quit);
rather than;
Console.WriteLine(\x1b[92m [N] \x1b[97mCreate a new file);
Console.WriteLine(\x1b[94m [O] \x1b[97mOpen an existing file);
Console.WriteLine(\x1b[91m [Q] \x1b[97mQuit);
This class also includes functionallity for setting the cursor and colors in general i.e
AnsiConsole.SetForegroundColor(AnsiColor.White);
AnsiConsole.SetBackgroundColor(AnsiColor.Black);
AnsiConsole.SetCursorShape(AnsiConsole.CursorShape.SteadyBlock);
This makes it easy for me to expand upon the UI (specifically formatting and colors), which i have already experimented a bit with.
ive been fixing some console-rendering bugs, especially some windows specific ones, done some testing, and changed some of the line deletion logic, mostly small tweaks.
i have been working on improving the experience on windows, everything seems to be working as it should now
Been focusing a bit on improving Windows compatibility, I've been seeing some rendering issues appearing differently mostly depending on the build method, very strange but i have fixed some scaling bugs on windows somewhat
the most important functionallity is now implemented, i am now considering looking into paging options again etc,
a cross-platform binary is published on gh,
i have tested it in a new windows VM and it seems to work on windows
working on copy/paste functionallity
Currently you can copy a line and paste it (with undo support as it uses the same method as inserting with undo support)
ive been optimizing the undo/redo functions, mostly with the way it stored and buffered actions. I converted alot of the undo-redo stack into stringbuilders before they get stored instead of using multiple strings, and a few other small fixes and optimizations, undo/redo is now slightly more efficent aswell for the delete method. ive also still been cleaning up some old unused code that i had added for testing before
I fixed a bug where i forgot to change buffer position after some insert operations
also changed the ui a bit and reimplemented the way CLI args work mostly to avoid some problems with debug mode and an issue with the ui recorder (the little thing that shows what key you pressed last in NORMAL mode) freezing the application due to a parsing issue
implemented undo / redo via the U and D keys
the changes are stored in seperate undo & redo stacks that store the individual actions, i changed my insert / delete logic to implement this hehe
also cleaned up some more code and fixed a few small bugs regarding inserting at a new line
spent alot of time optimizing & polishing both the buffering, and rendering
i also experimented alot with diffrent ways to buffer the lines but the original implementation i had was best so ive been working on improving it
also made it prettier with fancy colors and all that... i am thinking about changing the name though
+ tons of code formatting and refactoring some things (alot of the code was copied from the prototype version so i reworked it)
Things are coming together well, and it even works on large files.. albeit a bit slow
I was trying to optimize my swapping page buffering class and its functions to be used with large files, and quickly. but it kinda sucked, and kept on breaking.. (i even managed to accidentally create 40k rather large temp files lol) so i gave up on it and decided to just use the default GapBuffer i implemented, as it is plenty fast and still pretty memory efficient, while it does use more memory than a swapping buffer i see it as a worth-while tradeoff, Ive spent time optimizing both the GapBuffer and the rendering (using a bunch of line caching rendering stuff), so even if we do open a rather large file it doesn't implode... still wouldn't recommend.. but its possible. There are a few bugs to iron out, but its perfectly usable, I may try to re-implement some sort of disk caching again in the future, but i'd like to fix this up more first.
I refactored a bunch of the code from the original prototype, and made some small changes to it, split it up to more modular classes etc and now have this...
Behind the scenes i set up some crude page-file caching type thing, with advice from a family member. (this was the most painful part of getting to this point, but it was easier than i though.. C# is great for this kind of stuff)
Because I had already written a bunch of UI & Input code for the prototype version, it was pretty easy splitting it up into more modular classes and implementing it into what i already have here.
It can also open files from console arguments as before and that stuff, I just need to work more on some of the main menu & save dialog stuff, and maybe polish the UI.
But because I had alot of the old code sitting around in another git branch, it went really quickly to just yank it and improve it for this version of the editor. so this went alot faster than i expected. I think i shall work on refining some of the Inputs, and paging.. and alot of testing to make sure it all works..
I've worked a bit with the memory profiler, but i must do some more in-depth testing, but from what I have gathered from the little testing i have done, it is working as intended with file paging etc, and not causing a memory leak everytime you press a key lul :D
I have been working on a Document class, it is mostly a wrapper for my GapBuffer class.
This is also a core part of what will become the rewrite of my trashy prototype text editor.
This includes the basic operations that a text editor needs.
My plan now is to implement some sort of caching, i am considering a page based buffer approach maybe even with LRU Caching (Least Recently Used),
(i will update the basic functionality i already have to support this obviously)
... this is something rather new to me still, as i haven't worked with such things much.. but a challenge is always fun, and it is a core part of an actually functional, somewhat memory efficient text editor...
then a lot of testing will ensue...
I spent around 2 days working on a basic prototype, proof of concept type thing..
It is a very crude text editor, which currently stores file contents fully in memory without any proper buffering etc, also I opted to store most of the data as strings, but as strings are immutable, any change to the text will only take up more memory, as a new string has to be created.
The way it currently works is as it has only a few classes in one file.
So it's pretty terrible right now. As i kind of went way out of scope for the original idea of a note-taking app. But it somewhat works.
Now that i have a basic concept, i am going to completely rewrite it, but properly.... with fancy data structures yadayada... good for memory... and not jank in one single file....