Skip to content

Commit

Permalink
TAB for insert space
Browse files Browse the repository at this point in the history
Added the TAB key to insert a space at the cursor location, as edit.tf does. The remainder of the line to the right is shifted one character to the right.
  • Loading branch information
peterkvt80 committed Jun 15, 2019
1 parent bb1ff5f commit efb0c07
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
21 changes: 15 additions & 6 deletions ttxpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -958,12 +958,6 @@ void TTXPage::SetCharAt(int code, int modifiers, wxPoint& cursorLoc, wxPoint& cu
line->SetCharAt(39,' ');
}
break;
case WXK_TAB : // Insert a space at the current location and shift right everything on the right
// Shift everything to the right, one space.@todo
// Insert a space
std::cout << "PRESSED TAB" << std::endl;
line->SetCharAt(cursorLoc.x,' ?'); //
break;
case WXK_HOME : // Move to start of line
if (cursorLoc.x>0)
{
Expand Down Expand Up @@ -1204,6 +1198,21 @@ void TTXPage::SetCharAt(int code, int modifiers, wxPoint& cursorLoc, wxPoint& cu
oldChar=line->SetCharAt(cursorLoc.x,'\r'); // Insert a double height
if (cursorLoc.x<39) cursorLoc.x++; // Move right if possible
AddEvent(EventKey,cursorLoc,oldChar,'\r');
case WXK_TAB : // Insert space
{
auto loc=cursorLoc;
for (loc.x=39;loc.x>cursorLoc.x;loc.x--)
{
char oldch=line->GetCharAt(loc.x);
char newch=line->GetCharAt(loc.x-1);
AddEvent(EventKey, loc, oldch, newch);
line->SetCharAt(loc.x,newch);
}
// Last character is stuffed with a space
AddEvent(EventKey, loc, line->GetCharAt(cursorLoc.x), ' ');
line->SetCharAt(cursorLoc.x, ' '); // The current location is now a space
}
break;
default:
std::cout << "This key code is not implemented: " << code << std::endl;
}
Expand Down
6 changes: 3 additions & 3 deletions wxTED.depend
Original file line number Diff line number Diff line change
Expand Up @@ -2282,7 +2282,7 @@
1560039184 source:e:\dev\wxted-github\wxted\ttxline.cpp
"ttxline.h"

1560556379 source:e:\dev\wxted-github\wxted\ttxpage.cpp
1560611710 source:e:\dev\wxted-github\wxted\ttxpage.cpp
"ttxpage.h"

1476983748 source:e:\dev\wxted-github\wxted\wxtedapp.cpp
Expand Down Expand Up @@ -2382,7 +2382,7 @@
1412634843 e:\dev\downloads\wxwidgets302\include\wx\univ\theme.h
"wx/string.h"

1560374850 e:\dev\wxted-github\wxted\wxtedmain.h
1560612284 e:\dev\wxted-github\wxted\wxtedmain.h
<wx/notebook.h>
<wx/menu.h>
<wx/panel.h>
Expand Down Expand Up @@ -2794,7 +2794,7 @@
"wx/dynarray.h"
"wx/vidmode.h"

1560382316 source:e:\dev\wxted-github\wxted\wxtedmain.cpp
1560556477 source:e:\dev\wxted-github\wxted\wxtedmain.cpp
"wxTEDMain.h"
<wx/msgdlg.h>
"wx/wx.h"
Expand Down
4 changes: 2 additions & 2 deletions wxTEDMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Purpose: Defines Application Frame
* Author: Peter Kwan ([email protected])
* Created: 2014-10-30
* Copyright: Peter Kwan (http://www.teastop.co.uk) 2014-2018
* Copyright: Peter Kwan (c) 2014-2019
* License:
*
* Permission to use, copy, modify, and distribute this software
Expand Down Expand Up @@ -54,7 +54,7 @@
#include "mapchar.h"

// Version number
#define VERSION_STRING wxT("1.37")
#define VERSION_STRING wxT("1.38")

// ftp
#include <wininet.h>
Expand Down

0 comments on commit efb0c07

Please sign in to comment.