Author Topic: Plain Old Editor  (Read 831 times)

zedd151

  • Member
  • *****
  • Posts: 1929
Plain Old Editor
« on: October 14, 2022, 04:12:39 AM »
Re-purposed this 'unreplied to' thread "Any suggestions for additions to 'my editor project'?" to announce my latest editor project, called "Plain Old Editor" or 'Poe' for short. Fittingly nicknamed "The Raven".
I am currently working on it, and will post the source code when it is finished:cool:

It will differ from 'my editor' in that there will be no user modifiable settings, no ini file, no editable menus. Nothing 'fancy schmancy' here. No print capabilities, no keyboard accelerators except for the default for the rich edit control, no toolbar, and a few other 'niceties' that I will not include as I personally have no use for them:badgrin:

In addition to the 'usual' editor functions in the File (Open Save, Save As) and Edit (Undo, Redo, Cut, Copy, Paste, Select All) menus, this editor also has a table based 'word selection' function (thanks hutch), and a preliminary auto-indent function. (Keeps same indentation as the line above upon pressing <ENTER>), as well as line number and column displayed on the status window.

Some of these may change over the course of writing the program.

Attached is a very simple version of the editor for testing and debugging purposes. No source code at this time. I plan on making several additions to this editor. Again, I will post the source code when this project is finished.

« Last Edit: December 13, 2022, 09:33:32 AM by zedd151 »
Regards, zedd.
:tongue:

jj2007

  • Member
  • *****
  • Posts: 13637
  • Assembly is fun ;-)
    • MasmBasic
Re: Plain Old Editor
« Reply #1 on: December 13, 2022, 09:34:26 AM »
https://www.youtube.com/watch?v=YAE1XTvKLXA

Hey, where's the "build all" button?

zedd151

  • Member
  • *****
  • Posts: 1929
Re: Plain Old Editor
« Reply #2 on: December 13, 2022, 09:55:07 AM »
Hey, where's the "build all" button?
It’s in the upper left hand drawer of my desk, with all the other accessories that are not included here.  :biggrin:  Some might never be included, depending on my needs.
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1929
Re: Plain Old Editor
« Reply #3 on: December 17, 2022, 04:57:41 AM »
Adding some new functions to this editor. I want it to have both 'word selection' and 'auto indent' very similar to how qeditor (and hutch's other editors) works. Having some difficulty in converting hutch's 64 bit 'auto indent' function to 32 bit at the moment... it's almost there, but some unforeseen oddness as well. Back to the grindstone.  :biggrin:  I'll look at this issue again later.  :cool:  Word selection is up and running, will post the current executable for bug reporting purposes by 'volunteers*' after I get either the current  'auto indent' working properly, or the converted 64 bit version (hutch's) working properly.

* those members who have downloaded it and tested it.  :biggrin:

The original version of this editor does have 'auto indent' but that one is a (roll your own) version of 'auto indent' that I was toying with, and it does not behave quite the way I am used to. If you press <enter> it does work as expected. Now pressing <enter> a second time it retains the indentation, rather than setting that line to 0 indentation (the way it works in qeditor). I prefer a one-shot of the auto-indent. Will continue trying to get the 64 bit version converted and working as expected unless I have a breakthrough in the development of my own version.  :toothy:
« Last Edit: December 17, 2022, 06:23:29 AM by zedd151 »
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1929
Re: Plain Old Editor
« Reply #4 on: December 17, 2022, 02:03:54 PM »
Re: Conversion to 32 bit of hutch's 64 bit auto indent... I was mistaken. The conversion was fine. No arguments save for one argument in one of the procedures. (No need for deciphering the registers back to args  :tongue: ). I did something with the code that calls the autoindent function that made the erroneous results previously. In my home grown auto indent, upon returning it looped back to GetMessage. Not needed in this one. I removed the jmp and it took care of that issue.  :biggrin: 

During the weekend I will add the improved autoindent code to the editor, and post it here.
« Last Edit: December 17, 2022, 09:47:27 PM by zedd151 »
Regards, zedd.
:tongue:

jj2007

  • Member
  • *****
  • Posts: 13637
  • Assembly is fun ;-)
    • MasmBasic
Re: Plain Old Editor
« Reply #5 on: December 17, 2022, 08:53:08 PM »
    autoindent                  proto
    get_current_line_index_ex   proto
    blank_count_ex              proto :dword
    get_current_column          proto

Not a critique at all, just an observation: procs without arguments don't need a PROTO. You can just call them from anywhere, the assembler knows how to find them.

zedd151

  • Member
  • *****
  • Posts: 1929
Re: Plain Old Editor
« Reply #6 on: December 17, 2022, 09:51:41 PM »
Not a critique at all, just an observation ...
Okay.
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1929
Re: Plain Old Editor
« Reply #7 on: December 18, 2022, 12:25:13 AM »
Here is the Plain Old Editor using a converted (64 bit -> 32 bit) 'autoindent' function originally written by hutch--. Works a little better than my previous version of 'autoindent' in that after pressing <ENTER> for a second time, the second line does not get indented as well.
The remaining menu selected functions remain unchanged from the initial version attached above in the first post of this thread.

The full source code will be posted when the project is finished and has been thoroughly debugged:biggrin:
« Last Edit: December 22, 2022, 10:29:26 PM by zedd151 »
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1929
Re: Plain Old Editor
« Reply #8 on: December 18, 2022, 05:35:09 AM »
One oddity about hutch's 64 bit autoindent function is that it can't be undone (EM_UNDO) without repeatedly sending the EM_UNDO message. In qeditors autoindent function only one EM_UNDO message need be sent to undo the indentation of a next line...

...
Therefore I am going to rework the autoindent function that I had originally written as it functions almost exactly as hutch's 64 bit version, with less code. Meaning that it has the same flaw regarding inability to undo with one EM_UNDO message being sent. That may take some time...  :tongue:


... later ...
Hrrmph! Not going to be easy ... It will take much more time ...
« Last Edit: December 18, 2022, 07:12:21 AM by zedd151 »
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1929
Re: Plain Old Editor
« Reply #9 on: December 18, 2022, 09:42:59 AM »
After having spent the better part of 4 hours trying to make an autoindent function that behaves like the one in qeditor, I have given up. I will use the version that I converted from hutch's 64 bit 'CodeEdit', and it should be sufficient since it does its job well, as long as the indentation made by it doesn't need to be undone via EM_UNDO.  :azn:


Now on to other things...
Regards, zedd.
:tongue:

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10281
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Plain Old Editor
« Reply #10 on: December 18, 2022, 10:43:50 AM »
Z,

I think its differences between 32 and 64 bit richedit controls and probably the OS version as well.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

zedd151

  • Member
  • *****
  • Posts: 1929
Re: Plain Old Editor
« Reply #11 on: December 18, 2022, 12:23:02 PM »

I think its differences between 32 and 64 bit richedit controls and probably the OS version as well.
Nope. I just checked your program "CodeEdit" in Windows 10 64 bit. While the autoindent function does indeed 'auto indent' the next line upon pressing the <ENTER> key, immediately trying to 'Undo' the auto indent takes multiple times of clicking on "undo" to remove it.
In qeditor in contrast, clicking undo immediately after auto indent -  the carriage return the plus entire indent is undone with one click of "Undo".
For most people this wouldn't matter. But is an inconvenience if you changed your mind about adding another line after pressing 'Enter'.


Also tested 'tEditor', it exhibits the same anomaly.
Regards, zedd.
:tongue:

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10281
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Plain Old Editor
« Reply #12 on: December 18, 2022, 01:03:00 PM »
It does not bother me but there is another way to do auto indent, when you hit enter and indent as the earlier line, if you hit enter again, it can be coded to not add the extra CRLF and just return to the left side.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

zedd151

  • Member
  • *****
  • Posts: 1929
Re: Plain Old Editor
« Reply #13 on: December 18, 2022, 01:10:08 PM »
It does not bother me but there is another way to do auto indent ...
:biggrin:  Nah, I've given up on working on anymore autoindent functions. The two I had used (yours converted to 32 bit from CodeEdit, and a homemade version of mine) work okay, just not like qeditors autoindent which I am very used to the way it works.  :tongue:   Old habits die hard.
Regards, zedd.
:tongue:

jj2007

  • Member
  • *****
  • Posts: 13637
  • Assembly is fun ;-)
    • MasmBasic
Autoindent
« Reply #14 on: December 25, 2022, 09:53:16 AM »
not like qeditors autoindent

Code: [Select]
  .if eax
nop ; level 2
.if edx
; 3
.if ecx
; 4
.if ebx
; 5
.if eax

A proper autoindent function (as implemented in RichMasm a long time ago) inserts an extra tab after .if whatever, .Repeat, .While, so that you can type .if eax<Ret>nop without wasting another keystroke on <tab>. Even better, Shift <Ret> should take off one tab, so that you get...
Code: [Select]
.if eax
nop
.else
nop
.endif
... in one go ;-)