Skip to content

Conversation

sthilaid
Copy link
Contributor

@sthilaid sthilaid commented Feb 5, 2023

Hi! This pull request adds two main features:

  • = Structured edition =
    This functionality mimics some functionality provided by the great paredit-mode in emacs. It helps s-expression (lisp like language code structure) edition by giving you tools to create / remove expressions and enforces (to a certain extent) the balance of parenthesis. It is still missing an automatic code alignment, but this might come in later.

  • = emacs-mode =
    This code editor mode changes a lot of bindings to be a lot more compatible with emacs users. It also brings some new features like deleteLine, startLine and some modified functionnality for others. It also fixes what I believe is a bug in endLine (which before the fix would bring you to the end of the code buffer). To enable this, I added a new submenu called Code Editor Options which has this "emacs mode" option embeded.

  • = tic_script_config additions =
    I added options in the language config to customize the isalnum function used when parsing their code. For instance, scheme allows a lot of normally forbidden characters in their symbols (stuff like ':' or '#'). This allows any language to customize it. In a similar fashion, there is also an option to override the API function names for that language so that the code highlight will correctly recognize them if they were modified for that language (for example, if there is a prefix). Finally, there is an option to enable structured edition for that language.

Let me know what you think!

@AlecTroemel
Copy link
Contributor

@sthilaid what are your thoughts moving the cursor to the inner s-expression ctrl-down? I havent done much "structural editing", but It was surprising to not be able to undo a sexpify without first hitting right.

@AlecTroemel
Copy link
Contributor

oh also, would we be able to add quotations " to the list of "can only delete if the innards are cleared"?

@sthilaid
Copy link
Contributor Author

sthilaid commented Feb 5, 2023

@AlecTroemel, very good suggestions, i'm going to implement both of those right away!

…sor inside the new sexp / str. Strings are now also part of structured editing (the editor tries it's best to keep them balanced)
@sthilaid
Copy link
Contributor Author

sthilaid commented Feb 6, 2023

done and done! it was a bit more work to add the double quotes to structured edition but it was an involuntary omition on my end! good catch! From my tests, it seems to be working well, hopefully there isn't too many holes in my logic.

@@ -238,6 +238,7 @@ static void setDefault(Config* config)
.volume = MAX_VOLUME,
.vsync = DEFAULT_VSYNC,
.fullscreen = false,
.emacsMode = false,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you pls move all the emacs mode declarations under #if defined(BUILD_EDITORS) definition, which will allow not including this option for special builds without editors?

@@ -128,6 +128,7 @@ typedef struct
bool vsync;
s32 volume;
tic_mapping mapping;
bool emacsMode;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here, please :)

@sthilaid
Copy link
Contributor Author

sthilaid commented Feb 6, 2023

ok done, I also added a define in the key bindings menu to return back to the proper element when the code editor option is not defined

@sthilaid
Copy link
Contributor Author

sthilaid commented Feb 6, 2023

theese errors are build machine flukes it seems, is there a way to restart the builds? never mind, i thin there are some unguarded references to emacsModeOption. I'll fix it later when i have the chance.

@sthilaid
Copy link
Contributor Author

sthilaid commented Feb 6, 2023

There seems to be some issues with the actions today, I don't know how to resolve these problems. For instance:

Err:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 fonts-lato all 2.0-2
  Connection failed [IP: 185.125.190.39 80]

@nesbox do you know what the issue is?

@sthilaid
Copy link
Contributor Author

sthilaid commented Feb 6, 2023

lol, okay that worked... seems like the build action or not super reliable! ;p

Copy link
Owner

@nesbox nesbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems everything looks good
Thank you

@nesbox nesbox merged commit 7be33dc into nesbox:main Feb 6, 2023
@sthilaid
Copy link
Contributor Author

sthilaid commented Feb 6, 2023

I would like to add some documentation about these changes, when should I modify the wiki to explain them. When will version 1.1 be released? (no point in adding the doc if it's not in the users' hands)

Also, is there a roadmap of incoming changes. Is there stuff you need help with that I could maybe give a hand?

@sogaiu
Copy link

sogaiu commented Feb 6, 2023

I was looking at this.

@nesbox
Copy link
Owner

nesbox commented Feb 7, 2023

Yes, GitHub Issues is our roadmap,
as for adding documentation, pls create a new page in the Wiki and add a link to it on the Code Editor page https://github.com/nesbox/TIC-80/wiki#code-editor

@sthilaid
Copy link
Contributor Author

sthilaid commented Feb 8, 2023

Excellent, I added the info to the wiki, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants