Jump to content




xEdit - Ingame editing revolutionized


19 replies to this topic

#1 wieselkatze

  • Members
  • 221 posts
  • LocationGermany

Posted 16 October 2014 - 11:24 PM

Posted Image




Hey all!

It's been a long time since I worked on luaedit - my first big project, an attempt to create a better ingame editor. To that time I knew that it would have no chance against LuaIDE from GravityScore.

About 2 weeks ago, I started a new project - xEdit - actually inspired by OneCode, which oeed was planning to make.
At that point I started thinking about how ingame editing could be further simplified. I looked at the standard editor, LuaIDE and mine, luaedit.
And what I missed most was advanced editing, like the normal Notepad, Notepad++, Sublime, Atom etc. have. That is marking text, replacing it, copying it, pasting it and so on.
Also what I missed in LuaIDE was de-indenting ( whatever it's called ) with Shift + Tab. This all is now implemented in xEdit. It is still not finished and features will get added, but it is designed to show
what's actually possible.

The code still needs some cleanup, but it's way better readable than the one of luaedit.

Further down are some screenshots + the installer.

Features for now ->
  • Text marking, replacing, copying, pasting
  • Opening files from pastebin
  • Directly uploading files to pastebin
  • Automatic indentation at certain keywords ( if, while, ... )
  • Shortcuts - Ctrl + X ( cut ) ; Ctrl + C ( copy ) ; Ctrl + B ( paste, B to not interfer with normal pasting )
  • Directly opening files with "xedit <path>"
  • Auto-completion of brackets, quotation marks
  • Automatic replacement of closing brackets etc.
  • Fixed string highlighting, e.g. "\\" will be shown correctly
  • Using Home once will jump to the end of the indentation, hitting it a second time will set the cursor pos to 1
So, I quickly created a sloppy installer - but it works! :P Just use

pastebin run bHsXjcQP
or
Pastebin

Posted Image

Main Menu

Editing

As always - feedback greatly appreciated. What could be implemented? What could be improved? Just post below!

Edited by wieselkatze, 06 March 2015 - 11:18 PM.


#2 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 16 October 2014 - 11:38 PM

This is really nice. The text selection works really well, same with the the copying and pasting. A few small things.

Maybe have a gap of one pixel between the line numbers and the code or make the line numbers bar a bit narrower, I think it would just make it look a bit nicer.

And maybe change "pastebin" to "Pastebin". It's really minor, but it just looks a bit neater.

Your installer doesn't make the /.xedit/apis/ folder so it crashes, when I create it myself it works fine.

#3 wieselkatze

  • Members
  • 221 posts
  • LocationGermany

Posted 16 October 2014 - 11:40 PM

Huh? I just tested it and it worked fine.
Which version of ComputerCraft are you using? I know that with further versions of CC folders will be created automatically - that should be a relatively quick fix.

EDIT:
Okay, older versions should work, when pastebin's ready. Will update the installer ASAP.

Edited by wieselkatze, 16 October 2014 - 11:52 PM.


#4 oli414

  • Members
  • 29 posts
  • LocationThe Netherlands

Posted 23 October 2014 - 10:28 PM

This is awesome! The implemented features work fine. The function text color is kinda had to see if it is in a highlighted line or in a selection. Love the auto tab aswell, would be cool if it wouldn't apply the auto tab at the 'end'

#5 Agent Silence

  • Members
  • 319 posts
  • Location[string "FindMe"]:23143: bad argument #1 to 'returnPos' (vector expected, got nil)

Posted 24 October 2014 - 04:26 AM

This looks really good.
Maybe you could have "insert" button to insert things for ease of use like
Insert>loops>repeat adds a repeat loop with an until already at the end
that would make xEdit really stand out

EDIT: Also being able to save to pastebin would be awesome

Edited by Agent Silence, 24 October 2014 - 04:27 AM.


#6 InputUsername

  • Members
  • 231 posts
  • LocationThe Netherlands

Posted 24 October 2014 - 11:31 AM

Looks good. I don't get why you abbreviate 'document', though. Not really necessary.

An option to turn off auto-tab would be cool too. Also, when I saved a document, it was saved as 'advread_complete', even though I named it 'test'.

#7 oli414

  • Members
  • 29 posts
  • LocationThe Netherlands

Posted 24 October 2014 - 11:45 AM

Another idea: Custom colors for syntax highlighting

#8 Saldor010

  • Members
  • 467 posts
  • LocationThe United States

Posted 24 October 2014 - 12:35 PM

 Agent Silence, on 24 October 2014 - 04:26 AM, said:

This looks really good.
Maybe you could have "insert" button to insert things for ease of use like
Insert>loops>repeat adds a repeat loop with an until already at the end
that would make xEdit really stand out

EDIT: Also being able to save to pastebin would be awesome

If wiesel added these suggestions into xEdit, I would probably use it instead of Notepad ++. :lol:

#9 wieselkatze

  • Members
  • 221 posts
  • LocationGermany

Posted 24 October 2014 - 04:00 PM

Alright guys, here we are.

 oli414, on 23 October 2014 - 10:28 PM, said:

This is awesome! The implemented features work fine. The function text color is kinda had to see if it is in a highlighted line or in a selection. Love the auto tab aswell, would be cool if it wouldn't apply the auto tab at the 'end'

Changed the function text color to be dark blue - should now look a bit better.
As for the auto-tab not applying at 'end', 'elseif' or 'else' - that is now implemented. If there still is any bugs with that - just let me know.


 Agent Silence, on 24 October 2014 - 04:26 AM, said:

This looks really good.
Maybe you could have "insert" button to insert things for ease of use like
Insert>loops>repeat adds a repeat loop with an until already at the end
that would make xEdit really stand out

EDIT: Also being able to save to pastebin would be awesome

Inserting loops and some stuff. Hm, neat idea.
But if I'll do that, I'm probably going to bind that to a shortcut, else you would be faster just typing it, hehe.
Saving to pastebin should now work fine. It currently won't give you a message, but it'll insert a success or failure code in line one of your code. The pastebin-code should also be implemented in that comment.
The problem might be, that I set a paste expiration time of 10 minutes - for testing purposes.


 InputUsername, on 24 October 2014 - 11:31 AM, said:

Looks good. I don't get why you abbreviate 'document', though. Not really necessary.

An option to turn off auto-tab would be cool too. Also, when I saved a document, it was saved as 'advread_complete', even though I named it 'test'.

The reason why document is abbreviated is simply that my GUI API cuts off text that is too long. And as I set the width of the buttons to be constant, things like that might happen.
Turning off auto-tab will be implemented later, for that I'll let xEdit create a config file so you won't have to deactivate it every time you restart the program.


 InputUsername, on 24 October 2014 - 11:31 AM, said:

Also, when I saved a document, it was saved as 'advread_complete', even though I named it 'test'.

Hm, that's odd. What exactly did you do?
The only reason for behaving like that would be a bug in the start screen, because the read function will trigger an 'advread_complete' event when you hit enter.
But as I checked, the code for opening a file from the start screen is correct - it uses e[2]. If it'd be e[1], that file would be saved as 'advread_complete'


 oli414, on 24 October 2014 - 11:45 AM, said:

Another idea: Custom colors for syntax highlighting

Yup. That's definitely something to be added.
When I implement my config-load stuff, you'll be able to switch between different schemes. Of course being able to create one for yourself.
Maybe I'll make a contest or something like that and the best color schemes will be implemented in the default scheme pack.

Thanks everybody for the feedback!

#10 Agent Silence

  • Members
  • 319 posts
  • Location[string "FindMe"]:23143: bad argument #1 to 'returnPos' (vector expected, got nil)

Posted 24 October 2014 - 10:10 PM

You could use the same keybind system as Smite
VVGG = Good Game
you can read about it here
http://smite.gameped...e_Guided_System

#11 manu_03

  • Members
  • 84 posts
  • LocationSpain

Posted 25 October 2014 - 02:04 PM

I don't know... What will I do? Use this or LuaIDE?

#12 TheJebForge

  • Members
  • 128 posts

Posted 03 March 2015 - 12:17 PM

Can i use it in my OS?

#13 wieselkatze

  • Members
  • 221 posts
  • LocationGermany

Posted 03 March 2015 - 09:08 PM

Sure - I'm fine with that, as long as I'm in the credits :)

#14 Geforce Fan

  • Members
  • 846 posts
  • LocationMissouri, United States, America, Earth, Solar System, Milky Way, Universe 42B, Life Street, Multiverse, 4th Dimension

Posted 06 March 2015 - 10:15 PM

This is really nice. I'm noticing a lot of editors floating around that aren't auto indenting NOR keeping the indentation from the last line, rendering them unusable(for me). This has auto-indenting AND keeps the last line's indentation, making it really nice to use.
Bravo.

I'd suggest checking for errors on each line. You do this by using the loadstring function. You load the line as a function, and if loadstring passes a second variable back, then it errored. The variable is the error. Just don't call the function. For example
local _,err = loadstring(line)
if err then
  hasError(err)
end

Edited by Geforce Fan, 06 March 2015 - 10:18 PM.


#15 GopherAtl

  • Members
  • 888 posts

Posted 06 March 2015 - 10:24 PM

 Geforce Fan, on 06 March 2015 - 10:15 PM, said:

I'd suggest checking for errors on each line. You do this by using the loadstring function. You load the line as a function, and if loadstring passes a second variable back, then it errored. The variable is the error. Just don't call the function. For example
local _,err = loadstring(line)
if err then
  hasError(err)
end

CC's loadstring doesn't return the error, actually, just the function on success or "nil." Annoying, that.

#16 wieselkatze

  • Members
  • 221 posts
  • LocationGermany

Posted 06 March 2015 - 10:29 PM

 Geforce Fan, on 06 March 2015 - 10:15 PM, said:

This is really nice. I'm noticing a lot of editors floating around that aren't auto indenting NOR keeping the indentation from the last line, rendering them unusable(for me). This has auto-indenting AND keeps the last line's indentation, making it really nice to use.
Bravo.

I'd suggest checking for errors on each line. You do this by using the loadstring function. You load the line as a function, and if loadstring passes a second variable back, then it errored. The variable is the error. Just don't call the function. For example
local _,err = loadstring(line)
if err then
  hasError(err)
end

Just loading the line wouldn't be sufficient. For example try loading "if a then" - that'll probably throw something like "[string "blabla"]:1:end expected" or whatever. You'd have to process that error message and nail it down to the line where it happened.
So for checking certain lines for errors you would have to load the whole file at once.

 GopherAtl, on 06 March 2015 - 10:24 PM, said:

 Geforce Fan, on 06 March 2015 - 10:15 PM, said:

I'd suggest checking for errors on each line. You do this by using the loadstring function. You load the line as a function, and if loadstring passes a second variable back, then it errored. The variable is the error. Just don't call the function. For example
local _,err = loadstring(line)
if err then
  hasError(err)
end

CC's loadstring doesn't return the error, actually, just the function on success or "nil." Annoying, that.

CC does return 'compiler' errors with loadstring() - to be exact it's not a compiler, but whatever.
Try this in the lua console:

a, b = loadstring( "if a then" )

a will be nil, as you said. But b will contain 'lua:1:[string "string"]:1: 'end' expected'. So that would work, I just haven't implemented it yet.

#17 SpencerBeige

  • Members
  • 263 posts

Posted 06 March 2015 - 10:31 PM

does. it. have, ctrl + v support? ik that luaIDE doesn't so i was just wandering...

#18 wieselkatze

  • Members
  • 221 posts
  • LocationGermany

Posted 06 March 2015 - 10:34 PM

It does support external pasting with Ctrl + V.
LuaIDE probably doesn't, because in CC 1.6? the 'paste' event was introduced. Before that, I think, pasting just worked as char events being triggered.
However it's limited ComputerCraft-wise, as it can only paste on line at a time. Here is a thread about that.
In the editor itself you can copy/cut/paste multiple lines at once, sure :)

Edited by wieselkatze, 06 March 2015 - 10:34 PM.


#19 GopherAtl

  • Members
  • 888 posts

Posted 06 March 2015 - 10:48 PM

 GopherAtl, on 06 March 2015 - 10:24 PM, said:

 Geforce Fan, on 06 March 2015 - 10:15 PM, said:


CC's loadstring doesn't return the error, actually, just the function on success or "nil." Annoying, that.

CC does return 'compiler' errors with loadstring() - to be exact it's not a compiler, but whatever.
Try this in the lua console:

a, b = loadstring( "if a then" )

a will be nil, as you said. But b will contain 'lua:1:[string "string"]:1: 'end' expected'. So that would work, I just haven't implemented it yet.

:goes to double-check: fuuu. You're right, it does. It's the lua program that doesn't display multiple returns if the first is nil, possibly because luaj is stupid and won't allow an array to have nil elements like standard lua is supposed to.

Spoiler

Well, that is good to know. Wieselkatze's points still stand, and while this is perhaps subjective, the spastic color-changing that happens in luaide while it does some form of this is one of my biggest issues with it. It's far more distracting than helpful.

Edited by GopherAtl, 06 March 2015 - 10:49 PM.


#20 wieselkatze

  • Members
  • 221 posts
  • LocationGermany

Posted 06 March 2015 - 10:54 PM

 GopherAtl, on 06 March 2015 - 10:48 PM, said:

Well, that is good to know. Wieselkatze's points still stand, and while this is perhaps subjective, the spastic color-changing that happens in luaide while it does some form of this is one of my biggest issues with it. It's far more distracting than helpful.

Yep, that was exactly what I was thinking when using LuaIDE. As it marks the whole line in brilliant red, I just thought while programming "Hell!? I'm still writing that damn line - I know it isn't correct when I'm currently at the 'n' from then".
Thing is that you could actually implement a button for error checking, but why? Just using a 'Run my program' button telling you that you have produced some junk somewhere would be sufficient.
And after erroring there could be a dialogue with 'jump to that line' or 'I don't give a f**k'.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users