WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: A FLTK editor with syntax highlighting for sh / bash  (Read 3455 times)

Offline polikuo

  • Hero Member
  • *****
  • Posts: 723
A FLTK editor with syntax highlighting for sh / bash
« on: February 22, 2018, 03:28:58 AM »
Hi all  :)

I've been making a FLTK editor with syntax highlighting for both "sh" and "bash".

Please refer to editor4sh.

This editor is written from scratch with fluid and is working in progress.

It's similar to the current editor you find in Xprogs.tcz but more.

You'll see some extra menu items, such as "Shell", "Color", "Auto Indent".

The "Shell" menu let you choose your default shebang.
The default is empty string (-other).
Whenever you open a new empty file, the chosen shebang will be added automatically.
To set your default shebang from command prompt:
Quote
-shell  #!/bin/sh
-bash   #!/usr/bin/env bash
-other  Other unknown shebang

The "Color" menu switch let you turn on/off the syntax highlighting.
The coloring style by default is POSIX sh.
It can be set to bash via the aforementioned "Shell" menu.

The "Auto Indent" menu switch enable/disable the indenting behavior.
When the new input is '\n' (one char only),
the spaces and tabs at the beginning of the line are copied to the next.

I learn C++ learn as a hobby.
I may have done something stupid without knowing it.  :o
Anyway ~~
Feedbacks are welcomed  :D

Offline andyj

  • Hero Member
  • *****
  • Posts: 1036
Re: A FLTK editor with syntax highlighting for sh / bash
« Reply #1 on: February 22, 2018, 11:19:27 AM »
Doesn't Vim already do this? Are the editor commands going to be compatible with vi or something else?

Offline polikuo

  • Hero Member
  • *****
  • Posts: 723
Re: A FLTK editor with syntax highlighting for sh / bash
« Reply #2 on: February 22, 2018, 12:39:36 PM »
Doesn't Vim already do this?
Well yes, vim already do this, and there are tons of similar programs out there that do the same.

The real fun of this project is the understanding of C/C++ and coming up a way to parse the shell syntax.

The thrill of segmentation fault and stackoverflow sure helps a lot in my learning curve.  :P

Besides, the binary size is 32K (on TC64) while vim.tcz is 1.3M

Why would I load a fat extension along with its dependencies when I can use a small one instead ?

Quote
Are the editor commands going to be compatible with vi or something else?
Well, I've never thought about that.

What's in your mind ?

Care to share an example ?