summaryrefslogtreecommitdiff
path: root/apfilo.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-12-29 13:04:40 -0500
committerJeffrey Armstrong <jeff@approximatrix.com>2021-12-29 13:04:40 -0500
commitf3ebef8119973bcb906f2a597e041ef7d5afab0c (patch)
tree20b3d40564bcbb594b4a8a56d74113c302388d89 /apfilo.f90
parent6921c5c7332dc2c2ddf1dd2415901d138ec48600 (diff)
downloadfilo-f3ebef8119973bcb906f2a597e041ef7d5afab0c.tar.gz
filo-f3ebef8119973bcb906f2a597e041ef7d5afab0c.zip
Additional changes to debug 1-indexing. Cursor now appears on correct line. Strange behavior at line end insert.
Diffstat (limited to 'apfilo.f90')
-rw-r--r--apfilo.f9022
1 files changed, 15 insertions, 7 deletions
diff --git a/apfilo.f90 b/apfilo.f90
index c933b91..2efbe1c 100644
--- a/apfilo.f90
+++ b/apfilo.f90
@@ -81,6 +81,9 @@ contains
call setviewport(E%x, E%y, E%x+E%w, E%y+E%h, .TRUE.)
call clearviewport()
+ ! We used to compute this per line, but the text height calcs are way off
+ rh = textheight('XXXyy')
+
y = 0
do irow = 1+E%rowoff, E%rowoff + E%screenrows
x = 0
@@ -94,8 +97,8 @@ contains
if(E%coloff+1 > len(row_text)) then
rh = textheight('XXX')
else
- icol = 1 + E%coloff
- icollast = min(E%coloff+E%screencols, len(row_text))
+ icol = 1 - E%coloff
+ icollast = min(icol+E%screencols, len(row_text))
call outtextxy(x, y, row_text(icol:icollast))
rh = textheight(row_text(icol:icollast))
end if
@@ -106,23 +109,28 @@ contains
end if
! Cursor
- if(irow - E%rowoff - 1 == E%cy) then
+ if(irow - E%rowoff == E%cy) then
if(.not. associated(row_text) .or. E%cx == 1) then
x = 0
else
! Width calculations are all messed up by trimming
! being performed in textwidth
- x = index(row_text(icol:icol+E%cx-2), ' ')
+ if(len(row_text) < icol+E%cx-2) then
+ E%cx = len(row_text) - icol + 2
+ end if
+ icollast = icol+E%cx-2
+ x = index(row_text(icol:icollast), ' ')
do while(x > 0)
x = x + icol - 1
+
row_text(x:x) = '_'
- x = index(row_text(icol:icol+E%cx-2), ' ')
+ x = index(row_text(icol:icollast), ' ')
end do
- x = textwidth(row_text(icol:icol+E%cx-2))
+ x = textwidth(row_text(icol:icollast))
end if
- call bar(x, y-rh-1, x+3, y+1)
+ call bar(x, y+rh-1, x+3, y+1)
end if
if(associated(row_text)) then