Giter VIP home page Giter VIP logo

joule-editor's Introduction

Joule editor

A simple terminal-based text editor written in Janet. Inspired by (but not a full faithful recreation of) this guide by paigeruten.

joule-0 0 4-a-demo

Features

Finished (at least mostly):

  • TUI text editing (file loading, editing, saving)
  • Lightweight executable
  • Mobile-friendly (e.g. in Termux on Android)
  • Syntax highlighting (for supported languages)
  • Mouse support (clicking and scrolling)
  • Basic search

Planned:

  • Unlimited undo/redo history
  • Command palette
  • Persistent configuration (via dotfile)
  • Multiple files open at once
  • Multi-cursor editing
  • RegEx find and find + replace
  • Plugin system

Getting Started

Building from Source

Requires Janet and JPM. Not tested on Windows.

  1. Clone this repo (for e.g., with the GitHub CLI, $ gh repo clone CFiggers/joule-editor.)

  2. Change directories into the cloned repo: $ cd joule-editor

  3. Fetch and install required dependencies: $ jpm deps (on Ubuntu and similar systems, may required elevated permissions, e.g. $ sudo jpm deps)

Now you can either build a native binary executable using $ jpm build or run the Janet source code directly using the janet command and passing in the src/joule.janet source file.

  • To Build a Native Executable:
    • $ jpm build
    • $ ./build/joule
  • Or to Run as a script using Janet:
    • $ janet src/joule.janet

Usage

Joule is not a modal editor, meaning you can immediately start typing to make edits without needing to enter a specific editing mode (like vi and vim).

Keyboard Shortcuts

Binding Action
Ctrl + q Quit
Ctrl + l Load File
Ctrl + s Save
Ctrl + a Save As
Ctrl + f Find
Ctrl + g Go To Line
Ctrl + c Copy (to internal clipboard)
Ctrl + x Cut (to internal clipboard)
Ctrl + p Paste (from internal clipboard)
Ctrl + n Toggle Line Numbers
Ctrl + w Close Current File
Ctrl + d Open Debug REPL
Shift + Del Delete current line

Copyright

Copyright (c) 2022 Caleb Figgers

joule-editor's People

Contributors

cfiggers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

joule-editor's Issues

load can lead to program exiting

Description: Answering "yes" to a prompt that comes up while attempting the load command when one's buffer has been modified can lead to the program exiting.

Expectation: The requested file be loaded and displayed and the editor remain running :)

Steps to reproduce follow.


At shell:

$ cd joule
$ janet src/joule.janet project.janet

In editor:

  • Make some change -- e.g. type space followed by backspace
  • Ctrl-L to load another file
  • Type a path, say, src/joule.janet
  • Answer "yes" to Are you sure? Unsaved changes will be lost. (yes/No/save)

Observe being back at shell prompt, then:

$ echo $?
1

Scroll back up to see:

$ janet src/joule.janet project.janet 
error: could not find method :+ for nil
  in inc [boot.janet] on line 148, column 32
  in update [boot.janet] on line 1520, column 15
  in edup [src/joule.janet] (tailcall) on line 77, column 11
  in editor-scroll [src/joule.janet] on line 202, column 11
  in editor-refresh-screen [src/joule.janet] on line 451, column 34
  in <anonymous> [src/joule.janet] on line 1148, column 17
  in <anonymous> [src/joule.janet] on line 1151, column 16
  in main [src/joule.janet] (tailcall) on line 1145, column 3
  in run-main [boot.janet] on line 3783, column 16
  in cli-main [boot.janet] on line 3928, column 17

The environment here was:

  • Linux box
  • joule-editor 60d258c
  • janet 1.26.0-dev-a8a78d45

Ctrl + C immediately on startup causes crash

Reported in janet-language/community by sogaiu

Error message:

error: bad slot #0, expected string|symbol|keyword|buffer, got nil
  in string/slice [src/core/string.c] on line 173
  in clip-copy-single [src/joule.janet] on line 488, column 14
  in copy-to-clipboard [src/joule.janet] (tailcall) on line 526, column 5
  in <anonymous> [src/joule.janet] on line 1152, column 17
  in <anonymous> [src/joule.janet] on line 1154, column 16
  in main [src/joule.janet] on line 1148, column 3

Freeze when trying to quite

I'm not entirely sure what happened, however, this is what I did:

  1. cloned the repo
  2. built/installed the deps
  3. ran with janet src/jou-tab complete

I then typed (def something). Realizing there wasn't any syntax highlighting like in the demo, I decided to exit out and try with a file name ending in .janet. Except it's kind of frozen. I can't Ctrl+C, Ctrl+D, nor Ctrl+q. I ended up killing all janet. I don't see any log file.

Few terminal rows on startup causes crash

Reported in janet-language/community by sogaiu

Error message:

error: expected integer key in range [0, 2147483646), got -3
  in update [boot.janet] on line 1520, column 3
  in _while [src/joule.janet] on line 356, column 13
  in add-welcome-message [src/joule.janet] on line 355, column 7
  in editor-update-rows [src/joule.janet] on line 446, column 3
  in editor-refresh-screen [src/joule.janet] on line 468, column 28
  in <anonymous> [src/joule.janet] on line 1151, column 17
  in <anonymous> [src/joule.janet] on line 1154, column 16
  in main [src/joule.janet] on line 1148, column 3

Initial diagnosis: when number of terminal rows is less than number of rows in welcome message, add-welcome-message tries to access slots in editor-state->:erows that don't exist

Completing a modal (Ctrl+F or Ctrl+L) while in "Find Next" mode of search causes crash

Error message:

error: could not find method :+ for nil
  in inc [boot.janet] on line 148, column 32
  in update [boot.janet] on line 1520, column 15
  in edup [src/joule.janet] (tailcall) on line 77, column 11
  in editor-scroll [src/joule.janet] on line 202, column 11
  in editor-refresh-screen [src/joule.janet] on line 451, column 34
  in <anonymous> [src/joule.janet] on line 1148, column 17
  in <anonymous> [src/joule.janet] on line 1151, column 16
  in main [src/joule.janet] on line 1145, column 3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.