Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.misc > #1045

Re: misc: multi-line editing/evaluation...

From Mike Austin <mike.austin.1024@gmail.com>
Newsgroups comp.lang.misc
Subject Re: misc: multi-line editing/evaluation...
Date 2012-03-12 16:24 -0700
Organization http://groups.google.com
Message-ID <24916030.981.1331594665957.JavaMail.geo-discussion-forums@pbcjk1> (permalink)
References <jjlqg2$vbf$1@news.albasani.net>

Show all headers | View raw


On Monday, March 12, 2012 2:38:51 PM UTC-7, BGB wrote:
> here is the scenario:
> I have a 3D engine;
> it has a console;
> I can evaluated code fragments at said console.
> 
> 
> basically, sort of like the Quake-family engines, except that the 
> console is a full-screen translucent overlay, and presently accessed via 
> "ALT-~" (both CTRL-~ and ~ by itself had drawbacks).
> 
> 
> I was generally limited (WRT evaluating script expressions) to whatever 
> I could reasonably type at a command-prompt.
> 
> so, then I was left thinking, "what if I had a text editor"?
> 
> the idea would be to have something sort of like QBasic or the "SQL 
> Server Management Studio", where one can type/edit scripts, in program, 
> and then evaluate them. or, likewise, highlight chunks of text, hit an 
> "evaluate" key, and have it do something.
> 
> 
> a partial reason would be to reduce the current annoyance of the prior 
> process:
> ALT-TAB (get into Notepad2 or similar);
> edit script;
> ALT-TAB (get back into 3D engine);
> UP-Arrow, Enter (say, to execute a prior ";load(...);" command).
> (possibly mixed with ALT-~ to enter/exit console).
> 
> 
> problem:
> I was having a hard-time thinking up a good way to interface a text 
> editor with the 3D Engine's UI.
> 
> I was left considering more complex options, roughly things like 
> allowing multiple consoles (and/or "tabs"), and basically allowing 
> implementing something roughly along the lines of QBasic or MS-Edit 
> inside the console (switch to a secondary console, pull up "edit", go 
> into something sort of like QBasic, type code, have it do stuff, 
> presumably in the 3D scene, ...).
> 
> current thinking:
> ALT-~ enters/exits console (as before);
> SHIFT + F1-F9 select the active console/tab (when console is active, 
> these execute commands if console is not active).
> 
> 
> I was tempted, but as-is, this would be kind of a pain to implement 
> (would have to both code up the editor, and make some changes to how the 
> console is handled, ...). note that the console buffer is basically a 
> grid of characters and color/effect values, and so is "essentially 
> similar" to text-mode (most obvious difference being that the buffer is 
> the Unicode-BMP, vs "IBM Extended ASCII" / "CodePage 437").
> 
> some of the needed changes were already made though (adding 
> "ConsoleInfo" structures and similar).
> 
> 
> as a much faster/cheaper/initial option, I ended up doing something 
> different:
> I added console commands that basically work vaguely similar to 
> something like "edlin", where one basically edits by typing in 
> line-numbers and lines of text, or can invoke commands for things like 
> adding/deleting lines, printing lines to the console, ...
> 
> so, for example (preexisting syntax):
> ;printf("Hello\n");	//evaluate expression directly
> 
> the ';' prefix mostly tells the console that it is a script expression, 
> rather than, say, a console generic command (or getting/setting a cvar).
> 
> and, new syntax:
> *1 printf("Hello\n");
> *2 printf("Hello again\n");
> *eval
> 
> which executes both lines, oddly not nearly as horrid/awkward as one 
> might think (though using * for this is slightly annoying, there are not 
> many other better options available).
> 
> 
> I could (or may) still consider investing effort in throwing together 
> something vaguely more QBasic-like (being much more better suited for 
> things like editing script files, and limited to consoles 2-9 for 
> technical reasons, ...).
> 
> 
> any thoughts?

In JavaScript debuggers in edit mode (vs 1 command at a time), Enter adds newlines, while alt-enter executes them.  You could try a hybrid where you select a chunk of text and call that the "editor".  Outside that area enter executes the line.  Or something along those lines, because I think both ways useful like you are doing.

Mike

Back to comp.lang.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

misc: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-12 14:38 -0700
  Re: misc: multi-line editing/evaluation... Mike Austin <mike.austin.1024@gmail.com> - 2012-03-12 16:24 -0700
    Re: misc: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-12 17:30 -0700
  Re: misc: multi-line editing/evaluation... Rui Maciel <rui.maciel@gmail.com> - 2012-03-12 23:42 +0000
  Re: misc: multi-line editing/evaluation... "BartC" <bc@freeuk.com> - 2012-03-12 23:51 +0000
    Re: misc: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-12 18:29 -0700
      Re: misc: multi-line editing/evaluation... Mike Austin <mike.austin.1024@gmail.com> - 2012-03-12 22:04 -0700
      Re: misc: multi-line editing/evaluation... "BartC" <bc@freeuk.com> - 2012-03-13 12:31 +0000
        Re: misc: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-13 10:03 -0700
  Re: multi-line editing/evaluation... "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-13 02:43 -0400
    Re: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-13 11:12 -0700
  Re: misc: multi-line editing/evaluation... Jacko <jackokring@gmail.com> - 2012-03-13 20:10 -0700
  Re: misc: multi-line editing/evaluation... Paul N <gw7rib@aol.com> - 2012-03-14 15:08 -0700
    Re: misc: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-14 19:11 -0700
      Re: misc: multi-line editing/evaluation... "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-15 04:10 -0400
        Re: misc: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-15 13:09 -0700
  Re: multi-line editing/evaluation... "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2012-03-16 08:54 +0000
    Re: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-16 09:45 -0700

csiph-web