Skip to content

Commit

Permalink
Home and End behaviour
Browse files Browse the repository at this point in the history
In addition to moving to the start and end of the line, it now seeks the
first printable character if it was already at the start or end of the
line.
  • Loading branch information
peterkvt80 committed Jul 2, 2018
1 parent a75341d commit a426857
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 49 deletions.
40 changes: 37 additions & 3 deletions ttxpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,10 +917,44 @@ void TTXPage::SetCharAt(int code, int modifiers, wxPoint& cursorLoc, wxPoint& cu
switch (code)
{
case WXK_HOME : // Move to start of line
cursorLoc.x=0;
if (cursorLoc.x>0)
{
cursorLoc.x=0;
}
else // If already at the start of a line, find the start of text
{
for (cursorLoc.x=0;cursorLoc.x<40;cursorLoc.x++)
{
if (line->GetCharAt(cursorLoc.x)>' ')
{
break;
}
}
if (cursorLoc.x==40) // Reached the end of the line?
{
cursorLoc.x=0; // reset to the beginning
}
}
break;
case WXK_END : // Move to end of line. (TODO: Only move to the last non space character on the line)
cursorLoc.x=39;
case WXK_END : // Move to end of line. (or if already there, the last printable character)
if (cursorLoc.x<39)
{
cursorLoc.x=39;
}
else // If already at the end of a line, find the last text
{
for (cursorLoc.x=39;cursorLoc.x>0;cursorLoc.x--)
{
if (line->GetCharAt(cursorLoc.x)>' ')
{
break;
}
}
if (cursorLoc.x==0) // Reached the start of the line?
{
cursorLoc.x=39; // reset to the end
}
}
break;
case WXK_LEFT : // left 314
if (cursorLoc.x>8 || (cursorLoc.x>0 && cursorLoc.y>0)) // First 8 chars of header are off limits
Expand Down
4 changes: 2 additions & 2 deletions wxTED.depend
Original file line number Diff line number Diff line change
Expand Up @@ -2244,7 +2244,7 @@
<iostream>
"charchange.h"

1527346915 source:e:\dev\wxted-github\wxted\teletext40.cpp
1529793196 source:e:\dev\wxted-github\wxted\teletext40.cpp
"teletext40.h"

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

1527346495 e:\dev\wxted-github\wxted\wxtedmain.h
1530567608 e:\dev\wxted-github\wxted\wxtedmain.h
<wx/notebook.h>
<wx/menu.h>
<wx/panel.h>
Expand Down
86 changes: 43 additions & 43 deletions wxTED.layout
Original file line number Diff line number Diff line change
@@ -1,65 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="HelpFrame.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<ActiveTarget name="Debug" />
<File name="charchange.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="392" topLine="0" />
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="wxTEDMain.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="wxTEDMain.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="27666" topLine="505" />
<Cursor1 position="2041" topLine="33" />
</Cursor>
</File>
<File name="tedevent.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="PublishSetupDialog.cpp" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1395" topLine="38" />
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="tedevent.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="HelpFrame.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2132" topLine="26" />
<Cursor1 position="392" topLine="0" />
</Cursor>
</File>
<File name="PageSettingsDialog.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="HelpFrame.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
<Cursor1 position="393" topLine="0" />
</Cursor>
</File>
<File name="PublishSetupDialog.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="539" topLine="0" />
</Cursor>
</File>
<File name="PublishSetupDialog.cpp" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="teletext40.cpp" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5397" topLine="115" />
</Cursor>
</File>
<File name="HelpFrame.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="ttxline.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="393" topLine="0" />
<Cursor1 position="2601" topLine="57" />
</Cursor>
</File>
<File name="charchange.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="ttxpage.cpp" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
<Cursor1 position="7518" topLine="226" />
</Cursor>
</File>
<File name="ttxcodes.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="teletext40.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="673" topLine="0" />
<Cursor1 position="229" topLine="0" />
</Cursor>
</File>
<File name="ttxline.cpp" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="resource.rc" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4396" topLine="128" />
<Cursor1 position="54" topLine="0" />
</Cursor>
</File>
<File name="wxTEDApp.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
Expand All @@ -72,44 +62,54 @@
<Cursor1 position="1295" topLine="15" />
</Cursor>
</File>
<File name="ttxpage.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="PageSettingsDialog.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2301" topLine="73" />
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<File name="mapchar.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="34340" topLine="832" />
</Cursor>
</File>
<File name="ttxline.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="wxTEDApp.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2601" topLine="57" />
<Cursor1 position="406" topLine="0" />
</Cursor>
</File>
<File name="ttxpage.cpp" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="ttxpage.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7518" topLine="226" />
<Cursor1 position="2301" topLine="73" />
</Cursor>
</File>
<File name="resource.rc" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="ttxline.cpp" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="54" topLine="0" />
<Cursor1 position="4396" topLine="128" />
</Cursor>
</File>
<File name="wxTEDMain.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="ttxcodes.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2041" topLine="33" />
<Cursor1 position="673" topLine="0" />
</Cursor>
</File>
<File name="teletext40.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="tedevent.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="229" topLine="0" />
<Cursor1 position="1395" topLine="38" />
</Cursor>
</File>
<File name="wxTEDApp.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="wxTEDMain.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="406" topLine="0" />
<Cursor1 position="27666" topLine="505" />
</Cursor>
</File>
<File name="tedevent.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2132" topLine="26" />
</Cursor>
</File>
<File name="teletext40.cpp" open="1" top="1" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2808" topLine="57" />
</Cursor>
</File>
</CodeBlocks_layout_file>
2 changes: 1 addition & 1 deletion wxTEDMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#include "mapchar.h"

// Version number
#define VERSION_STRING wxT("1.32")
#define VERSION_STRING wxT("1.33")

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

0 comments on commit a426857

Please sign in to comment.