WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Modifications for Xprogs editor  (Read 265 times)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11779
Modifications for Xprogs editor
« on: January 23, 2025, 01:42:13 PM »
I use the FLTK editor that is part of Xprogs.tcz for scripting and editing
various config files (bootlocal.sh, .filetool.lst, .xsession, .profile, etc).
The editor works quite well for these tasks, but there is one thing I don't
like about it. It does syntax highlighting for comments, keywords, data types,
strings, etc. That's fine if you're using it to write C or C++, but not for an
editor that's a part of the base GUI apps.

I decided to try to revert editor to just black text, like it was in TC3.8.4.
So first I copied editor.cxx and Makefile from the Tinycore fltk projects git.
I managed to remove the syntax highlighting code.
I also found a later version of the program that had line number and word wrap
options that could be turned on/off during run time. I added those as well but
I wrapped them in preprocessor directives to make them compile time options.

The Xprogs extension is unchanged since TC10. So I compiled 32 and 64 bit versions
against fltk-1.3-dev.tcz under TC10. I used TC10 because the compiler produces smaller
executables. These are the results:
Code: [Select]
                             File Sizes
                       |  32 Bit  |  64 Bit  |
Original size          |  14204   |  19528   |
Highlighting removed   |   9948   |  13736   |
Version added to menu  |  10088   |  13936   | Note: under TC14, 64 bit version was 15696 bytes
Word wrapping enabled  |  10380   |  14344   | Note: under TC14, 64 bit version was 16200 bytes
Line numbers enabled   |  10572   |  14472   | Note: under TC14, 64 bit version was 16296 bytes
Both enabled           |  10800   |  14752   | Note: under TC14, 64 bit version was 16640 bytes

Version information:


Line Numbers and Word Wrap menu entries and short cuts:


Line Numbers turned on:


Line Numbers and Word Wrap turned on. They work quite well together. Where the
line gets wrapped, the line number is blank because its still part of the
previous line:


I like the idea of being able to turn on line numbers for when I get errors like this:
Code: [Select]
./Speed.tst: line 77: syntax error: unexpected "(" (expecting ")")so I can easily find line 77.

I've tested the binaries (32 and 64 bit) under TC10, 14 and 15. I expect them to
work under TC10-TC15, just like the current version of Xprogs.

So now I need some input from forum members and administrators as to what to do next.
That does not include adding features. I don't speak C++.

I could:

Create x86 and x86_64 extensions that place the new editor in their ~/.local.bin
directories so it's first in their PATH. The existing icon and menu entry will
then start the new version instead of the Xprogs version because they don't
specify a path. Optionally, I could also add them to the TC10-TC15 repositories.

If there's enough interest, I could repackage the Xprogs extension with the
new editor.

If any of the administrators want to incorporate this into TC16, I can push (pull?)
it into git.

Or any other suggestions I didn't think of.
« Last Edit: January 23, 2025, 01:45:28 PM by Rich »

Offline Leee

  • Full Member
  • ***
  • Posts: 135
Re: Modifications for Xprogs editor
« Reply #1 on: January 23, 2025, 04:24:50 PM »
I like what you're doing with the program.

While you're at it, it would be nice if it had a name other than just "editor" so that we can talk about it without having to say, "the FLTK editor that is part of Xprogs.tcz" - 'cause that's kind of cumbersome.  Maybe something unique but still indicating it's a text editor.  "tfetipox", while a succinct abbreviation, would probably be a poor choice.    ;)    Maybe a portmanteau of Xprogs and editor - "xpreditor"?

I'm a little uncomfortable with the idea of placing it in a directory under the user's home directory because
  • that puts it into the default backup and
  • it would depend on a default configuration which might or might not be present (for instance, I set up  ${HOME}/bin instead of ${HOME}/.local/bin )

core 15.0 x86_64

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11779
Re: Modifications for Xprogs editor
« Reply #2 on: January 23, 2025, 05:35:44 PM »
Hi Leee
The original program was called editor and that is the program
that was modified. I'm also hoping it gets rolled back into TC16.
It's to the point and states what it is, so I'm not inclined to try
to change it.

... that puts it into the default backup and ...
Actually, the extension only places a soft link in ~/.local.bin. Backup will only copy
the link. It does not follow the link and copy the file itself. If you don't have a
persistent home, you can add  ~/.local.bin/editor  to  /opt/.xfiletool.lst.

Quote
... it would depend on a default configuration which might or might not be present (for instance, I set up  ${HOME}/bin instead of ${HOME}/.local/bin )
There's not much I can do if someone changes a supplied Tinycore directory.

Online curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11069
Re: Modifications for Xprogs editor
« Reply #3 on: January 24, 2025, 02:00:01 AM »
I think it's fine to add your changes to git and add the binary with all features to Xprogs.
The only barriers that can stop you are the ones you create yourself.

Offline polikuo

  • Hero Member
  • *****
  • Posts: 768
Re: Modifications for Xprogs editor
« Reply #4 on: January 24, 2025, 04:44:53 AM »
I use the FLTK editor that is part of Xprogs.tcz for scripting and editing
various config files (bootlocal.sh, .filetool.lst, .xsession, .profile, etc).
The editor works quite well for these tasks, but there is one thing I don't
like about it. It does syntax highlighting for comments, keywords, data types,
strings, etc. That's fine if you're using it to write C or C++, but not for an
editor that's a part of the base GUI apps.

Hi, Rich.

Have you tried editor4sh ?
You can find the source code on my Github

It's been ages since I last update the extensions.
The latest version of my editor supports font size control which requires fltk-xft or fltk-full.
If you are interested, maybe we can improve it ?
« Last Edit: January 24, 2025, 04:49:24 AM by polikuo »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11779
Re: Modifications for Xprogs editor
« Reply #5 on: January 24, 2025, 01:32:35 PM »
Hi curaga
Thanks, I'll work on that.

I'd also like to disable drag and drop text:
Code: [Select]
Fl::dnd_text_ops(false);
I've tripped over it more than once. While highlighting text, accidentally
dragging it and dropping it into other text.

If some really wants it, they can re-enable it by adding this to ~/.Xdefaults:
Code: [Select]
fltk*dndTextOps: true

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11779
Re: Modifications for Xprogs editor
« Reply #6 on: January 24, 2025, 01:52:03 PM »
Hi polikuo
... You can find the source code on my Github ...
I just took a look. You obviously spent a lot of time working on that.

Quote
... If you are interested, maybe we can improve it ?
If you are looking to add line numbers and/or word wrapping, you
can lift them from here:
https://github.com/IngwiePhoenix/FLTK/blob/master/test/editor.cxx

You'll find the needed code at:
line 54 // define and initialize line number column width. It's too wide, change 75 to 40
line 451 and 452 // ints defined
line 478 and 479 // ints initialized
line 617 through 641 // call backs
line 880 and 881 // menu items

Ignore the call backs defined inside the  ifdef DEV_TEST  directives.

You can also find it in fltk-1.3.8-source.tar.gz under test/editor.cxx.

Offline nick65go

  • Hero Member
  • *****
  • Posts: 844
Re: Modifications for Xprogs editor
« Reply #7 on: January 25, 2025, 08:05:54 AM »
So, we survived until now (ALL tc versions 32/64 bits) with [14K -19k] of "editor". With Rich improvments it could be reduced at [10K -14k] bits, aprox 4K (a RAM page size). It's [very] good, but personaly not impressed/interested in 4K reduction even on 486 CPU, in year 2025 (age of minim 1 GB RAM). In the country were I live for now, you can not buy less than 4GB RAM on entry-level devices, but usualy is 8 GB RAM.

[I just wonder how long [years] will REAL OLD 486 devices be functional -because phisical degradation of chips or un-replaceble periferics/cards etc.].

IMHO: What will be indeed nice to have BY DEFAULT, even in virgin TC, are the OPTIONS at run-time such are: line-numers on/off, wrap on/off, autoindent on/off, syntax color on/off (for sh style, like for/if/while etc), search up/down, font type and font SIZE. Of course, there can have default values in  ~/.Xdefaults (ot whatever config), but main point is to modify them on the fly from inside the "editor" running.

The older we get, the more we apreciate a proper font type & size (on various laptop/desktop). And EXTRA options, like find/replace with reg-expresion?, are welcome. I think the needed dependencies were already uploaded when using a GUI of TC.
« Last Edit: January 25, 2025, 08:09:37 AM by nick65go »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11779
Re: Modifications for Xprogs editor
« Reply #8 on: January 25, 2025, 11:23:10 AM »
Hi nick65go
So, we survived until now (ALL tc versions 32/64 bits) with [14K -19k] of "editor". With Rich improvments it could be reduced at [10K -14k] ...
The point was to remove the C/C++ highlighting from what was supposed
to be a simple editor. The size reductions were a byproduct of that.

Quote
... It's [very] good, but personaly not impressed ...
That's OK. I'm not impressed with myself either.

Quote
... In the country were I live for now, you can not buy less than 4GB RAM on entry-level devices, but usualy is 8 GB RAM. ...
So you feel what's available to you should determine the specifications of Tinycore?

Quote
... [I just wonder how long [years] will REAL OLD 486 devices be functional -because phisical degradation of chips or un-replaceble periferics/cards etc.]. ...
486/586 compatible hardware is still being manufactured and sold.
Where it's not practical, some extensions are no longer 486/586
compatible. Firefox and one of the music players come to mind.

Quote
... IMHO: What will be indeed nice to have BY DEFAULT, even in virgin TC, are the OPTIONS at run-time such are: line-numers on/off, wrap on/off, autoindent on/off, syntax color on/off (for sh style, like for/if/while etc), search up/down, font type and font SIZE. Of course, there can have default values in  ~/.Xdefaults (ot whatever config), but main point is to modify them on the fly from inside the "editor" running. ...
OK, now I understand. You want a fancy editor. I think nano and geany
probably do what you want.

The base systems are intended to get you to a functional command line
or desktop so you can install whatever extensions meet your needs.


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11779
Re: Modifications for Xprogs editor
« Reply #9 on: January 25, 2025, 12:01:33 PM »
Hi curaga
Xprogs for TC15 x86 and x86_64 have the new editor binary.
I can update back to TC10 if you want.

I'll work on git later tonight.

In the mean time, anyone running TC10 through TC14 that
wants to try the new version can replace their Xprogs.tcz
with the TC15 version.

Offline nick65go

  • Hero Member
  • *****
  • Posts: 844
Re: Modifications for Xprogs editor
« Reply #10 on: January 25, 2025, 02:43:56 PM »
@Rich: Thanks for your sugestion: "You want a fancy editor. I think nano and geany probably do what you want".
If I need a little more "fancy" editor then beaver+gtk1 is OK!, less total RAM than nano (not GUI) or geany (GTK2).
I was thinking that (the famous) FLTK can do a more proper job , as GUI TOOLKIT, for a lot of small applications interface/menus (for editors, pdf, music players etc).
Or else, even Xdialog can buid GUI  :)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11779
Re: Modifications for Xprogs editor
« Reply #11 on: January 26, 2025, 05:13:54 PM »
Hi curaga
Pull request submitted.