edit

edit

10 devlogs
26h 32m
Created by Pedro B.

A simple file editor in C with ncurses

Timeline

Ship 1

0 payouts of shell 0 shells

Pedro B.

7 days ago

Pedro B. Covers 10 devlogs and 26h 32m

Don't wanna lose my hours, but also not really anything to show in a video (just plumbing for syntax highlighting currently...)

Here's some of it, I guess.

Update attachment

configuration options for the terminal text editor!
they don't do anything but, like, a hash-map? in C? From scratch?! Woah!

In this (admittedly half-hearted) devlog: More prompts and more commands
Had to cram for a Calculus exam (it sucked!) so I couldn't really work on the project these past few days, but thankfully I'll have the weekend to give it some love.

Next on the task list are:
- Laying the groundwork for configuration options (a hash-map implementation!)
- Getting mouse input working
- Syntax highlighting...? (probably not)

A short one this time: confirmation prompts for the editor! Fairly easy to implement using ncurses windows.
Also, UNDO/REDO can now handle newlines, including those in the middle of lines, and backspaces at the start of a line.

Pedro B. Pedro B. about 2 months ago
@jackson nope!good old zsh and, uh, whatever the Kubuntu default terminal is called…(it’s called Konsole????)
jackson jackson about 2 months ago
is this fish shell :p

In this devlog: UNDO/REDO in my terminal text editor!
Super neat learning how other editors handle this sort of stuff. I referenced the nano implementation, but at its core it's just a basic Command Pattern (see the gang of four's Design Patterns book)

More progress! But there's a bug in the video lol
Not shown in the video but saving an opened file works too

Still working out how to handle resizing btw. The SIGWINCH signal (well, signals in general) aren't really a thing in Windows, so I'll have to do some weird platform-dependent code to make it work. Ideas on how to handle it are welcome, but really, I know the solution--it's just bad and boring and I can't test it on my Linux machine :-P

My text editor can save files now!
Also, semi-featured in the video: normal mode commands like $, , G, etc...

It's basically fully featured!
...just don't try to open files you need to scroll through
...or resize the window (still exploring how to handle that portably)
...or type/read files with/even think about tabs
...
...maybe it's not actually fully featured

The editor's getting somewhere now...!

Featuring:
- Basic editing;
- File loading (but no saving yet;)
- Line numbers;
- Status line;
- Command modes

Pedro B. Pedro B. about 2 months ago
thanks to you both!Regarding the cursor: yes, by default the ncurses cursor is a “block” type cursor. ncurses doesn’t provide any functions to change the type, but, as you said, I can use ANSI codes to change it—was just putting it off lol. I’ll make it so normal mode has a block cursor and insert mode the usual “line” cursor. Maybe I’ll add the dreaded replace mode too, with the little slab cursor (it just overwrites characters rather than “smartly” insert them)About the command mode: this is perhaps a bit weird if you don’t use vim… command mode lets you type commands like “q” (to quit the editor,) “w” (to write/save the file,) “e [filename]” (to open text files,) etc. That’s what I’m implementing here. However, if you type “:!“ in Vim, you can run terminal commands like you suggested! I’ll try to implement those too…And yeah. This is kind of sick—as in, all of the finicky string manipulation makes me dizzy.hope you two the best!
Eliza Eliza about 2 months ago
Really cool!Is it intentional that the cursor is just setting the background color of the character after it or is that a side effect of using ncurses?I know ANSI has cursor manipulation (that’s what i use for my terminal ide), but I wasn’t sure if you could use it via ncursesCan the command mode actually run all the commands you could in a normal terminal, or do you have custom commands that the user can run that only effect the editor?P.S. i see we used the same method for handling multi-digit line numbers hehe .w.
Modmaker101 Modmaker101 about 2 months ago
Sickkkkkkkkkkkk

Basic editing has been implemented!!!
this might actually ship guys

The beginnings of a text editor...!
Not pictured: absolutely craps its pants on backspaces, newlines and gusts of wind

Update attachment