"Simple question" concerning insert/overstrike mode

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
I am trying to construct a toolbar button to go to the beginning of the command line and insert the word trace and then runs the command. (Trace is an alias for a script that figures out the type of the command and calls the appropriate degugger; currently knows how to do TCC and Perl).

Nothing simpler, just use Home "trace " Enter with the button set to Send to current tab.

And this works if the keyboard is in insert mode but fails if it is in overstrike mode. As far as I've been able to find there is no key that will place the keyboard into insert mode (Ins toggles so it does not work).

Am I missing something?
 
#2
I am trying to construct a toolbar button to go to the beginning of the command line and insert the word trace and then runs the command. (Trace is an alias for a script that figures out the type of the command and calls the appropriate degugger; currently knows how to do TCC and Perl).

Nothing simpler, just use Home "trace " Enter with the button set to Send to current tab.

And this works if the keyboard is in insert mode but fails if it is in overstrike mode. As far as I've been able to find there is no key that will place the keyboard into insert mode (Ins toggles so it does not work).

Am I missing something?
Since I didn't get a reply, let me try another way.

Rex,
Please introduce a key binding to set the keyboard mode to Overstrike (or to insert if that is your preference). One binding for either is enough for all purposes together with the existing insert/overstrike toggle binding (Ins directive).
 
#3
Re: "Simple question" concerning insert/overstrike mode

How about using the clipboard?

end shift-home ctrl-y "trace " ctrl-v

2009/12/16 Péter Köves <>:

> ---Quote (Originally by Péter Köves)---
> I am trying to construct a toolbar button to go to the beginning of the command line and insert the word trace and then runs the command. (Trace is an alias for a script that figures out the type of the command and calls the appropriate degugger; currently knows how to do TCC and Perl).
>
> Nothing simpler, just use* Home "trace " Enter* with the button set to Send to current tab.
>
> And this works if the keyboard is in insert mode but fails if it is in overstrike mode. As far as I've been able to find there is no key that will place the keyboard into insert mode (Ins toggles so it does not work).
>
> Am I missing something?
> ---End Quote---
> Since I didn't get a reply, let me try another way.
>
> Rex,
> Please introduce a key binding to set the keyboard mode to Overstrike (or to insert if that is your preference). One binding for either is enough for all purposes together with the existing insert/overstrike toggle binding (Ins directive).
>
>
>
>
>


--
Jim Cook
2009 Saturdays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Sunday.
 
#4
Re: "Simple question" concerning insert/overstrike mode

Hmm, tricky! But you're right it does work!

The only anomaly is that the highlight resulting from the selection is not removed (though there is nothing selected); a small bug. And of course, it does destroy the clipboard content, but I guess I can live with that too.

All well and good ... except :mad: now I get a crash in bdebugger ...

How about using the clipboard?

end shift-home ctrl-y "trace " ctrl-v

2009/12/16 Péter Köves <>:





--
Jim Cook
2009 Saturdays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Sunday.
 
#5
Re: "Simple question" concerning insert/overstrike mode

Pter Kve wrote:
| All well and good ... except :mad: now I get a crash in bdebugger ...

Here, too, attempting to the BDEBUGGER command crashes the IDE instance,
AFTER it processes the .INI file.

TCC 11.00.35 Windows XP [Version 5.1.2600]
TCC Build 35 Windows XP Build 2600 Service Pack 3

--
Steve
 

rconn

Administrator
Staff member
May 14, 2008
10,189
86
#6
> Please introduce a key binding to set the keyboard mode to Overstrike
> (or to insert if that is your preference). One binding for either is
> enough for all purposes together with the existing insert/overstrike
> toggle binding (Ins directive).
You should to post this in the suggestions forum.

I'll add it to the suggestion list for v12.

Rex Conn
JP Software
 
May 29, 2008
521
3
Groton, CT
#8
Rex,
Please introduce a key binding to set the keyboard mode to Overstrike (or to insert if that is your preference). One binding for either is enough for all purposes together with the existing insert/overstrike toggle binding (Ins directive).
Péter, the Insert key works for me to toggle between keyboard insert and overstrike modes. Doesn't that work for you?
 
#9
Re: "Simple question" concerning insert/overstrike mode

rconn wrote:
| I have no idea what you're doing here -- can you simplify this to a
| reproducible test case?

Let x.btm exist in the current directory. Issue the command
bdebugger x.btm
On my system:
1/ IDE.EXE is instantiated
2/ IDE.EXE processes the initialization directives, and creates its own
taskbar icon
3/ IDE.EXE crashes with GPF and the usual MS "We are sorry..." message box.

GPF:

TCC 11.00.35
Module=F:\JPSOFT\I11\IDE.EXE
Address=0041601D
Exception=C0000005
EAX=00000000 EBX=0260BB68 ECX=0260BE4C EDX=00000000
ESI=00000000 EDI=00000000 EBP=0105A540 ESP=0105A000
CS=0000001B DS=00000023 ES=00000023 SS=00000023
Flags=00010202

Stack:
1 : IDE.EXE 0001:0001501d

Clicking on "do not send" terminates IDE, removes its taskbar button, and
the original V11 instance is activated.

Note: I know the IDE is evaluating the initialization directives, because it
reports the failure of an "include" directive. This has occurred in previous
V11 builds too, and has been harmless.
--
Steve
 
#10
dcantor wrote:
| the Insert key works for me to toggle between keyboard insert
| and overstrike modes. Doesn't that work for you?

Sure it works, but you do not know which the current mode is, and thus
cannot FORCE either mode. A new internal variable _insertmode would be an
alternate solution, which would allow putting into a keystroke alias the
sequence `%@if[%_insertmode EQ 0,ins,]` to force setting insert mode.
Peter asked for either a command to force insert mode, or a command to
force overstrike mode, since forcing the "Ins" key code into the command
line after either of those commands allows forcing the other mode. However,
we already have a KEYBD command, which changes the state of one or more of
the other 3 keyboard-related toggles: caps lock, num lock, and scroll lock.
It should be trivial to add another option. e.g., /I, to the KEYBD command
to force insert mode ON or OFF. Since we already have _capslock, _numlock
and _scrolllock internal variables, I'd like to have an _insertmode internal
variable even with the addition of the /I option to KEYBD.
--
Steve
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,415
40
Albuquerque, NM
prospero.unm.edu
#11
Re: &quot;Simple question&quot; concerning insert/overstrike mode

Sure it works, but you do not know which the current mode is, and thus cannot FORCE either mode. A new internal variable _insertmode would be an alternate solution, which would allow putting into a keystroke alias the sequence `%@if[%_insertmode EQ 0,ins,]` to force setting insert mode.
There is an _EDITMODE variable, but I wasn't able to use it in a keystroke plugin; dunno why. Perhaps someone more knowledgeable than me can make something of it.
 
#12
On Wed, 16 Dec 2009 22:32:13 -0600, Charles Dye <> wrote:

|There is an _EDITMODE variable, but I wasn't able to use it in a keystroke plugin; dunno why. Perhaps someone more knowledgeable than me can make something of it.

What about SETDOS /M1|0? That forces an edit mode.

_EDITMODE seems to work correctly in the shell. I see no reason it wouldn't in
a plugin. I'd do something like this:

WCHAR buf[128] = L"%_EDITMODE";
// or Sprintf(buf, L"%%_EDITMODE");
// can't do WCHAR buf[] = L"%EDITMODE" because it
// won't be writeable
ExpandVariables(buf, 1);
if ( szLine[0] = L'0' ) ...
--
- Vince
 
#13
On Wed, 16 Dec 2009 22:32:13 -0600, Charles Dye <> wrote:

|There is an _EDITMODE variable, but I wasn't able to use it in a keystroke plugin; dunno why. Perhaps someone more knowledgeable than me can make something of it.

What about SETDOS /M1|0? That forces an edit mode.

_EDITMODE seems to work correctly in the shell. I see no reason it wouldn't in
a plugin. I'd do something like this:

WCHAR buf[128] = L"%_EDITMODE";
// or Sprintf(buf, L"%%_EDITMODE");
// can't do WCHAR buf[] = L"%EDITMODE" because it
// won't be writeable
ExpandVariables(buf, 1);
if ( szLine[0] = L'0' ) ...
--
- Vince
I meant:

if ( buf[0] == L'0' ) ...
 

rconn

Administrator
Staff member
May 14, 2008
10,189
86
#14
> There is an _EDITMODE variable, but I wasn't able to use it in a
> keystroke plugin; dunno why. Perhaps someone more knowledgeable than
> me can make something of it.
_EDITMODE is the default value at the beginning of a new edit, not the
current state of insert/overstrike (which nobody has had a use for during
the previous 20 years!).

Rex Conn
JP Software
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,415
40
Albuquerque, NM
prospero.unm.edu
#15
Re: &quot;Simple question&quot; concerning insert/overstrike mode

What about SETDOS /M1|0? That forces an edit mode.
On second thought, if you wanted to do this in a keystroke plugin, there is no need to muck with TCC's editor state at all. Just insert your desired text at the start of the current command line, set the fRedraw flag, and Bob's your uncle.

Sometimes focusing too narrowly on the approach, rather than the goal, can make a problem seem a lot more difficult than it really is.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,415
40
Albuquerque, NM
prospero.unm.edu
#16
Re: &quot;Simple question&quot; concerning insert/overstrike mode

_EDITMODE is the default value at the beginning of a new edit, not the current state of insert/overstrike (which nobody has had a use for during the previous 20 years!).
Still don't, as far as I can see. At least not in a plugin.

But a keystroke to force the editing mode might well be useful for toolbar buttons or fancy KEYSTACK sequences. I'd suggest something like Ctrl-Alt-Insert to force insert mode on. (This chord also appears to be legal in KEYSTACK, though the keynames.htm topic in the help seems to suggest that only one modifier prefix per key is supported.)
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,415
40
Albuquerque, NM
prospero.unm.edu
#17
Re: &quot;Simple question&quot; concerning insert/overstrike mode

On second thought, if you wanted to do this in a keystroke plugin, there is no need to muck with TCC's editor state at all. Just insert your desired text at the start of the current command line, set the fRedraw flag, and Bob's your uncle.
Here is a quick'n'cheesy implementation.

One slightly surprising behavior: it looks like the keystroke plugin hook is not called during history recall or filename completion. If you press my Ctrl-F10 hotkey after completing a filename with Tab, or recalling a command line with Up, it'll just beep and return to normal editing mode. A second press will work as expected.
 

Attachments

#18
rconn wrote:
| ---Quote---
|| There is an _EDITMODE variable, but I wasn't able to use it in a
|| keystroke plugin; dunno why. Perhaps someone more knowledgeable
|| than me can make something of it.
| ---End Quote---
| _EDITMODE is the default value at the beginning of a new edit, not
| the current state of insert/overstrike (which nobody has had a use
| for during the previous 20 years!).

As Vince pointed out, I overlooked SETDOS /M, which can force the mode.
However, for it to operate one must be able to execute the command. An
insert-mode keystroke alias cannot do it. I cannot conceive any method
(short of a plugin) that could do this.
As to why one would need to know the state in the middle of editing the
current command, I requested years ago that there should be a method to
force insert mode by a keystroke alias, so one could use the alias to insert
specific strings into the command line. In particular, the following actions
are desirable for keystroke aliases:
1/ Control edit mode - is this keystroke alias supposed to insert or
overwrite? In my usage "insert-only" keystroke aliases never want to
overwrite the command line, so I'd force "insert" mode as the default.
2/ Control insertion point - frequently used and thus desirable options:
- at current location (this is already the default)
- at the end of the first word of the line
- at the end of the current word of the line
- before the current word of the line
- BOL
- EOL

All of these could be easily done by adding 3 new editing directives:
- "ForceInsertMode" to change editing mode to "insert"
- "BeginWord" moves cursor left to the beginning of the current
word, does nothing if cursor is already there
- "EndWord" moves cursor to the immediate right of the last
character of the current word, does nothing if cursor is already there.
In the context of BeginWord and EndWord, if the cursor is between a pair
of matching quotation marks ("double quotes"), the phrase "word" refers to
the whole quoted string.
The examples below would do all desired operations (instead of editing
keystrokes, their corresponding directive names in angle brackets are
shown):

alias @shift-F4=`<BeginLine><ForceInsertMode>bdebugger %@search[<EndWord>]`
this keystroke alias converts the current command to one which invokes
the debugger

alias @alt-f4=`<ForceInsertMode><BeginWord>%@expand[<EndWord>]`
this keystroke alias specifies that the current word is to be expanded
via @EXPAND

--
Steve