4coder»Forums
ggn
George Nakos
4 posts
Tabs / syntax highlighting / customisation / etc
Edited by George Nakos on
Hi (and happy easter to everyone)!

I've been evaluating 4coder for a while now, making it my main editor so I can see if it fits my needs. On the whole I'm really pleased with it but I just have some queries before I take the plunge and buy the full version.

Before I get to it let me state that I don't write too much C/C++ for my personal projects - this is mostly restricted to work. Also I'm using 4coder version alpha 4.0.25.

1. When I edit plain text files in 4coder (actually they're Basic files but it doesn't matter) I do notice some weird formatting problems. Here's a snippet of code rendered in vim:



and here's the same in 4coder:



the code is formatted using tabs instead of spaces. I did try to find some keybinding or setting but I wasn't successful. Did I miss something?

2. Is it possible to insert spaces when hitting tab instead of a tab?

3. I do understand the concept behind the customisation layer and I think it's a great idea. However I'm usually more into using editors and/or using someone else's solutions or plugins than doing the work myself. I've been monitoring the forum and I've seen quite a few people sharing their customisations. My question then is: is there a list of the customisations available? "repository" probably sounds complicated but even some maintained list would be fine!

4. As I said at the beginning I'm not too much into C/C++ - I'm mostly writing code in assembly (68k) or basic. Is syntax highlighting an internal part of 4coder still or can more syntax modules be added using the customisation layer?

5. The shortcuts and functions used to find text are quite nice and suit me well. However something I'm missing from other editors is the ability to highlight all found instances, preferably even after I exit search. Is such a thing available or in the pipeline?

6. Another feature I'm missing is the ability to extend the cursor vertically and type in all selected lines, or rectangle select and then copy or delete the selection. Is this something feasible in 4coder?

7. Finally (sorry!), is there a way for the scratchpad to survive closing and reopening 4coder? It would be great if I could use it as something I can scribble a quick note without having the hassle of creating a new file, saving it and then forgetting its existence!

Sorry for the long post (and my first one on this forum at that)! Looking forward to your reply!


George Nakos
Simon Anciaux
1341 posts
Tabs / syntax highlighting / customisation / etc
Edited by Simon Anciaux on Reason: typo
Welcome to the network.

1. I think that by default in VIM "tabs" are equal to 2 spaces, in 4coder the default is 4 spaces. You can change that in the paid version by defining DEF_TAB_WIDTH in your custom layer.
1
#define DEF_TAB_WIDTH 4

2. The default in 4coder is to insert spaces. I believe this can be changed in the custom layer but I don't remember how.
3. There isn't a list of custom layers. Maybe we could do something like that in the 4coder wiki.
4. You can create simple syntax highlighting in the custom layer. You need to create a keywords header file and include it in your custom layer.
1
2
3
4
5
6
7
8
9
// keywords.h
{ make_stafl( "u8", CPP_TOKEN_KEY_TYPE ) },
{ make_stafl( "u16", CPP_TOKEN_KEY_TYPE ) },
{ make_stafl( "u32", CPP_TOKEN_KEY_TYPE ) },
...

// in you custom layer main file, before including 4coder_default_include.cpp
#define EXTRA_KEYWORDS "../keywords.h"
#include "4coder_default_include.cpp"

5. There is no way to do that at the moment.
6. There was an experimental version of that in the Power version which is not available anymore. But it is possible to implement it using the custom layer.
7. The scratch buffer isn't saved. It can be done in using the custom layer, but it would just be creating a scratch.txt file somewhere that is save when 4coder quits and loaded when it starts.
ggn
George Nakos
4 posts
Tabs / syntax highlighting / customisation / etc
Thanks for the replies!

mrmixer
Welcome to the network.
2. The default in 4coder is to insert spaces. I believe this can be changed in the custom layer but I don't remember how.


That's not my experience at all. For example if I start typing in a new line, then hit tab, then write some more then when I navigate the cursor around it'll jump over the tab instead of treating it as spaces. I just checked the file after writing, it did insert a tab character so it's a legit tab. Perhaps you're confusing out of the box settings?
ggn
George Nakos
4 posts
Tabs / syntax highlighting / customisation / etc
Also,

mrmixer
1. I think that by default in VIM "tabs" are equal to 2 spaces, in 4coder the default is 4 spaces. You can change that in the paid version by defining DEF_TAB_WIDTH in your custom layer.


Sorry, I don't think I made my point clear. So let me illustrate:



Here I insert 1,2,3 characters at the start of the line and hit tab. 4coder simply inserts a tab there which is equal to 4 spaces every time instead of trying to align the rest of the text in a multiple-of-4 column. At least that's the point of aligning text with tabs as far as I'm concerned!
Simon Anciaux
1341 posts
Tabs / syntax highlighting / customisation / etc
Edited by Simon Anciaux on
Sorry for the wrong infos.

2. 4coder does different things depending on the type of file (code or just text, based on the file extension). As you said it actually insert tabs for text file (and for code, tab is the key for autocomplete). I'm sure Allen will answer this if there is a way to change that to spaces.

1. 4coder doesn't do this type of alignment as far as I know.
Allen Webster
476 posts / 6 projects
Heyo
Tabs / syntax highlighting / customisation / etc
Here are my addendums and corrections to the answers mrmixer gave.

1. In the current version tabs aren't treated like editors normally treat them, just because the buffer layout stuff is too primitive. It just treats a tab as a character whose width is 4 times the width of a space. 4.1.0 will introduce a new layout engine to do this the way every other editor usually does.

3. I am indeed trying to organize some of the existing publicly shared customizations to become articles in the 4coder wiki. It's slow coming though.

4. You can probably get *close* to what you want with the keyword customization in 4.0.25. The 4.1.X line will fully replace keyword customization to make it more flexible.

5. Again, coming in an early 4.1.X build.

6. Yeah I have this and will upgrade it to the shipping builds before I retire the 4.0.X line.

Based on your wishlist, I would recommend waiting for the 4.1.0 to get the full version, because the 4.1.X line will be sold separately from the 4.0.X line.
ggn
George Nakos
4 posts
Tabs / syntax highlighting / customisation / etc
Sounds great, thanks!

One final issue I'm experiencing with the itch.io version of 4coder is that sometimes the copy buffer gets "stuck". So when I'm trying to paste stuff from an external process (say a web browser) 4coder will simply paste what it kept on its copy buffer, not what's on the clipboard. Sadly I can't find a way to reproduce it every time - the only thing I discovered is that to work around this I usually hit copy 3-4 times and then 4coder catches on. (Of course this behaviour will continue for the rest of the session, I have to exit and restart 4coder for this to do away). Is this a known issue?
Mikael Johansson
99 posts / 1 project
Tabs / syntax highlighting / customisation / etc
ggn
Sounds great, thanks!

One final issue I'm experiencing with the itch.io version of 4coder is that sometimes the copy buffer gets "stuck". So when I'm trying to paste stuff from an external process (say a web browser) 4coder will simply paste what it kept on its copy buffer, not what's on the clipboard. Sadly I can't find a way to reproduce it every time - the only thing I discovered is that to work around this I usually hit copy 3-4 times and then 4coder catches on. (Of course this behaviour will continue for the rest of the session, I have to exit and restart 4coder for this to do away). Is this a known issue?


I can not speak for 4coder, so this answer is about the clipboard in general. I have an issue with the clipboard in Glyphin as well. I am using the built-in function in SDL for getting and setting the clipboard. It get stuck sometimes for me to, but only the very first time I start it up so far. Then the issue seems to go away. I "solved" it by letting the clipboard-function be in its own thread. This makes the "freeze" go away, but in theory it MAY be possible for the clipboard to not update quickly enough, resulting in the wrong text being pasted.

I have no idea if there is a pefect solution out there, but making it threaded in 4coder could be a quick fix.