Pepper Editor»Blog

Pepper is now open source!

Hello, handmade community!
This is my first blog post here :)

So, as you may know, I've been working on pepper for the last couple of months and it's been coming along very nicely! I've been already using it for some projects and I think I'll be ready to fully switch to it once I finish the LSP integration.

In the mean time, I've decided to make it open source!
While developing pepper, I've learned a lot by browsing the source code of other projects (not limited to other text editors) so I think it makes sense to also let others browse pepper's code.

Also, it's just easier to maintain, distribute and get traction for an open source project.
So, taking inspiration from awesome projects such as Aseprite, I'll go the route of open sourcing the code while offering paid pre-built binaries at itch.io, even though building it is quite easy once you have `cargo` in your system :)


# Some other updates I did in the past weeks:

## Wiki
Pepper now has a wiki: https://github.com/matheuslessarodrigues/pepper/wiki
This is the new home for all of its documentation and I've updated it with lots of new stuff, including examples of how to customize pepper's behavior.

## Better undo/redo edit compression
When a change is made to a buffer, the edit is added to an edit list in a History struct.
However, the common case is having lots of small edits. That is, when you type 'pepper' in inser mode, there would be one edit for each keypress. What we do now is to detect that those edits are right next to each other and 'merge' them into a bigger equivalent edit.

Care must be taken when dealing with multi-cursor edits since, at each key press, those edits will be spread at several buffer locations (and when appended to the edit list, they'd be interleaved). So we let the 'edit merge' code see past the very last edit made and try to find a commited edit that can be merged. If it merges the edits, it must then fix some ranges in the other edits; if not, it simply append the new edit to the edit list.

You can check the code that does the merge here:
https://github.com/matheuslessaro...r/blob/master/src/history.rs#L199

A cool advantage of merging edits is that it's less stuff to send to the language server while implementing LSP's 'textDocument/didChange'!

## Streaming process stdout
This is something I had in the back of my mind for quite some time but never really took the time to implement it out. Pepper has a cool picker ui which lets you fuzzy choose (like fzf and sublime command palette work) items in a list. Before this change, you could spawn a process, wait for it's output and then feed its lines to the picker ui. However it was blocking since you had to wait for the process to finish. So I did a simple 'Task/TaskExecutor' thing that can watch a process stdout and stream it as it becomes available.

Here is its source: https://github.com/matheuslessaro...es/pepper/blob/master/src/task.rs

Now we can add new entries do the picker ui as they become available while always keeping the ui responsive!
It enables lots of cool utilities to be implemented such as:
  • a fuzzy file picker right inside the editor (before we could only call fzf externally and then let it talk back to pepper)
    https://github.com/matheuslessaro...g-recipes#simple-find-file-no-fzf

  • responsive find in workspace (before we had to wait for ripgrep to search everything before we could show something in the ui)
    https://github.com/matheuslessaro...ecipes#simple-ripgrep-integration


  • That's it for now!
    Thanks for check it out :)
    Simon Anciaux,
    Welcome.

    matheus
    Pepper has a cool picker ui which lets you fuzzy choose items in a list.


    What does "fuzzy choose" mean ?

    matheus
    Also, it's just easier to maintain, distribute and get traction for an open source project.


    I don't know about getting traction, but "easier to maintain" and "distribute" seems the opposite of what I would think having more people working on a project would provide. Hope it'll work for you.

    There are a few layout issues in your post (line breaks in the middle of sentences that may not show in the preview for some reason, and (I suppose) invalid markup).
    mrmixer

    Welcome.


    Thank you, Simon!

    mrmixer

    What does "fuzzy choose" mean ?


    Oh, I just meant an ui similar to how fzf and sublime command palette work: by typing some text, entries get filtered through fuzzy matching.

    mrmixer

    I don't know about getting traction, but "easier to maintain" and "distribute" seems the opposite of what I would think having more people working on a project would provide. Hope it'll work for you.


    Totally get what you mean!
    For me, somethings get easier like maintaining crossplatform builds since opensource github projects get unlimited CI minutes that I can use whenever I want.
    Also, should the project get many viewers, I hope that my 'non-goals' list in the readme help people understand the scope of the project.
    But yeah, I'll watch out for that, thanks! :)

    mrmixer

    There are a few layout issues in your post (line breaks in the middle of sentences that may not show in the preview for some reason, and (I suppose) invalid markup).


    I'll get a closer look at those! It's been a long time since I've used a forum ahahha :')

    Anyways, thank you for taking your time to take a look :)